我试图运行一个简单的木偶脚本与开玩笑。下面是我的package.json内容:
{
"name": "jest-puppeteer-project",
"version": "1.0.0",
"description": "Test framework using Jest and Puppeteer",
"main": "index.js",
"scripts": {
"test": "jest --forceExit"
},
"author": "Anil Kumar Cheepuru",
"license": "ISC",
"dependencies": {
"@babel/core": "^7.12.3",
"@babel/preset-env": "^7.12.1",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"jest-puppeteer": "^4.4.0",
"puppeteer": "^5.4.1"
}
}下面的是我的笑话-pupeteer.config.js内容:
module.exports = {
launch: {
headless: false,
},
browserContext: "default"
};我还在我的文件中设置了预置:“小丑木偶师”。
下面是当我试图使用命令运行脚本时在控制台中遇到的错误:npm运行测试

我试着从不同的来源寻找解决方案,但没有运气。有人能帮我吗?
发布于 2020-11-14 13:44:38
如果您将jest本地安装到您的项目中,那么以下命令:
"scripts": {
"test": "jest --forceExit"
}不会发现你在本地安装的笑话。尝试将其更改为./node_modules/.bin/jest --forceExit
"scripts": {
"test": "./node_modules/.bin/jest --forceExit"
}https://stackoverflow.com/questions/64834419
复制相似问题