- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Karma 设置自动化测试。虽然我遇到了问题。
npm start 或 npm install 给我这个错误:
> concurrently "npm run tsc:w" "npm run lite"
[0] /c: /c: is a directory
[1] /c: /c: is a directory
[0] npm run tsc:w exited with code 126
[1] npm run lite exited with code 126
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Ivar\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.5.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! angular-quickstart@1.0.0 start: `concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-quickstart@1.0.0 start script 'concurrently "npm run tsc:w" "npm run lite" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! concurrently "npm run tsc:w" "npm run lite"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
在他们给我之前:
> karma start karma.conf.js
29 09 2016 16:49:27.659:WARN [watcher]: Pattern "C:/Users/Ivar/documents/school/stage/workspace/webapplicatie/systemjs.config.extras.js" does not match any file.
29 09 2016 16:49:27.679:WARN [watcher]: Pattern "C:/Users/Ivar/documents/school/stage/workspace/webapplicatie/app/**/*.css" does not match any file.
29 09 2016 16:49:27.691:WARN [watcher]: Pattern "C:/Users/Ivar/documents/school/stage/workspace/webapplicatie/test/**/*.ts" does not match any file.
29 09 2016 16:49:27.692:WARN [watcher]: Pattern "C:/Users/Ivar/documents/school/stage/workspace/webapplicatie/test/**/*.js.map" does not match any file.
29 09 2016 16:49:28.158:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
29 09 2016 16:49:28.159:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
29 09 2016 16:49:28.166:INFO [launcher]: Starting browser PhantomJS
29 09 2016 16:49:29.956:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket /#GGY-X69uV6wlYJOnAAAA with id 60252055
29 09 2016 16:49:30.387:WARN [web-server]: 404: /base/node_modules/systemjs/dist/system-polyfills.js
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
TypeError: undefined is not a constructor (evaluating 'System.config')
at karma-test-shim.js:30
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
TypeError: undefined is not a constructor (evaluating 'System.config')
at karma-test-shim.js:30
npm ERR! Test failed. See above for more details.
而在 node_modules/systemjs/dist 中确实存在 sytem-polyfills.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
var testBase = 'test/'; // transpiled test JS and map files
var testSrcBase = 'test/'; // test source TS files
config.set({
basePath: '',
frameworks: ['jasmine'],
plugins: [
require('karma-jasmine'),
require('karma-phantomjs-launcher'),
require('karma-jasmine-html-reporter'), // click "Debug" in browser to see it
require('karma-htmlfile-reporter') // crashing w/ strange socket error
],
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',
// transpiled application & spec code paths loaded via module imports
{pattern: appBase + '**/*.js', included: false, watched: true},
{pattern: testBase + '**/*.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: testSrcBase + '**/*.ts', included: false, watched: false},
{pattern: testBase + '**/*.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: {},
// disabled HtmlReporter; suddenly crashing w/ strange socket error
reporters: ['progress', 'kjhtml'],//'html'],
// HtmlReporter configuration
htmlReporter: {
// Open this file to see results in browser
outputFile: '_test-output/tests.html',
// Optional
pageTitle: 'Unit Tests',
subPageTitle: __dirname
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
singleRun: false
})
}
karma 垫片
// #docregion
// /*global jasmine, __karma__, window*/
Error.stackTraceLimit = 0; // "No stacktrace"" is usually best for app testing.
// Uncomment to get full stacktrace output. Sometimes helpful, usually not.
// Error.stackTraceLimit = Infinity; //
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
var builtPath = '/base/app/';
__karma__.loaded = function () { };
function isJsFile(path) {
return path.slice(-3) == '.js';
}
function isSpecFile(path) {
return /\.spec\.(.*\.)?js$/.test(path);
}
function isBuiltFile(path) {
return isJsFile(path) && (path.substr(0, builtPath.length) == builtPath);
}
var allSpecFiles = Object.keys(window.__karma__.files)
.filter(isSpecFile)
.filter(isBuiltFile);
System.config({
baseURL: '/base',
// Extend usual application package list with test folder
packages: { 'testing': { main: 'index.js', defaultExtension: 'js' } },
// Assume npm: is set in `paths` in systemjs.config
// Map the angular testing umd bundles
map: {
'@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
'@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
'@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
'@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
'@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
'@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
'@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',
'@angular/forms/testing': 'npm:@angular/forms/bundles/forms-testing.umd.js',
},
});
System.import('systemjs.config.js')
.then(importSystemJsExtras)
.then(initTestBed)
.then(initTesting);
/** Optional SystemJS configuration extras. Keep going w/o it */
function importSystemJsExtras(){
return System.import('systemjs.config.extras.js')
.catch(function(reason) {
console.log(
'Warning: System.import could not load the optional "systemjs.config.extras.js". Did you omit it by accident? Continuing without it.'
);
console.log(reason);
});
}
function initTestBed(){
return Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
])
.then(function (providers) {
var coreTesting = providers[0];
var browserTesting = providers[1];
coreTesting.TestBed.initTestEnvironment(
browserTesting.BrowserDynamicTestingModule,
browserTesting.platformBrowserDynamicTesting());
})
}
// Import all spec files and start karma
function initTesting () {
console.log("init testing");
return Promise.all(
allSpecFiles.map(function (moduleName) {
console.log("module: "+moduleName);
return System.import(moduleName);
})
)
.then(__karma__.start, __karma__.error);
}
最后但并非最不重要包.json
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"docker-build": "docker build -t ng2-quickstart .",
"docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart",
"pree2e": "npm run webdriver:update",
"e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first",
"lint": "tslint ./app/**/*.ts -t verbose",
"lite": "lite-server",
"postinstall": "typings install",
"test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
"test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings",
"webdriver:update": "webdriver-manager update"
},
"license": "ISC",
"dependencies": {
"@angular/common": "~2.0.1",
"@angular/compiler": "~2.0.1",
"@angular/core": "~2.0.1",
"@angular/forms": "~2.0.1",
"@angular/http": "~2.0.1",
"@angular/platform-browser": "~2.0.1",
"@angular/platform-browser-dynamic": "~2.0.1",
"@angular/router": "~3.0.1",
"@angular/upgrade": "~2.0.1",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25",
"angular2-in-memory-web-api": "0.0.20",
"bootstrap": "^3.3.7"
},
"devDependencies": {
"concurrently": "^3.0.0",
"lite-server":"~2.2.2",
"canonical-path": "0.0.2",
"http-server": "^0.9.0",
"tslint": "^3.15.1",
"lodash": "^4.16.2",
"jasmine-core": "~2.5.2",
"karma": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-cli": "^1.0.1",
"karma-htmlfile-reporter": "^0.3.4",
"karma-jasmine": "^1.0.2",
"karma-spec-reporter": "0.0.13",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^3.3.0",
"rimraf": "^2.5.4",
"phantomjs-prebuilt": "^2.1.7",
"typescript": "^2.0.3",
"typings": "^1.4.0"
}
}
抱歉代码量太大,但我自己似乎找不到问题。
编辑:它在本地工作,在服务器上我得到这个错误:
angular-quickstart@1.0.0 test-once /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1
build 03-Oct-2016 09:03:17 > tsc && karma start karma.conf.js --single-run
build 03-Oct-2016 09:03:17
build 03-Oct-2016 09:03:37 [33m03 10 2016 09:03:37.209:WARN [watcher]: [39mPattern "/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/systemjs.config.extras.js" does not match any file.
build 03-Oct-2016 09:03:37 [33m03 10 2016 09:03:37.229:WARN [watcher]: [39mPattern "/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/app/**/*.css" does not match any file.
build 03-Oct-2016 09:03:37 [33m03 10 2016 09:03:37.241:WARN [watcher]: [39mPattern "/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/test/**/*.ts" does not match any file.
build 03-Oct-2016 09:03:37 [33m03 10 2016 09:03:37.242:WARN [watcher]: [39mPattern "/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/test/**/*.js.map" does not match any file.
build 03-Oct-2016 09:03:40 [32m03 10 2016 09:03:40.938:INFO [karma]: [39mKarma v1.3.0 server started at http://localhost:9876/
build 03-Oct-2016 09:03:40 [32m03 10 2016 09:03:40.939:INFO [launcher]: [39mLaunching browser PhantomJS with unlimited concurrency
build 03-Oct-2016 09:03:40 [32m03 10 2016 09:03:40.973:INFO [launcher]: [39mStarting browser PhantomJS
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.068:ERROR [phantomjs.launcher]: [39m/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libz.so.1: no version information available (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.069:ERROR [phantomjs.launcher]: [39m/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.081:ERROR [launcher]: [39mCannot start PhantomJS
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.086:ERROR [phantomjs.launcher]: [39m/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.9' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.10' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.7' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [32m03 10 2016 09:03:41.090:INFO [launcher]: [39mTrying to start PhantomJS again (1/2).
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.103:ERROR [phantomjs.launcher]: [39m/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libz.so.1: no version information available (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.9' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.10' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.7' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.104:ERROR [launcher]: [39mCannot start PhantomJS
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [32m03 10 2016 09:03:41.106:INFO [launcher]: [39mTrying to start PhantomJS again (2/2).
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.112:ERROR [phantomjs.launcher]: [39m/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libz.so.1: no version information available (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.112:ERROR [launcher]: [39mCannot start PhantomJS
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.113:ERROR [phantomjs.launcher]: [39m/opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.9' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.10' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41 /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib/libc.so.6: version `GLIBC_2.7' not found (required by /opt/bamboo-agent-home/xml-data/build-dir/MCAE-MA-JOB1/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)
build 03-Oct-2016 09:03:41
build 03-Oct-2016 09:03:41 [31m03 10 2016 09:03:41.114:ERROR [launcher]: [39mPhantomJS failed 2 times (cannot start). Giving up.
error 03-Oct-2016 09:03:41
error 03-Oct-2016 09:03:41 npm ERR! Linux 2.6.18-92.1.22.el5
error 03-Oct-2016 09:03:41 npm ERR! argv "/opt/node-v0.12.7-linux-x86/bin/node" "/opt/node-v0.12.7-linux-x86/bin/npm" "run" "test-once"
error 03-Oct-2016 09:03:41 npm ERR! node v0.12.7
error 03-Oct-2016 09:03:41 npm ERR! npm v3.10.8
error 03-Oct-2016 09:03:41 npm ERR! code ELIFECYCLE
error 03-Oct-2016 09:03:41 npm ERR! angular-quickstart@1.0.0 test-once: `tsc && karma start karma.conf.js --single-run`
error 03-Oct-2016 09:03:41 npm ERR! Exit status 1
error 03-Oct-2016 09:03:41 npm ERR!
error 03-Oct-2016 09:03:41 npm ERR! Failed at the angular-quickstart@1.0.0 test-once script 'tsc && karma start karma.conf.js --single-run'.
error 03-Oct-2016 09:03:41 npm ERR! Make sure you have the latest version of node.js and npm installed.
error 03-Oct-2016 09:03:41 npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
error 03-Oct-2016 09:03:41 npm ERR! not with npm itself.
error 03-Oct-2016 09:03:41 npm ERR! Tell the author that this fails on your system:
error 03-Oct-2016 09:03:41 npm ERR! tsc && karma start karma.conf.js --single-run
error 03-Oct-2016 09:03:41 npm ERR! You can get information on how to open an issue for this project with:
error 03-Oct-2016 09:03:41 npm ERR! npm bugs angular-quickstart
error 03-Oct-2016 09:03:41 npm ERR! Or if that isn't available, you can get their info via:
error 03-Oct-2016 09:03:41 npm ERR! npm owner ls angular-quickstart
error 03-Oct-2016 09:03:41 npm ERR! There is likely additional logging output above.
最佳答案
您的 Karma 错误源于其上方的 404。 Karma 不提供 system-polyfills.js
文件。您需要将它或更可能的 system-polyfills.src.js
添加到 system.src.js
上方的文件部分。如果你还没有创建 systemjs.config.extras.js
之后你会得到另一个不太严重的错误。如果您没有,只需创建一个具有该名称的空文件即可。
如果 npm start
和 npm test
仍然失败,请使用 npm install
的输出更新您的问题,我会更新这个回答。
关于unit-testing - Karma - 使用 PhantomJS 而不是 Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39774049/
当运行测试 karma 似乎多次重复上一个测试时,重复测试的次数似乎取决于测试的数量和用于运行的浏览器。 如果只使用一个浏览器(PhantomJS 或 Chrome)进行一次测试,测试会显示两次,当使
我已经配置了我的 karma.conf.js 并启用了预处理,以获得有关我的测试代码覆盖率的报告。我已将此行添加到 preprocessors 部分。 preprocessors: { 'publ
我的 karma.conf.js 包括: plugins: [ 'karma-jasmine', 'karma-phantomjs-launcher', 'karma-ng-h
我刚刚开始使用 karma 对我的 Angular 应用程序进行单元测试。一切都按预期进行 Chrome 26.0 (Windows): Executed 1 of 1 Chrome 26.0 (Wi
我正在查看 karma 的报告器配置。 有一些可能的报告者:进展、点、咆哮、报道。我没有找到任何解释每个选项的详细信息。 我尝试了进度和点,它们都将日志打印到控制台,结果看起来相同。它们之间有什么区别
我使用 karma 来运行测试。我有很多测试,运行所有测试是一个非常缓慢的过程。我只想运行一个测试,以便花费更少的时间,因为所有测试都运行大约 10 分钟。 可能吗? 最佳答案 如果您使用Karma/
我还没有看到这方面的任何信息,但我想知道是否可以在一次 Karma 运行中包含多个 karma-conf.js 文件?基本上,我正在考虑为 CI 配置一个覆盖率和 tslint,以及一个只为本地开发测
我正在使用 karma 和 karma-typescript(但这不是 Angular 项目,所以我没有使用 angular-cli)。 我的测试运行中大约有一半在所有测试都通过后 生成错误,我对如何
我正在使用 Karma 进行一些单元测试并生成代码覆盖率统计信息。 当我在 karma 配置中没有代码覆盖设置的情况下从命令行运行测试时,我可以在命令行中看到测试结果。 IE Executed 3 o
我是自动化测试的新手。我正在尝试在我的 IDE WebStorm 中运行一些测试。它似乎支持 jsTestDriver 和 Karma。据我了解,JsTestDriver 本身并不支持 Require
Karma 与 Notepad++ 完美配合。当我使用 Visual Studio 作为我的文本编辑器时,它会在我保存文件后删除它应该查看的文件。这是 Karma 显示错误的输出: This是作为解决
我将 Webpack 用于应用程序和测试(使用 https://github.com/webpack/karma-webpack)。该应用程序在 typescript 中,在 Babel 中进行测试。
我正在测试的组件在 it() 测试中对 dom 进行了一些更改,但是它在下一个 it() 测试中仍然存在,这破坏了我的测试。有没有办法在每个 it() 测试中重置 DOM? 最佳答案 对于没有 JQU
我正在尝试使用以下命令安装 Karma: C:\Program Files\nodejs>npm install karma 但是,当我尝试在 Windows 8.1 计算机上安装 Karma 时收到
我是 Karma 的新手。当我运行时: karma start myconfigfile.js Karma 正在使用 chrome 启动,但它在 karma 启动时挂起,没有更多的事情发生。但是我可以
我是第一次尝试 Karma,几个小时后我仍然无法让它工作。 当我通过键入 karma start karma.conf.js 运行测试时在终端中,浏览器窗口将打开并显示以下内容(我也尝试过使用 Chr
当我在 WebStorms 终端中输入“karma start”时,它会打开 Chrome,我可以开始测试,当我进行一些更改时,它会重新运行测试。但是,当我键入 Karma start 或单击 un
每次我开始使用 karma 进行测试时,都会打开一个新的浏览器实例(在我的例子中是 Firefox)。 这很烦人,因为它会弹出其他窗口(我使用的是 Windows 8)。 是否有任何 karma 配置
我已经正确设置了 karma 配置,配置文件,在后台运行,非常好。我更改并保存文件后,它将重新运行测试...。所有750个单元测试。我希望能够只运行几个。缺少手动修改配置文件或注释掉许多文件中数百个测
有没有办法从 karma 覆盖率运行器的代码覆盖率报告中排除文件 https://github.com/karma-runner/karma-coverage ? 最佳答案 您可以在此处使用多种技术:
我是一名优秀的程序员,十分优秀!