gpt4 book ai didi

jestjs - 预设 Jest puppeteer 无效

转载 作者:行者123 更新时间:2023-12-04 13:37:18 26 4
gpt4 key购买 nike

在一个工作 Jest + puppeteer 操作项目中,
为了使用 jest-circus retry feature,我要去 jest-circus .
正如所记录的,我安装了 jest-circus 并设置为运行者,但像往常一样运行测试我得到

 Validation Error:

Preset jest-puppeteer is invalid:

The "id" argument must be of type string. Received type object
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type object
at validateString (internal/validators.js:112:11)
at Module.require (internal/modules/cjs/loader.js:842:3)
at require (internal/modules/cjs/helpers.js:74:18)
at setupPreset (C:\src\qa-e2e-update-stack\node_modules\jest-config\build\normalize.js:348:14)
at normalize (C:\src\qa-e2e-update-stack\node_modules\jest-config\build\normalize.js:703:15)
at readConfig (C:\src\qa-e2e-update-stack\node_modules\jest-config\build\index.js:220:68)
at async readConfigs (C:\src\qa-e2e-update-stack\node_modules\jest-config\build\index.js:401:26)
at async runCLI (C:\src\qa-e2e-update-stack\node_modules\@jest\core\build\cli\index.js:203:59)
at async Object.run (C:\src\qa-e2e-update-stack\node_modules\jest\node_modules\jest-cli\build\cli\index.js:216:37)

Configuration Documentation:
https://jestjs.io/docs/configuration.html

这是我的 jest.config.js 文件
const fs = require('fs')
reportFolder = "reports"
if (!fs.existsSync(reportFolder)){
fs.mkdirSync(reportFolder)
}

module.exports = {
preset: "jest-puppeteer",
testRunner: "jest-circus/runner",
setupFilesAfterEnv: [ // NOT setupFiles
"./configurazioni/custom-configuration.js",
"./configurazioni/shared-require.js",
"jest-allure/dist/setup"
],
"reporters": [
"default",
["./node_modules/jest-html-reporter", {
"pageTitle": "Test Report",
"includeFailureMsg": true,
"includeConsoleLog": true,
"outputPath":"reports/"+new Date().getDate() + "-" +
(new Date().getMonth() + 1) + "-"
+ new Date().getFullYear()+ "-"
+ new Date().getHours().toString() + "-"
+ (new Date().getMinutes() + 1 ).toString() + "-"
+ (new Date().getSeconds() + 1 ).toString()
+"-run.html"
}],
["jest-junit", { outputName: "reports/junitreport.xml" }]
],
moduleNameMapper: {
'^\\$lib\/(.*)': `<rootDir>/lib/$1`,
},
};

我没有找到任何讨论我的问题的页面,jest-circus 和 jest-preset 不能共存?

最佳答案

我在 rootDir 时遇到了这样的错误在 jest 配置文件中设置不正确。

关于jestjs - 预设 Jest puppeteer 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61081835/

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