Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Unbreak test:cli due to unknown 'qunit' command
Follows-up 362e241, which removed 'npm link' from the 'test:cli' script command. Initially, I thought the reason the child proceses can't find qunit is due to our use of execa.shell instead of regular execa. Specifically, execa.shell() spawns a process that starts with a new shell and no inherited environment variables. execa() on the other hand inherits environment variables like PATH by default, and it also has a 'preferLocal' option that ensures node_modules/.bin is in the PATH even if you're running the tests without 'npm run ..' (e.g. if you'd use 'bin/qunit test/cli/*.js' directly). Switching to execa() is non-trivial because it requires an array as input and there aren't built-in or trust-worthy modules that parse a command string into an array. Trying it with brute-force I realised the problem is actually that 'qunit' isn't visible at all even in the original environment created by npm-run. While npm-run does add node_modules/.bin, and bins from (dev)dependencies are indeed linked from there, the bins from the current package itself (qunit) are never linked in .bin. So... keeping it simple and just string-replacing 'qunit' with 'bin/qunit', which also matches the way we invoke the cli from other commands in package.json already.
- Loading branch information