Closed CyanGlory closed 4 years ago
npm run test also failed, this is the error log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test' ]
2 info using npm@5.3.0
3 info using node@v8.6.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle koa-examples@0.0.1~pretest: koa-examples@0.0.1
6 info lifecycle koa-examples@0.0.1~test: koa-examples@0.0.1
7 verbose lifecycle koa-examples@0.0.1~test: unsafe-perm in lifecycle true
8 verbose lifecycle koa-examples@0.0.1~test: PATH: D:\nvm\v8.6.0\node_modules\npm\bin\node-gyp-bin;F:\demo\examples\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Git\cmd;C:\Program Files\MongoDB\Server\3.4\bin\;C:\Users\Administrator.TUVRNIXJMBJSWX6\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\Administrator.TUVRNIXJMBJSWX6\AppData\Local\Microsoft\WindowsApps;D:\编辑器VsCode\Microsoft VS Code\bin;D:\nvm;C:\Program Files\nodejs
9 verbose lifecycle koa-examples@0.0.1~test: CWD: F:\demo\examples
10 silly lifecycle koa-examples@0.0.1~test: Args: [ '/d /s /c', 'make test' ]
11 silly lifecycle koa-examples@0.0.1~test: Returned: code: 1 signal: null
12 info lifecycle koa-examples@0.0.1~test: Failed to exec test script
13 verbose stack Error: koa-examples@0.0.1 test: `make test`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (D:\nvm\v8.6.0\node_modules\npm\lib\utils\lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at EventEmitter.emit (events.js:213:7)
13 verbose stack at ChildProcess.<anonymous> (D:\nvm\v8.6.0\node_modules\npm\lib\utils\spawn.js:40:14)
13 verbose stack at emitTwo (events.js:125:13)
13 verbose stack at ChildProcess.emit (events.js:213:7)
13 verbose stack at maybeClose (internal/child_process.js:927:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid koa-examples@0.0.1
15 verbose cwd F:\demo\examples
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
18 verbose node v8.6.0
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error koa-examples@0.0.1 test: `make test`
22 error Exit status 1
23 error Failed at the koa-examples@0.0.1 test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
test.js是个测试脚本,你先安装Mocha,然后运行Mocha 404/test.js @CyanGlory
Once you've done an npm install
, run npm test
.
If you'd like to specifically target the tests in base-auth/test.js
, change the highest-level describe
to describe.only
, like so:
describe.only('Koa Basic Auth', function() { ...
npm test
actually runs a Makefile in the background, not just simply running the test file with the Node command line.
hi @CyanGlory unfortunately, the current "npm test" command is based on a makefile to manage all the scripts to execute. "make" is not natively available on windows, you need to install it (https://cognitivewaves.wordpress.com/makefiles-windows/)
I was curious, why use make and not just npm?
I think that this is what tj used to use to manage scripting orchestration in his projects.
I was curious, why use make and not just npm?
this is old, converting to npm run
is welcomed
I submitted a PR to use npm run instead.
I'v installed the dependence, but , I can't run the test.js file like this:
It shows ReferenceError: describe is not defined. can they be runing successfully in your computer?
I use vscode 1.17.1 Os: windows node is the latest version 8.6.0