0
Phantom的Runing karma測試很好,但在Chrome中不行。我在karma.config中更改的所有內容爲browsers: ['PhantomJS'],
至browsers: ['Chrome'],
。 如果我改變它,我有0測試執行和Test failed
。Karma測試適用於PhantomJs,但不適用於Chrome
這裏是我的karma.config.js
// Karma configuration
// Generated on Mon Jan 16 2017 13:32:24 GMT+0100 (Środkowoeuropejski czas stand.)
var webpackConfig = require('./webpack.config.js');
var webpack = require('webpack');
var path = require('path');
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon', 'fixture'],
files: [
'spec/**/*.spec.ts',
'spec/fixtures/**/*.html',
],
exclude: [],
webpack: {
module: webpackConfig.module,
resolve: webpackConfig.resolve,
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
Tether: 'tether',
"window.Tether": 'tether'
})
],
},
preprocessors: {
"spec/**/*.ts": ['webpack'],
'spec/**/*.html': ['html2js'],
'spec/**/*.json': ['json_fixtures']
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
// browsers: ['Chrome'],
browsers: ['PhantomJS'],
singleRun: true,
concurrency: Infinity
})
};
和包裝:
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/jquery": "^2.0.34",
"@types/karma-fixture": "^0.2.2",
"@types/mocha": "^2.2.37",
"@types/raty": "^2.7.26",
"@types/sinon": "^1.16.34",
"chai": "^3.5.0",
"css-loader": "^0.26.1",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0",
"karma": "^1.4.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^2.0.0",
"karma-fixture": "^0.2.6",
"karma-html2js-preprocessor": "^1.1.0",
"karma-json-fixtures-preprocessor": "0.0.6",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.1",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.5",
"karma-typescript": "^2.1.6",
"karma-typescript-preprocessor2": "^1.2.1",
"karma-webpack": "^2.0.1",
"less": "^2.7.2",
"mocha": "^3.2.0",
"node-sass": "^4.0.0",
"phantomjs-prebuilt": "^2.1.14",
"sass-loader": "^4.0.2",
"sinon": "^1.17.7",
"style-loader": "^0.13.1",
"ts-loader": "^1.2.2",
"typescript": "^2.0.10",
"url-loader": "^0.5.7",
"webpack": "^2.2.0-rc.6"
}