- 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/
我在优化 JOIN 以使用复合索引时遇到问题。我的查询是: SELECT p1.id, p1.category_id, p1.tag_id, i.rating FROM products p1
我有一个简单的 SQL 查询,我正在尝试对其进行优化以删除“使用位置;使用临时;使用文件排序”。 这是表格: CREATE TABLE `special_offers` ( `so_id` int
我有一个具有以下结构的应用程序表 app_id VARCHAR(32) NOT NULL, dormant VARCHAR(6) NOT NULL, user_id INT(10) NOT NULL
此查询的正确索引是什么。 我尝试为此查询提供不同的索引组合,但它仍在使用临时文件、文件排序等。 总表数据 - 7,60,346 产品= '连衣裙' - 总行数 = 122 554 CREATE TAB
为什么额外的是“使用where;使用索引”而不是“使用索引”。 CREATE TABLE `pre_count` ( `count_id`
我有一个包含大量记录的数据库,当我使用以下 SQL 加载页面时,速度非常慢。 SELECT goal.title, max(updates.date_updated) as update_sort F
我想知道 Using index condition 和 Using where 之间的区别;使用索引。我认为这两种方法都使用索引来获取第一个结果记录集,并使用 WHERE 条件进行过滤。 Q1。有什
I am using TypeScript 5.2 version, I have following setup:我使用的是TypeScript 5.2版本,我有以下设置: { "
I am using TypeScript 5.2 version, I have following setup:我使用的是TypeScript 5.2版本,我有以下设置: { "
I am using TypeScript 5.2 version, I have following setup:我使用的是TypeScript 5.2版本,我有以下设置: { "
mysql Ver 14.14 Distrib 5.1.58,用于使用 readline 5.1 的 redhat-linux-gnu (x86_64) 我正在接手一个旧项目。我被要求加快速度。我通过
在过去 10 多年左右的时间里,我一直打开数据库 (mysql) 的连接并保持打开状态,直到应用程序关闭。所有查询都在连接上执行。 现在,当我在 Servicestack 网页上看到示例时,我总是看到
我使用 MySQL 为我的站点构建了一个自定义论坛。列表页面本质上是一个包含以下列的表格:主题、上次更新和# Replies。 数据库表有以下列: id name body date topic_id
在mysql中解释的额外字段中你可以得到: 使用索引 使用where;使用索引 两者有什么区别? 为了更好地解释我的问题,我将使用下表: CREATE TABLE `test` ( `id` bi
我经常看到人们在其Haxe代码中使用关键字using。它似乎在import语句之后。 例如,我发现这是一个代码片段: import haxe.macro.Context; import haxe.ma
这个问题在这里已经有了答案: "reduce" or "apply" using logical functions in Clojure (2 个答案) 关闭 8 年前。 “and”似乎是一个宏,
这个问题在这里已经有了答案: "reduce" or "apply" using logical functions in Clojure (2 个答案) 关闭 8 年前。 “and”似乎是一个宏,
我正在考虑在我的应用程序中使用注册表模式来存储指向某些应用程序窗口和 Pane 的弱指针。应用程序的一般结构如下所示。 该应用程序有一个 MainFrame 顶层窗口,其中有几个子 Pane 。可以有
奇怪的是:。似乎a是b或多或少被定义为id(A)==id(B)。用这种方式制造错误很容易:。有些名字出人意料地出现在Else块中。解决方法很简单,我们应该使用ext==‘.mp3’,但是如果ext表面
我遇到了一个我似乎无法解决的 MySQL 问题。为了能够快速执行用于报告目的的 GROUP BY 查询,我已经将几个表非规范化为以下内容(该表由其他表上的触发器维护,我已经同意了与此): DROP T
我是一名优秀的程序员,十分优秀!