在一个有效的 jest + puppeteer 项目中,我正在转向 jest-circus 以使用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 不能共存?