-
Notifications
You must be signed in to change notification settings - Fork 43
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
Fix broken dynamic import #159
base: master
Are you sure you want to change the base?
Conversation
@@ -14,7 +15,6 @@ export default async (args) => { | |||
|
|||
const results = args.results | |||
if (!fs.existsSync(results)) { | |||
const { showHelp } = import('./src/cli/args.js') | |||
showHelp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this fix, I see the error below when I run the following command (the test_logs directory exists, but foo.xml does not)
xunit-viewer -r test_logs/foo.xml
TypeError: Cannot write private member to an object whose class did not declare it
at O (/Users/williamwallace/.config/yarn/global/node_modules/yargs/build/index.cjs:1:3385)
at showHelp (/Users/williamwallace/.config/yarn/global/node_modules/yargs/build/index.cjs:1:42722)
at default (file:///Users/williamwallace/.config/yarn/global/node_modules/xunit-viewer/xunit-viewer.js:18:5)
at file:///Users/williamwallace/.config/yarn/global/node_modules/xunit-viewer/bin/xunit-viewer.js:6:1
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:120:12)
@steve-taylor could you elaborate on why it is broken? |
The cause is explained here. |
The dynamic import should have used
await
so it would destructure the imported module rather than thePromise
returned byimport('./src/cli/args.js')
.Rather than add
await
, I converted it to a static import because the dynamic import seemed unnecessary.