-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read properties of undefined (reading 'filename') #301
Comments
I replaced I created https://github.com/Rinse12/oclif-test as a temporary until the fix is merged. |
Edit: with require.main.filename, I get the error:
|
@mdonnalley Do you have any idea in this case? We can submit a fix if we know how to approach this |
Looking at sindresorhus/meow#157 one suggested fix is passing the filename from the calling code. Maybe the API for test
.stderr({ print: true })
.command(['deploy', name]) becomes test({ filename })
.stderr({print: true })
.command(['deploy', name])' and if no filename provided would fall back to current behaviour? |
Another ugly workaround is below import { createRequire } from 'module';
import { expect as expectType, test as testType } from '@oclif/test';
const { expect, test } = createRequire(import.meta.url)('@oclif/test') as {
expect: typeof expectType;
test: typeof testType;
}; |
I believe this was fixed in 2.4.0 - please reopen if you think there's still an issue here. |
Node (ESM) fails on importing oclif/test due to this line
test/src/index.ts
Line 9 in adb0c93
module.parent
is undefined in ESM.The text was updated successfully, but these errors were encountered: