当使用测试笑话时,开玩笑的测试太多了……不是我想要的测试
由于某种原因,我似乎无法将“柏树,伪造者和开玩笑的单位测试”分为单独的命令:
package.json:
"test:jest": "jest ./src",
"e2e:pptr": "npm run dev & jest ./tests",
"e2e:cypress": "npm run dev & cypress run",
"e2e:cypress:browser": "npm run dev & cypress open",
...
"jest": {
"verbose": true,
"testEnvironment": "jsdom",
"transform": {
"^.+\\.svelte$": [
"svelte-jester",
{
"preprocess": true
}
],
"^.+\\.js$": "babel-jest",
"^.+\\.ts$": "ts-jest"
},
"moduleFileExtensions": [
"js",
"ts",
"svelte"
],
"setupFilesAfterEnv": [
"@testing-library/jest-dom/extend-expect"
]
}
当我运行npm运行测试时:JEST
它仍然会运行所有测试。包括柏树和./ tests/*。spec.js
文件。它建议仅在./src下进行测试,这是我的单位测试。
Puppeteer测试在/tests/*。Spec.js
中,柏树在./ cypress/*
下
For some reason I can't seem to split out "cypress, puppeteer and jest unit tests" into separate commands:
package.json:
"test:jest": "jest ./src",
"e2e:pptr": "npm run dev & jest ./tests",
"e2e:cypress": "npm run dev & cypress run",
"e2e:cypress:browser": "npm run dev & cypress open",
...
"jest": {
"verbose": true,
"testEnvironment": "jsdom",
"transform": {
"^.+\\.sveltequot;: [
"svelte-jester",
{
"preprocess": true
}
],
"^.+\\.jsquot;: "babel-jest",
"^.+\\.tsquot;: "ts-jest"
},
"moduleFileExtensions": [
"js",
"ts",
"svelte"
],
"setupFilesAfterEnv": [
"@testing-library/jest-dom/extend-expect"
]
}
WHen I run npm run test:jest
it still runs all tests. including cypress and ./tests/*.spec.js
files. Its suppposed to just run tests under ./src which are my unit tests.
puppeteer tests are in ./tests/*.spec.js
and cypresss are under ./cypress/*
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,我需要添加
- rootdir< path>
以限制它。“ test:jest”:“ Jest -rootdir ./src”,
So I needed to add
--rootDir <path>
to limit it."test:jest": "jest --rootDir ./src",