Commit 7d28235a by Will Daly

Added Karma configuration for running JS tests

parent e58391d8
...@@ -45,3 +45,6 @@ nosetests.xml ...@@ -45,3 +45,6 @@ nosetests.xml
# PyCharm # PyCharm
.idea .idea
# node
node_modules
npm-debug.log
...@@ -4,7 +4,12 @@ python: ...@@ -4,7 +4,12 @@ python:
install: install:
- "pip install -r requirements/test.txt --use-mirrors" - "pip install -r requirements/test.txt --use-mirrors"
- "pip install -e ." - "pip install -e ."
- "npm install"
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: script:
- "python manage.py test" - "python manage.py test"
- "python manage.py harvest" - "python manage.py harvest"
- "npm test"
- "python setup.py install" - "python setup.py install"
...@@ -15,6 +15,22 @@ for development purposes, run:: ...@@ -15,6 +15,22 @@ for development purposes, run::
The second line is necessary to register edx-tim's XBlock so that it will show The second line is necessary to register edx-tim's XBlock so that it will show
up in the XBlock workbench. up in the XBlock workbench.
Running Tests
=============
To run the Python test suite:
.. code:: bash
python manage.py test
To run the JavaScript test suite (after installing `node <http://nodejs.org/download/>`_)
.. code:: bash
npm install && npm test
License License
======= =======
......
/*
Dummy test to verify that Karma is working.
Replace this with a real test when we've written JS with non-trivial logic.
*/
describe("A suite", function() {
it("contains spec with an expectation", function() {
expect(true).toBe(true);
});
});
// base path, that will be used to resolve files and exclude
basePath = '.';
// list of files / patterns to load in the browser
files = [
JASMINE,
JASMINE_ADAPTER,
'./**/src/*.js',
'./**/spec/*.js'
];
// list of files to exclude
exclude = [
"karma.conf.js"
];
// use dots reporter, as travis terminal does not support escaping sequences
// possible values: 'dots', 'progress', 'junit', 'teamcity'
// CLI --reporters progress
reporters = ['progress'];
// web server port
// CLI --port 9876
port = 9876;
// cli runner port
// CLI --runner-port 9100
runnerPort = 9100;
// enable / disable colors in the output (reporters and logs)
// CLI --colors --no-colors
colors = true;
// level of logging
// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
// CLI --log-level debug
logLevel = LOG_INFO;
// enable / disable watching file and executing tests whenever any file changes
// CLI --auto-watch --no-auto-watch
autoWatch = true;
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
// CLI --browsers Chrome,Firefox,Safari
browsers = ["Firefox"];
// If browser does not capture in given timeout [ms], kill it
// CLI --capture-timeout 5000
captureTimeout = 5000;
// Auto run tests on start (when browsers are captured) and exit
// CLI --single-run --no-single-run
singleRun = true;
// report which specs are slower than 500ms
// CLI --report-slower-than 500
reportSlowerThan = 500;
{
"devDependencies": {"karma": "~0.8"},
"scripts": {"test": "./node_modules/.bin/karma start"}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment