【发布时间】:2018-02-25 12:15:07
【问题描述】:
我刚开始在这个项目中添加测试,并决定添加 Circle CI。 到目前为止,它运行良好,包括测试。但是当我在 CircleCI 中运行它时,它失败了。
circleci.yml
version: 2
jobs:
build:
working_directory: ~/project
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: yarn test
测试输出:
#!/bin/bash -eo pipefail
yarn test
yarn run v1.3.2
$ jest --coverage
FAIL __tests__/Components/Shared/RoundButton.js
● Test suite failed to run
Cannot find module '../../Themes' from 'RoundButton.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:191:17)
at Object.<anonymous> (src/Components/Shared/RoundButton.js:12:13)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 2.514s
Ran all test suites.
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | Unknown | Unknown | Unknown | Unknown | |
----------|----------|----------|----------|----------|-------------------|
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 1
路径:
./__tests__/Components/Shared/RoundButton.js
./src/Components/Shared/RoundButton.js
./src/Themes
版本:
"babel-jest": "^22.2.2",
"jest": "^22.4.2",
【问题讨论】:
-
在本地同目录运行会出现这种情况吗?
-
我尝试过 SSH,它也发生了。我在本地克隆了一个新文件夹,但它没有发生(但我在快照上有缩进错误,我正在检查为什么 atm)@NickMcCurdy
标签: react-native jestjs circleci