Skip to content

Commit

Permalink
provide alternate vendor files in different karma configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
makeusabrew committed Aug 28, 2013
1 parent 13abd6a commit 9e7cec1
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 40 deletions.
88 changes: 49 additions & 39 deletions karma-base.conf.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
module.exports = function(config) {

return config.set({
basePath: "",
frameworks: ["mocha", "chai"],
files: [
"node_modules/sinon/lib/sinon.js",
"node_modules/sinon/lib/sinon/spy.js",
"node_modules/sinon/lib/sinon/stub.js",
"node_modules/sinon-chai/lib/sinon-chai.js",
"tests/vendor/jquery-1.8.3.min.js",
"tests/vendor/bootstrap-3.0.0.min.js",
"bootbox.js",
"tests/**/*.test.coffee",
"tests/**/*.test.js"
],
exclude: [],
preprocessors: {
"**/*.coffee": ["coffee"],
"bootbox.js": ["coverage"]
},
reporters: ["dots", "coverage", "junit"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ["PhantomJS"],
captureTimeout: 60000,
singleRun: false,

coverageReporter: {
type: "cobertura",
dir: "tests/coverage"
},

junitReporter: {
outputFile: "tests/reports/results.xml"
}
});
module.exports = function(params) {

"use strict";

console.log("Vendor files: " + params.vendor.join(", "));

return function(config) {

return config.set({
basePath: "",
frameworks: ["mocha", "chai"],
files: Array.prototype.concat([
"node_modules/sinon/lib/sinon.js",
"node_modules/sinon/lib/sinon/spy.js",
"node_modules/sinon/lib/sinon/stub.js",
"node_modules/sinon-chai/lib/sinon-chai.js"],

params.vendor,

params.src || "bootbox.js",

["tests/**/*.test.coffee",
"tests/**/*.test.js"]
),
exclude: [],
preprocessors: {
"**/*.coffee": ["coffee"],
"bootbox.js": ["coverage"]
},
reporters: ["dots", "coverage", "junit"],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ["PhantomJS"],
captureTimeout: 60000,
singleRun: true,

coverageReporter: {
type: "cobertura",
dir: "tests/coverage"
},

junitReporter: {
outputFile: "tests/reports/results.xml"
}
});

};

};
8 changes: 8 additions & 0 deletions karma-jquery-latest.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var baseConfig = require("./karma-base.conf");

module.exports = baseConfig({
vendor: [
"tests/vendor/jquery-1.10.2.min.js",
"tests/vendor/bootstrap-3.0.0.min.js"
]
});
8 changes: 8 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var baseConfig = require("./karma-base.conf");

module.exports = baseConfig({
vendor: [
"tests/vendor/jquery-1.8.3.min.js",
"tests/vendor/bootstrap-3.0.0.min.js"
]
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"test": "tests"
},
"scripts": {
"test": "./node_modules/.bin/karma start --single-run --browsers PhantomJS --reporters dots"
"test": "./node_modules/.bin/karma start"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 9e7cec1

Please sign in to comment.