所有测试通过100%覆盖率,但笑话返回退出代码1

时间:2018-06-20 21:57:04

标签: jestjs

我研究了--detectLeaks--detectOpenHandles,它确实引起了一些错误,但是输出中没有明确的问题。

我有一个monorepo,并且在docker /管道内的jenkins中开玩笑。

> abide@1.0.0 jest /var/jenkins_home/workspace/abide
> jest --coverage --no-cache --runInBand

[BABEL] Note: The code generator has deoptimised the styling of "/var/jenkins_home/workspace/abide/node_modules/lodash/lodash.js" as it exceeds the max of "500KB".
PASS packages/help.parse-argv/index.test.js (10.842s)
[BABEL] Note: The code generator has deoptimised the styling of "/var/jenkins_home/workspace/abide/node_modules/text-encoding/lib/encoding-indexes.js" as it exceeds the max of "500KB".
hello
npm notice created a lockfile as package-lock.json. You should commit this file.
+ example-working@0.0.1
added 2 packages from 2 contributors and audited 2 packages in 2.837s
found 0 vulnerabilities

require successfull
Usage: --function <args> [--function <args>]

    --a (echo hi)
    --b (echo hi)
    --c (echo hi)
    --help (shows this help output)
--------------------------------|----------|----------|----------|----------|-------------------|
File                            |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
--------------------------------|----------|----------|----------|----------|-------------------|
All files                       |      100 |      100 |      100 |      100 |                   |
 command                        |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 command-plus                   |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 dep-merge                      |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 dep-merge-cli                  |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 dep-pointer                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 dep-pointer-cli                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 gitpkg.traverse-up             |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 gitpkg.upsert                  |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 help                           |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 help.filter-until              |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 help.parse-argv                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 help.set-entire                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 help.string-argv               |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 here                           |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 journey                        |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 journey.coerce-to-array        |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 journey.coerce-to-plain-object |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 journey.fn-free                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 journey.fn-reduce              |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 journey.pass-thru              |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 lerna.paths                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 lerna.utils                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 monorepo-babel-cli             |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 monorepo-dep-lint-cli          |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg                            |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-cli                        |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-babel-6-to-node-4   |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-babel-7-to-node-4   |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-cobalt              |        0 |        0 |        0 |        0 |                   |
  index.js                      |        0 |        0 |        0 |        0 |                   |
 pkg-plugin-jest                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-name-dir            |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-name-scope          |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-prop                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-sort                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg-plugin-standard            |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.file-exists                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.fs                         |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.is-local-module            |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.json-parse                 |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.pretty-json                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.prop-overwrite             |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.read-json                  |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkg.throw-error                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkgprop                        |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 pkgprop-cli                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 reggi-cli                      |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 replace-cli                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 requireable                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 requireable-cli                |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 results-cli                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 shebang-check                  |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 shebang-check-cli              |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 subrepo                        |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
 subrepo-cli                    |      100 |      100 |      100 |      100 |                   |
  index.js                      |      100 |      100 |      100 |      100 |                   |
--------------------------------|----------|----------|----------|----------|-------------------|
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abide@1.0.0 jest: `jest --coverage --no-cache --runInBand`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the abide@1.0.0 jest 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!     /root/.npm/_logs/2018-06-20T13_11_31_412Z-debug.log

这是我开玩笑的配置:

{
    "collectCoverage": true,
    "coveragePathIgnorePatterns": [
      "<rootDir>/unpublished/.+",
      "<rootDir>/packages/.+/examples/.+",
      ".+build.js",
      "<rootDir>packages/pkg-plugin-prop/index.build.js"
    ],
    "coverageReporters": [
      "html",
      "text"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 100,
        "functions": 100,
        "lines": 100,
        "statements": 100
      }
    },
    "modulePathIgnorePatterns": [
      "<rootDir>/unpublished/.+",
      "<rootDir>/packages/.+/examples/.+",
      ".+build.js"
    ],
    "projects": [
      "<rootDir>/packages/.+"
    ],
    "testPathIgnorePatterns": [
      "<rootDir>/unpublished/.+",
      "<rootDir>/packages/.+/examples/.+",
      ".+build.js"
    ],
    "watchPathIgnorePatterns": [
      "<rootDir>/unpublished/.+",
      "<rootDir>/packages/.+/examples/.+",
      ".+build.js"
    ]
  }

这是怎么回事?

在本地它确实返回0退出代码并打印:

Snapshot Summary
 › 11 snapshots written from 6 test suites.

Test Suites: 55 passed, 55 total
Tests:       290 passed, 290 total
Snapshots:   11 written, 12 passed, 23 total
Time:        112.189s
Ran all test suites.

> abide@1.0.0 postjest /Users/thomas/Desktop/github.com/reggi/abide
> here --cleanCoverage

1 个答案:

答案 0 :(得分:0)

我有一个模块正在调用process.stderr.write()

我用lerna逐个运行它们来查找它。

lerna exec --concurrency 1 -- jest --no-cache --runInBand --ci