I'm new to automated testing. I'm trying to run some tests inside my IDE, WebStorm. It seems to support jsTestDriver and Karma. As I understand it, JsTestDriver doesn't natively support RequireJS, which these tests need.
Karma, however, says it does. I've created a test file,
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
});
};
But it just seems to hang after it outputs this (running from node terminal):
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
If I run it in a browser and check the JavaScript console, I get this:
ReferenceError: require is not defined
http://localhost:9878/base/spec/date.spec.js
Line 1
Why is it complaining about "require" if Karma supports it and I included it as one of the frameworks..?
How to run a single test file from command line with Karma and JavaScript? To run a single test file from command line with Karma and JavaScript, we can run a few commands. to start the Karma test server. to run the test with the testDescriptionFilter text in the string that we call describe with to run those tests.
Check out the docs.
You are missing some test-main.js
file, where you configure Require.js and kick off the test run by requiring something (probably all of your tests).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With