gpt4 book ai didi

jestjs - 所有测试都通过了 100% 的覆盖率,但 jest 返回退出代码 1

转载 作者:行者123 更新时间:2023-12-05 07:32:53 29 4
gpt4 key购买 nike

我查看了 --detectLeaks--detectOpenHandles,它确实引发了一些错误,但输出中没有明显的问题。

我有一个 monorepo,我在 jenkins 中的 docker/pipeline 中运行 jest。

> 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

这是我的 Jest 配置:

{
"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

最佳答案

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

我用 lerna 分别运行每一个来找到它。

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

关于jestjs - 所有测试都通过了 100% 的覆盖率,但 jest 返回退出代码 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50957645/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com