gpt4 book ai didi

unit-testing - 如何在 Angular2 rc5 中导入 jasmine 测试函数

转载 作者:搜寻专家 更新时间:2023-10-30 21:20:16 25 4
gpt4 key购买 nike

我正在开发一个新项目,刚刚从 Angular 2 的 rc4 升级到 rc5。升级后,它、expect、describe 等函数似乎不再从“@angular/core/testing”导出。我搜索了我能想到的所有资源,我看到在线编写的单元测试声称使用仍然具有这些 Jasmine 测试功能的 rc5。你在哪里使用 rc5 导入这些?是否缺少新的依赖库?

包.json

"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@angular/router": "3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.5",
"@angular2-material/card": "^2.0.0-alpha.4",
"@angular2-material/checkbox": "^2.0.0-alpha.4",
"@angular2-material/core": "^2.0.0-alpha.4",
"@angular2-material/sidenav": "^2.0.0-alpha.4",
"@angular2-material/toolbar": "^2.0.0-alpha.4",
"bootstrap": "twbs/bootstrap#v4-dev",
"es6-shim": "^0.35.0",
"font-awesome": "^4.6.3",
"fullcalendar": "^2.7.3",
"jquery": "^2.2.4",
"jquery-datetimepicker": "^2.5.4",
"jquery-ui": "^1.10.5",
"material-icons": "^0.1.0",
"moment": "^2.13.0",
"ng2-bootstrap": "^1.0.22",
"primeng": "^1.0.0-beta.8",
"primeui": "^4.1.12",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"sweetalert": "^1.1.3",
"systemjs": "0.19.26",
"zone.js": "^0.6.12"
},
"devDependencies": {
"angular-cli": "^1.0.0-beta.0",
"clang-format": "^1.0.35",
"codelyzer": "0.0.14",
"ember-cli-inject-live-reload": "^1.4.0",
"jasmine-core": "^2.4.1",
"jasmine-spec-reporter": "^2.4.0",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.3",
"karma-jasmine": "^0.3.8",
"protractor": "^3.3.0",
"ts-node": "^0.5.5",
"tslint": "^3.6.0",
"typescript": "^1.8.10",
"typings": "^0.8.1"
}

最佳答案

从 RC4 开始,它们不再需要从任何地方导入。它们在全局范围内可供任何测试模块使用。

Importing Jasmine functions from @angular/core/testing is no longer necessary and is now deprecated.

另请参阅 Breaking Changes section of the RC4 Changelog 的最后一个要点.

关于unit-testing - 如何在 Angular2 rc5 中导入 jasmine 测试函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38979397/

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