From efb1577acba209f3f693a54eaf208f8f370d098b Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Tue, 21 Apr 2015 14:41:06 -0400 Subject: [PATCH] Fork off Karma file for in-browser debug --- DEVELOP.md | 4 ++-- auto_tests/chrome.karma.conf.js | 27 +++++++++++++++++++++++++++ auto_tests/karma.conf.js | 3 ++- package.json | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 auto_tests/chrome.karma.conf.js diff --git a/DEVELOP.md b/DEVELOP.md index 71bf785..8ddf024 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -16,9 +16,9 @@ To run the tests, run: To iterate on the code, open `tests/demo.html` (or one of the other demos) in your browser. -To iterate on a unit test, change `it` to `it.only` in the Mocha test, change the browser from `PhantomJS` to `Chrome` (or whatever you like) and set `singleRun` to `false` in `auto_tests/karma.conf.js`. Then run +To iterate on a unit test, change `it` to `it.only` in the Mocha test. Then run - ./node_modules/karma/bin/karma start auto_tests/karma.conf.js + ./node_modules/karma/bin/karma start auto_tests/chrome.karma.conf.js and hit "DEBUG" in the Karma UI. diff --git a/auto_tests/chrome.karma.conf.js b/auto_tests/chrome.karma.conf.js new file mode 100644 index 0000000..9cd6039 --- /dev/null +++ b/auto_tests/chrome.karma.conf.js @@ -0,0 +1,27 @@ +module.exports = function (config) { + config.set({ + basePath: '../', + frameworks: [ + 'mocha', + 'chai' + ], + files: [ + 'dist/dygraph-combined-dev.js', + 'src/extras/smooth-plotter.js', + 'auto_tests/data/*.js', + 'auto_tests/tests/*.js', + ], + autoWatch: true, + singleRun: false, + reporters: ['mocha'], // or 'dots', 'mocha', 'spec' + browsers: ['Chrome'], // or 'Firefox', 'Safari', etc. + plugins: [ + 'karma-mocha', + 'karma-chai-plugins', + 'karma-chrome-launcher', + 'karma-firefox-launcher', + 'karma-spec-reporter', + 'karma-mocha-reporter' + ] + }); +}; diff --git a/auto_tests/karma.conf.js b/auto_tests/karma.conf.js index 591643c..606c571 100644 --- a/auto_tests/karma.conf.js +++ b/auto_tests/karma.conf.js @@ -8,7 +8,8 @@ module.exports = function (config) { files: [ 'dist/dygraph-combined-dev.js', 'src/extras/smooth-plotter.js', - 'auto_tests/**/*.js', + 'auto_tests/data/*.js', + 'auto_tests/tests/*.js', ], autoWatch: false, singleRun: true, diff --git a/package.json b/package.json index e8d7388..cbe5638 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "karma-chai-plugins": "^0.2.4", "karma-chrome-launcher": "^0.1.7", "karma-coverage": "^0.2.7", + "karma-firefox-launcher": "^0.1.4", "karma-mocha": "^0.1.10", "karma-mocha-reporter": "^1.0.2", "karma-phantomjs-launcher": "^0.1.4", -- 2.7.4