- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试在运行 angular2 测试时使用 @angular/platform-browser/testing/browser_util
。Angular2核心版本是2.3.0。我收到以下 404 错误:
[1] {
[1] "__zone_symbol__error": {
[1] "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js"
[1] },
[1] "stack": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "name": "Error",
[1] "message": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__stack": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "originalErr": {
[1] "__zone_symbol__error": {
[1] "originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util"
[1] },
[1] "stack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "name": "Error",
[1] "message": "XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__stack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__message": "XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__name": "Error",
[1] "__zone_symbol__originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util"
[1] },
[1] "__zone_symbol__name": "Error",
[1] "__zone_symbol__message": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js"
[1] }
[1]
[1] Chrome 55.0.2883 (Linux 0.0.0) ERROR
[1] {
[1] "__zone_symbol__error": {
[1] "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js"
[1] },
[1] "stack": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "name": "Error",
[1] "message": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__stack": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "originalErr": {
[1] "__zone_symbol__error": {
[1] "originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util"
[1] },
[1] "stack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "name": "Error",
[1] "message": "XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__stack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__message": "XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__name": "Error",
[1] "__zone_symbol__originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util"
[1] },
[1] "__zone_symbol__name": "Error",
[1] "__zone_symbol__message": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js"
[1] }
[1]
[1] 27 01 2017 17:21:08.936:WARN [web-server]: 404: /base/node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util
[1] Chrome 55.0.2883 (Linux 0.0.0) ERROR
[1] {
[1] "__zone_symbol__error": {
[1] "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js"
[1] },
[1] "stack": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "name": "Error",
[1] "message": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "zoneAwareStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__stack": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "originalErr": {
[1] "__zone_symbol__error": {
[1] "originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util"
[1] },
[1] "stack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "name": "Error",
[1] "message": "XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__stack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__message": "XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__name": "Error",
[1] "__zone_symbol__originalStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util",
[1] "__zone_symbol__zoneAwareStack": "Error: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util"
[1] },
[1] "__zone_symbol__name": "Error",
[1] "__zone_symbol__message": "(SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js",
[1] "__zone_symbol__originalStack": "Error: (SystemJS) XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError: XHR error (404 Not Found) loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util\n\tError loading node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util as \"@angular/platform-browser/testing/browser_util\" from app/components/gamestart/gamestart.component.spec.js"
我在这里错过了什么?
更新这是 Karma 配置:
module.exports = function(config) {
var appBase = 'app/'; // transpiled app JS and map files
var appSrcBase = 'app/'; // app source TS files
var appAssets = 'base/app/'; // component assets fetched by Angular's compiler
// Testing helpers (optional) are conventionally in a folder called `testing`
var testingBase = 'testing/'; // transpiled test JS and map files
var testingSrcBase = 'testing/'; // test source TS files
config.set({
basePath: '',
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter')
],
client: {
builtPaths: [appBase, testingBase], // add more spec base paths as needed
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
customLaunchers: {
// From the CLI. Not used here but interesting
// chrome setup for travis CI using chromium
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
files: [
// System.js for module loading
'node_modules/systemjs/dist/system.src.js',
// Polyfills
'node_modules/core-js/client/shim.js',
'node_modules/reflect-metadata/Reflect.js',
// zone.js
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/zone.js/dist/proxy.js',
'node_modules/zone.js/dist/sync-test.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/zone.js/dist/async-test.js',
'node_modules/zone.js/dist/fake-async-test.js',
// RxJs
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false },
{ pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false },
// Paths loaded via module imports:
// Angular itself
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: false },
{ pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false },
{ pattern: 'systemjs.config.js', included: false, watched: false },
{ pattern: 'systemjs.config.extras.js', included: false, watched: false },
'karma-test-shim.js', // optionally extend SystemJS mapping e.g., with barrels
// transpiled application & spec code paths loaded via module imports
{ pattern: appBase + '**/*.js', included: false, watched: true },
{ pattern: testingBase + '**/*.js', included: false, watched: true },
// Asset (HTML & CSS) paths loaded via Angular's component compiler
// (these paths need to be rewritten, see proxies section)
{ pattern: appBase + '**/*.html', included: false, watched: true },
{ pattern: appBase + '**/*.css', included: false, watched: true },
// Paths for debugging with source maps in dev tools
{ pattern: appSrcBase + '**/*.ts', included: false, watched: false },
{ pattern: appBase + '**/*.js.map', included: false, watched: false },
{ pattern: testingSrcBase + '**/*.ts', included: false, watched: false },
{ pattern: testingBase + '**/*.js.map', included: false, watched: false}
],
// Proxied base paths for loading assets
proxies: {
// required for component assets fetched by Angular's compiler
"/app/": appAssets
},
exclude: [],
preprocessors: {},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
})
}
Jasmine 包.json:
{
"name": "@types/jasmine",
"version": "2.5.38",
"description": "TypeScript definitions for Jasmine 2.5",
"license": "MIT",
"author": "Boris Yankov <https://github.com/borisyankov/>, Theodore Brown <https://github.com/theodorejb>, David Pärsson <https://github.com/davidparsson/>",
"main": "",
"repository": {
"type": "git",
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
},
"scripts": {},
"dependencies": {},
"peerDependencies": {},
"typings": "index.d.ts",
"typesPublisherContentHash": "deae5b77cefabcb3a692eff958b0cfe55516a87b535b4247349dbe4fc5f835f6",
"_id": "@types/jasmine@2.5.38",
"dist": {
"shasum": "a4379124c4921d4e21de54ec74669c9e9b356717",
"tarball": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.5.38.tgz"
},
"maintainers": [
{
"name": "types",
"email": "ryan.cavanaugh@microsoft.com"
}
],
"_npmUser": {
"name": "types",
"email": "ts-npm-types@microsoft.com"
},
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/jasmine-2.5.38.tgz_1479152172228_0.4748733174055815"
},
"directories": {},
"_shasum": "a4379124c4921d4e21de54ec74669c9e9b356717",
"_resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.5.38.tgz",
"_from": "@types/jasmine@>=2.5.36 <3.0.0"
}
系统.config.js:
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);
最佳答案
您的问题是如何在 system.config.js 中配置测试包
这个:
@angular/platform-browser/bundles/platform-browser-testing.umd.js/browser_util
意味着它正在寻找“platform-browser-testing.umd.js”下的 browser_util,这是一个文件,而不是一个目录。
你的 system.config.js 应该为这个包配置:
@angular/platform-browser/bundles/platform-browser-testing.
更新 1:
这是您正确配置的 System.config.js。不同的是,当它不需要捆绑时,它使用单独的文件。特别是这些行:
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/' + pkgName] = {main: 'index.js', defaultExtension: 'js'};
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/' + pkgName + '/bundles/'] = {main: pkgName + '.umd.js', defaultExtension: 'js'};
};
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
整个文件:
(function (global) {
// map tells the System loader where to look for things
var map = {
'app': 'app',
'@angular': 'node_modules/@angular',
'@angular/common': 'node_modules/@angular/common',
'@angular/compiler': 'node_modules/@angular/compiler',
'@angular/platform-browser': 'node_modules/@angular/platform-browser',
'@angular/platform-browser-dynamic': 'node_modules/@angular/platform-browser-dynamic',
'@angular/http': 'node_modules/@angular/http',
'@angular/router': 'node_modules/@angular/router',
'@angular/forms': 'node_modules/@angular/forms',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': {main: 'main.js', defaultExtension: 'js'},
'rxjs': {defaultExtension: 'js'},
'angular2-in-memory-web-api': {main: 'index.js', defaultExtension: 'js'},
};
var ngPackageNames = [
'common',
'compiler',
'core',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade'
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/' + pkgName] = {main: 'index.js', defaultExtension: 'js'};
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/' + pkgName + '/bundles/'] = {main: pkgName + '.umd.js', defaultExtension: 'js'};
};
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
map: map,
packages: packages,
meta: meta
};
System.config(config);
})
(this);
更新 2:
bundle 是从包中所有组合的 JavaScript 文件创建的 JavaScript。如果您查看“node_modules\@angular\platform-browser\bundles”目录,您仍然会看到以“.umd”结尾的文件,如“platform-browser.umd.js”。这些文件通常在您构建生产应用程序时使用。但是(出于我不知道的原因),Karma 无法使用捆绑文件,需要单独的文件,如“node_modules\@angular\platform-browser\testing\browser_util.js”中所示。
我不知道。我看到每个人都在使用它,但是当我在控制台上输出它时,它是未定义的。找了之后,连SystemJS库的源码都找不到。我必须在这里发布一个问题,看看是否每个人都知道,或者它是否只是被复制/粘贴而没有人问为什么。
与此同时,我查看了官方 Angular 启动器的 Karma 配置,发现他们为 Karma 单独配置了 SystemJS,并单独导入了测试模块。我建议你看看那个并做同样的事情。 https://github.com/angular/quickstart/blob/master/karma-test-shim.js
想法是将变量“setPackageConfig”设置为“packIndex”或“packUmd”函数,并将其用作从 bundle 或单个文件构建包的回调。
我将其留作引用,但请查看 https://github.com/angular/quickstart/blob/master/karma-test-shim.js 中的 karma 配置并忽略之前的 systemjs 配置。
关于Angular2 测试 : Error when trying to use: @angular/platform-browser/testing/browser_util (Karma configurations),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41897444/
我使用 apt-get install libgtest-dev 安装了 gtest 我正在尝试检查它是否有效。 所以我在 eclipse 中编写了简单的测试代码。 但是有错误, undefined
($test) = (@test); $test = @test; 用一个括号括住变量,它访问数组的第一个元素。我找不到有关数组括号的信息。 最佳答案 ($test) = (@test); 这会将@t
在 clojure.test 中有一个允许同时测试多个设备的宏: are . 在 clojure.test 中,可以结合 are宏与 testing ? IE。就像是: (are [scenario
通常,Rust 中的单元测试被赋予一个单独的模块,该模块使用 #[cfg(test)] 进行条件编译: #[cfg(test)] mod tests { #[test] fn test
在过去,编程很少涉及猜测。我会写几行代码,一眼就能 100% 确定代码做什么和不做什么。错误主要是拼写错误,但与功能无关。 我相信在过去的几年中存在这种“试错”编程的趋势:编写代码(就像在草稿中一样)
在building the Kotlin compiler之后(在提交e80a01a处): ./gradlew dist 测试未成功通过: ./gradlew compiler:test 由于很少有测
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 9 年前。 Improve this qu
最近一直在思考模糊测试和猴子测试的区别。根据 wiki,猴子测试似乎“只是”一个单元测试,而模糊测试则不是。安卓有 UI/Application Exerciser monkey而且它看起来不像是单元
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
现在我正在使用 CMake 设置一个 C++ 测试环境。其实我已经意识到我想做什么,但我对两种不同的测试输出风格感到困惑。在我下面的示例中,“make test”实际上做了什么?我认为“make te
在 VS2012 中运行单个测试时,测试资源管理器底部会显示一个窗口,其中包括(假设失败)旁边带有“测试失败”的红色图标。紧随其后的是带有“已用时间”的失败消息。 我想简单地知道是否有办法清除这个窗口
bash 是否可以从 shell 执行命令,如果它返回某个值(或空值)则执行命令? if [ "echo test" == "test"]; then echo "echo test output
这个问题在这里已经有了答案: 8年前关闭。 Possible Duplicate: What is a smoke testing and what will it do for me? 为什么“冒烟
x86 下的并行编程可能很困难,尤其是在多核 CPU 下。假设我们有多核 x86 CPU 和更多不同的多线程通信组合。 单一作者和单一读者 单个读者多个作者 多个读者和单个作者 多个读者和多个作者 那
我使用Ctest来运行一堆使用add_test()注册的Google测试。当前,这些测试没有任何参数。但是,我想在运行--gtest_output=xml时为它们提供所有参数(所有参数都通用,特别是c
我有下表和数据: CREATE TABLE `test` ( `id` int(11) NOT NULL auto_increment, `name` varchar(8) NOT NULL,
go test 的两个标志 -parallel 和 -test.parallel 之间的区别以及哪个标志优先? -parallel n Allow parallel execu
在我的组件 AudioPlayer 中,我有一个 download() 方法: download() { this.audio.pause(); window.open(this.file,
您必须承认,对于 Rails 和数据库的新手来说,rubyonrails.org 上的官方解释使所有这四个任务听起来完全一样。引用: rake db:test:clone Recreate the
我过去曾讨论过这个话题,我想我可能知道答案,但我无法正确地表达出来。 这是我认为我所知道的: 如果您在编写测试之前已经有了关于事情如何工作的想法,那么我怀疑您是测试优先而不是测试驱动,因此您首先编写测
我是一名优秀的程序员,十分优秀!