Karma を使用した NW.js アプリのテストで問題が発生しています。以前は機能していたテストが、更新後に機能しなくなりました??? (どの更新プログラムが私を殺したのかわかりません)
START:
13 07 2016 08:33:30.517:INFO [karma]: Karma v1.1.1 server started at http://localhost:9876/
13 07 2016 08:33:30.519:INFO [launcher]: Launching browser NodeWebkitTest with unlimited concurrency
13 07 2016 08:33:30.531:INFO [launcher]: Starting browser node-webkit
13 07 2016 08:33:36.221:INFO [Chrome 41.0.2272 (Windows 7 0.0.0)]: Connected on socket /#6fJGXLlwDNlOGXukAAAA with id 21855637
Chrome 41.0.2272 (Windows 7 0.0.0) ERROR
Uncaught TypeError: Cannot read property 'setup' of undefined
at C:/Users/ethomps2/IdeaProjects/evidentia3/node_modules/karma-mocha/lib/adapter.js:209
Finished in 0.331 secs / 0 secs
アダプターが失敗しているポイントで、アダプターは を探していwindow.mocha
ます。
ここに私のカルマ設定があります:
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai', 'sinon'],
'plugins': [
'karma-nodewebkit-launcher',
'karma-mocha',
'karma-chai',
'karma-sinon',
'karma-coverage',
'karma-mocha-reporter'
],
// list of files / patterns to load in the browser
files: [
<my code including test files>
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'../build/js/controllers/*.js': ['coverage'],
'../build/js/services/*.js': ['coverage'],
'../build/js/filters/*.js': ['coverage'],
'../build/js/directives/*.js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha', 'coverage'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['NodeWebkitTest'],
customLaunchers: {
'NodeWebkitTest': {
base: 'NodeWebkit',
paths: ['node_modules'],
options: {
"name": "Evidentia",
"main": "index.html",
"description": "Evidence management software for your genealogy research",
"version": "3.0.0",
"ver": "300",
"webkit": {
"page-cache": false
},
"window": {
"title": "Evidentia",
"icon": "img/Evidentia128x128.png",
"toolbar": true,
"frame": true,
"width": 1100,
"height": 700,
"show": false
}
}
}
},
// optionally, configure the reporter
coverageReporter: {
type: 'html',
dir: '../coverage/',
instrumenterOptions: {
istanbul: {noCompact: true}
}
},
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
})
};
ご覧のとおり、ブラウザーとして karma-nodewebkit-launcher を使用しています。私の理解では、nwjs グローバルがウィンドウにリンクされました。