getappmap/appmap-agent-js

Possible bad command line mangling: `Unknown command: "[...]/@appland/appmap-agent-js/lib/node/recorder-mocha.mjs`

Opened this issue · 1 comments

Error seen in telemetry.

Called by /Users/user/Develop/.npm/_npx/3007b677135bbf3c/node_modules/.bin/appmap record test -d /Users/user/Develop/abc/app/:

npx @appland/appmap-agent-js --recorder=mocha -- npm run mocha
===
{}
===
(node:74639) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Treating main file as commonjs, this might not always be appropriate -- cf: https://github.com/nodejs/node/issues/41465
Unknown command: "/Users/user/Develop/.npm/_npx/5cc1c6504f9acf64/node_modules/@appland/appmap-agent-js/lib/node/recorder-mocha.mjs"

To see a list of supported npm commands, run:
npm help

The problem is that we are not supporting invoking mocha through npm run. For that we would need to parse and hook the command of scripts.test in package.json. We could at least provide a better error message