我知道这是Testcafe最常见的问题,但是我之前曾发布过问题,解决方案不匹配/无法解决我的问题。 Testcafe版本1.8.4,具有吸引力报告。我已经在项目中配置了按顺序运行的几个测试套件,但是在第一个套件运行之后,Testcafe终止并显示以下错误,并中止了测试运行。
npm ERR! code ELIFECYCLE
npm ERR! errno 4
npm ERR! [email protected] test:appjourneys:azure: `TARGET_ENV=test DATA_CENTER=azwus2 testcafe 'chromium:headless:emulation' './journeys/app-journeys/*-spec.js' -r allure`
npm ERR! Exit status 4
npm ERR!
npm ERR! Failed at the [email protected] test:appjourneys:azure script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Venkat/.npm/_logs/2020-05-27T03_13_43_108Z-debug.log
Below is the debug log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/Cellar/node/12.10.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'test:appjourneys:azure'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [
4 verbose run-script 'pretest:appjourneys:azure',
4 verbose run-script 'test:appjourneys:azure',
4 verbose run-script 'posttest:appjourneys:azure'
4 verbose run-script ]
5 info lifecycle [email protected]~pretest:appjourneys:azure: [email protected]
6 info lifecycle [email protected]~test:appjourneys:azure: [email protected]
7 verbose lifecycle [email protected]~test:appjourneys:azure: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~test:appjourneys:azure: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/Venkat/GAP/store-service/user-journeys-testcafe/node_modules/.bin:/usr/local/Cellar/maven/3.6.0/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/maven/3.6.0/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/bin
9 verbose lifecycle [email protected]~test:appjourneys:azure: CWD: /Users/Venkat/GAP/store-service/user-journeys-testcafe
10 silly lifecycle [email protected]~test:appjourneys:azure: Args: [
10 silly lifecycle '-c',
10 silly lifecycle "TARGET_ENV=test DATA_CENTER=azwus2 testcafe 'chromium:headless:emulation' './journeys/app-journeys/*-spec.js' -r allure"
10 silly lifecycle ]
11 silly lifecycle [email protected]~test:appjourneys:azure: Returned: code: 4 signal: null
12 info lifecycle [email protected]~test:appjourneys:azure: Failed to exec test:appjourneys:azure script
13 verbose stack Error: [email protected] test:appjourneys:azure: `TARGET_ENV=test DATA_CENTER=azwus2 testcafe 'chromium:headless:emulation' './journeys/app-journeys/*-spec.js' -r allure`
13 verbose stack Exit status 4
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:209:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:209:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/Venkat/GAP/store-service/user-journeys-testcafe
16 verbose Darwin 17.7.0
17 verbose argv "/usr/local/Cellar/node/12.10.0/bin/node" "/usr/local/bin/npm" "run" "test:appjourneys:azure"
18 verbose node v12.10.0
19 verbose npm v6.11.3
20 error code ELIFECYCLE
21 error errno 4
22 error [email protected] test:appjourneys:azure: `TARGET_ENV=test DATA_CENTER=azwus2 testcafe 'chromium:headless:emulation' './journeys/app-journeys/*-spec.js' -r allure`
22 error Exit status 4
23 error Failed at the [email protected] test:appjourneys:azure script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 4, true ]
我尝试了以下操作:
npm-全新安装
将testcafe更新到最新版本1.8.4 3。
我将我的套件合并到一个npm run <cmd>
中-这有助于运行测试,但是错误仍然会在最后显示,并且构建状态不稳定。有什么想法要克服吗?
我在NPM日志中看到以下错误:
Error: [email protected] test:appjourneys:azure: \\`TARGET_ENV=test DATA_CENTER=azwus2 testcafe 'chromium:headless:emulation' './journeys/app-journeys/*-spec.js' -r allure\\`
Exit status 4
at EventEmitter.<anonymous>
这意味着TestCafe使用退出代码4完成了测试。
TestCafe在测试会话期间某些测试失败时以非零退出代码结束。在这种情况下,有4个测试失败。
如果要通过退出代码禁用测试失败指示,则可以将|| exit 0
附加到TestCafe命令。