Jac*_*ack 2 protractor ts-jest angular8
我是 Angular 测试的新手,我想为我的应用程序执行两种测试:
我的问题是,我可以在我的应用程序中同时使用 Jest 和 Protractor 吗?如果是,我是否需要配置任何东西才能在我的应用程序中使用它们。
您可以在应用程序中同时使用 jest 和 protractor。默认情况下,新的 angular cli 版本为您提供了一个用于单元测试的 karma runner 和一个用于在同一应用程序中进行端到端测试的量角器运行器。你只是在用 Jest 改变 Karma。
我可以开玩笑地运行量角器测试(端到端)吗?你不能。
我可以使用量角器运行单元测试吗?你不能。
我可以在同一个应用程序中为端到端测试运行量角器并为单元测试运行 jest 吗?是的你可以。你只需要告诉 jest 选择哪些文件,量角器也是如此。
我可以在单个文件或一次运行中获得这两个报告吗?你不能。您必须配置 jest runner 以打印与量角器报告不同的报告。
您可以同时使用 jest 和量角器,而无需进行任何特殊配置。这是 package.json 的一个片段,我用于使用量角器运行 e2e 测试,并使用 jest 进行灯塔测试。
{
"name": "performance-tests",
"version": "1.0.0",
"description": "Performance tests and end to end tests.",
"main": "jest.js",
"scripts": {
"debug": "node --inspect-brk ./node_modules/.bin/protractor protractor.conf.js",
"pretest": "npm run tsc && npm run webdriver-update",
"e2e": "npm run tsc && ./node_modules/protractor/bin/protractor protractor/compiled-js-files/protractor.conf.js",
"grid": "sh run-grid.sh && npm run e2e",
"tsc": "./node_modules/typescript/bin/tsc",
"webdriver-update": "./node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0 --chrome --versions.chrome=78.0.3904.97",
"lighthouse": "./node_modules/jest/bin/jest.js --verbose -t=lighthouse",
"lighthouse-reports": "./node_modules/jest/bin/jest.js --verbose -t=lighthouse && node ./lighthouse/db.js"
},
"repository": {
"type": "",
"url": ""
},
"author": "Sankalan Parajuli",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
"@types/jasmine": "^3.3.12",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^12.12.14",
"jasmine": "^3.3.1",
"lighthouse": "^4.0.0-beta",
"protractor": "5.4.2",
"protractor-beautiful-reporter": "^1.3.3"
},
"devDependencies": {
"@types/request": "^2.48.3",
"@types/selenium-webdriver": "^4.0.0",
"csvtojson": "^2.0.8",
"jest": "^23.4.1",
"moment": "^2.24.0",
"mongodb": "^3.1.13",
"puppeteer": "^1.6.0",
"request-promise": "^4.2.5",
"ts-node": "^8.5.2",
"typescript": "2.8.1"
}
}
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你。
| 归档时间: |
|
| 查看次数: |
2955 次 |
| 最近记录: |