I'm using [email protected] on Mac High Sierra. I want to run tests that were setup in this Stratum client project. I have run npm install
successfully. But when I try and run individual tests, I get the error:
no test specified
What gives? I am in the root project directory and the tests are in my "test" folder. Here is what happens:
localhost:stratum-client-master davea$ npm install up to date in 0.381s localhost:stratum-client-master davea$ npm test test/callbacks.js > [email protected] test /Users/davea/Documents/workspace/stratum-client-master > echo "Error: no test specified" && exit 1 "test/callbacks.js" Error: no test specified sh: line 0: exit: too many arguments npm ERR! Test failed. See above for more details.
npm run only one test n order to run a specific test, you'll need to use the jest command. npm test will not work. To access jest directly on the command line, install it via npm i -g jest-cli or yarn global add jest-cli. Then simply run your specific test with jest bar.
Check the ignore-script config If you see the start script is present inside your package. json file but still can't run the script, you need to check the console output. If there's no output at all, then you may have the ignore-scripts npm configuration set to true .
The npm test command is used to test a package. This command runs the test script that is contained in a package, if you provided one.
npm run sets the NODE environment variable to the node executable with which npm is executed. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install , just in case you've forgotten.
Try replacing
"scripts": { "test": "mocha" },
in your package.json
.
You're outputting exactly what the package.json file was told to output. Take a peek under scripts
.
"scripts": { "test": "echo \"Error: no test specified\" && exit 1", "int-test": "mocha --require babel-core/register --recursive test" },
Try int-test
, the other command in there.
Update: The package link has changed to the following and mocha should be the default test suite. You can run the other script with npm run bump-version
; the original script above can be run with npm run int-test
.
"scripts": { "test": "mocha --recursive test", "bump-version": "npm version patch" },
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With