Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion xunit-viewer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs'
import path from 'path'
import { showHelp } from './src/cli/args.js'
import getDescription from './src/cli/get-description.js'
import getFiles from './src/cli/get-files.js'
import getSuites from './src/cli/get-suites.js'
Expand All @@ -14,7 +15,6 @@ export default async (args) => {

const results = args.results
if (!fs.existsSync(results)) {
const { showHelp } = import('./src/cli/args.js')
showHelp()
Copy link

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)

console.log(logger.error('\n The folder/file:'), logger.file(results), logger.error('does not exist'))
if (!args.script) process.exit(1)
Expand Down