getappmap / appmap-agent-js

This project is deprecated. Please use https://github.com/getappmap/appmap-node/ to record Node.js applications.
Other
27 stars 8 forks source link

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

Open dividedmind opened 1 year ago

dividedmind commented 1 year ago

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
lachrist commented 1 year ago

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