मैं एक बुनियादी AngularJS ऐप है और घूंट कार्यों के साथ मेरे सभी टर्मिनल कमांड रन करना चाहते हैं विकास सर्वर के लिए $ gulp dev
और $ gulp unitTest
जैसे परीक्षण आदिघूंट और कर्म, फ़ाइल karma.conf.js मौजूद नहीं है
के लिए मैंने प्रोजेक्ट फ़ाइल की रूट में gulpfile.js
के साथ $ npm install --save-dev gulp
का उपयोग करके डॉक्स के अनुसार गुलप स्थापित किया है। मैंने कर्म की स्थापना और कॉन्फ़िगरेशन फ़ाइल के लिए भी ऐसा ही किया है।
अब यह बताते हुए कि मैं सभी NPM आसानी से कार्यालय और सर्वर के आसपास परियोजना के लिए कदम के लिए --save
के साथ टैग इंस्टॉल चाहते लायक है।
जब गुलप को कार्य जोड़ने की बात आती है तो मुझे कॉन्फ़िगरेशन खोजने के लिए configFile
विकल्प के लिए एक रिश्तेदार (कर्मा मॉड्यूल) पथ है, लेकिन फिर यह परीक्षण नहीं मिलता है।
निम्नलिखित gulpfile.js त्रुटि पैदा करता ERROR [config]: File karma.conf.js does not exist!
var gulp = require('gulp'),
// ....
karma = require('karma').Server;
gulp.task('test', function(done) {
var karmaServerOptions = {
configFile: 'karma.conf.js', // works if relative path from ./node_modules/karma/lib/config.js
singleRun: true
};
karma.start(
karmaServerOptions,
function(exitStatus) {
done(exitStatus ? 'There are failing tests' : undefined);
}
);
});
karma.conf.js:
// Karma configuration
// Generated on Thu Aug 06 2015 13:38:12 GMT+0100 (BST)
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: ['jasmine'],
// list of files/patterns to load in the browser
files: [
// '**/*js',
'node_modules/angular/angular.js',
'app/**/*.js',
// 'unitTests/**/*Spec.js',
// 'unitTests/**/*spec.js'
'unitTests/**/*.js'
],
// list of files to exclude
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// 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: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
})
}
ध्यान दें: के रूप में यह अभी भी कुछ है फ़ाइलों सरणी एक मेस का एक सा है, लेकिन सभी में, मेरे प्रयोगों में से नहीं।