尽管测试成功,但“ npm测试”失败(使用create-react-app创建的reactjs应用)

时间:2019-01-22 05:18:04

标签: reactjs jestjs create-react-app

我使用create-react-app创建了reactjs应用。

运行该应用程序即可。运行测试有效。非常好而且容易。

然后为gitlab创建了一个管道来运行构建和测试。

在gitlab上成功构建,但是在测试时失败了。

> react-scripts test

PASS src/App.test.js
  ✓ renders without crashing (25ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.955s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

无论如何,我无法找到有关失败原因的更多详细信息,也不知道如何解决。

运行npm test后--verbose这是新的输出:

$npm test --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'test',
npm verb cli   '--verbose' ]
npm info using npm@6.5.0
npm info using node@v11.7.0
npm verb run-script [ 'pretest', 'test', 'posttest' ]
npm info lifecycle easyauto123@0.1.0~pretest: easyauto123@0.1.0
npm info lifecycle easyauto123@0.1.0~test: easyauto123@0.1.0

> easyauto123@0.1.0 test /builds/easyauto123/website
> react-scripts test

PASS src/App.test.js
  ✓ renders without crashing (30ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.13s
Ran all test suites.
npm verb lifecycle easyauto123@0.1.0~test: unsafe-perm in lifecycle true
npm verb lifecycle easyauto123@0.1.0~test: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/builds/easyauto123/website/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
npm verb lifecycle easyauto123@0.1.0~test: CWD: /builds/easyauto123/website
npm info lifecycle easyauto123@0.1.0~test: Failed to exec test script
npm ERR! Test failed.  See above for more details.
npm verb exit [ 1, true ]
npm timing npm Completed in 3576ms
npm verb code 1
ERROR: Job failed: exit code 1

0 个答案:

没有答案