Sono nuovo ai test automatici. Sto cercando di eseguire alcuni test all'interno del mio IDE, WebStorm. Sembra supportare jsTestDriver e Karma. A quanto ho capito, JsTestDriver non supporta nativamente RequireJS, che è necessario a these tests.Come ottenere Karma per eseguire questi file di test?
Karma, tuttavia, says it does. Ho creato un file di prova,
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'requirejs'],
files: [
{pattern: 'spec/*.spec.js', included: false},
],
reporters: ['progress'],
port: 9885,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['PhantomJS'],
captureTimeout: 10000,
singleRun: true
});
};
ma sembra solo per appendere dopo emette questo (che va dal terminale nodo):
C:\Users\Mark\Documents\GitHub\timezone-js>karma start
INFO [karma]: Karma v0.10.1 server started at http://localhost:9885/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.1 (Windows 8)]: Connected on socket id MYUP0uo-jk-3W8hB8trx
Se corro in un browser e controllare il JavaScript console, ottengo questo:
ReferenceError: require is not defined
http://localhost:9878/base/spec/date.spec.js
Line 1
Perché è lamenta "richiedere" se il Karma supporta e ho incluso come uno dei quadri ..?