following are the version details
Version: 1.74.3 (user setup)
Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Date: 2023-01-09T16:59:02.252Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.22000
Sandboxed: No
creating an extension and write test cases for common method file and when run with debug panel from activity bar ( which use launch.json) then it run and give test result also but when run below in terminal
npm run test
it failed with below output
D:\Developer\color-extension>npm run test
> [email protected] pretest D:\Developer\color-extension
> npm run compile && npm run lint
> [email protected] compile D:\Developer\color-extension
> tsc -p ./
> [email protected] lint D:\Developer\color-extension
> eslint src --ext ts
> [email protected] test D:\Developer\color-extension
> node ./out/test/runTest.js
Failed to run tests
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `node ./out/test/runTest.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
and here is additional log
0 info it worked if it ends with ok
1 verbose cli [
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'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle [email protected]~pretest: [email protected]
6 verbose lifecycle [email protected]~pretest: unsafe-perm in lifecycle true
7 verbose lifecycle [email protected]~pretest: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Developer\color-collector\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Users\User\AppData\Roaming\npm;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\User\AppData\Local\GitHubDesktop\bin;C:\xampp\php;C:\Users\User\composer;C:\Users\User\AppData\Roaming\Composer\vendor\bin;C:\Program Files\Sublime Text\;;C:\Users\User\AppData\Local\Programs\oh-my-posh\bin
8 verbose lifecycle [email protected]~pretest: CWD: D:\Developer\color-collector
9 silly lifecycle [email protected]~pretest: Args: [ '/d /s /c', 'npm run compile && npm run lint' ]
10 silly lifecycle [email protected]~pretest: Returned: code: 0 signal: null
11 info lifecycle [email protected]~test: [email protected]
12 verbose lifecycle [email protected]~test: unsafe-perm in lifecycle true
13 verbose lifecycle [email protected]~test: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Developer\color-collector\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\PowerShell\7\;C:\Users\User\AppData\Local\Microsoft\WindowsApps;C:\Users\User\AppData\Roaming\npm;C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\User\AppData\Local\GitHubDesktop\bin;C:\xampp\php;C:\Users\User\composer;C:\Users\User\AppData\Roaming\Composer\vendor\bin;C:\Program Files\Sublime Text\;;C:\Users\User\AppData\Local\Programs\oh-my-posh\bin
14 verbose lifecycle [email protected]~test: CWD: D:\Developer\color-collector
15 silly lifecycle [email protected]~test: Args: [ '/d /s /c', 'node ./out/test/runTest.js' ]
16 silly lifecycle [email protected]~test: Returned: code: 1 signal: null
17 info lifecycle [email protected]~test: Failed to exec test script
18 verbose stack Error: [email protected] test: `node ./out/test/runTest.js`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
18 verbose stack at EventEmitter.emit (events.js:400:28)
18 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
18 verbose stack at ChildProcess.emit (events.js:400:28)
18 verbose stack at maybeClose (internal/child_process.js:1055:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
19 verbose pkgid [email protected]
20 verbose cwd D:\Developer\color-collector
21 verbose Windows_NT 10.0.22000
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
23 verbose node v14.17.6
24 verbose npm v6.14.15
25 error code ELIFECYCLE
26 error errno 1
27 error [email protected] test: `node ./out/test/runTest.js`
27 error Exit status 1
28 error Failed at the [email protected] test script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
package.json
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"coverage": "c8 --check-coverage npm run test"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/mocha": "^10.0.1",
"@types/node": "16.x",
"@types/vscode": "^1.74.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@vscode/test-electron": "^2.2.0",
"c8": "^7.12.0",
"eslint": "^8.28.0",
"glob": "^8.0.3",
"mocha": "^10.1.0",
"typescript": "^4.9.3"
}
what could be the issue here? As far as I see it run posttest script but there is no posttet script added in package.json, is that the reason because I have created this extension and the package.json generated by yo generator.
re run npm install
and npm cache clean --force
too but no benifit.
CodePudding user response:
it was node version issue but not displaying in any error. when I delete the node_modules and do npm install again then it tell electron require v 16 and more so after updating the node version , able to execute the test command.