Use karma-env-preprocessor

This commit is contained in:
Kagami Hiiragi 2015-02-02 17:34:00 +03:00
parent 2ee782090d
commit edf254c6e5
5 changed files with 12 additions and 13 deletions

View File

@ -1 +0,0 @@
window.ALL_TESTS = true;

View File

@ -1,10 +1,5 @@
process.env.CHROME_BIN = "chromium-browser"; process.env.CHROME_BIN = "chromium-browser";
var allTests = !!process.env.ALL_TESTS; var allTests = process.env.ALL_TESTS === "1";
var files = ["test.js"];
if (allTests) {
// Kludgy way to pass a variable to `test.js`.
files.unshift("karma-all-tests.js");
};
module.exports = function(config) { module.exports = function(config) {
config.set({ config.set({
@ -19,16 +14,21 @@ module.exports = function(config) {
// list of files / patterns to load in the browser // list of files / patterns to load in the browser
files: files, files: ["test.js"],
// preprocess matching files before serving them to the browser // preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: { preprocessors: {
"test.js": ["browserify"], "test.js": ["browserify", "env"],
}, },
envPreprocessor: [
"ALL_TESTS",
],
// list of files to exclude // list of files to exclude
exclude: [ exclude: [
], ],

View File

@ -40,7 +40,8 @@ BaseTransport.prototype.bootstrap = function() {
/** /**
* Connect to the transport-specific address. * Connect to the transport-specific address.
* Should emit `open` event when the connection is established. * Should emit `open` event after successful connect and `established`
* event after `verack` messages exchange.
* @abstract * @abstract
*/ */
BaseTransport.prototype.connect = function() { BaseTransport.prototype.connect = function() {

View File

@ -44,6 +44,7 @@
"karma-browserify": "^2.0.0", "karma-browserify": "^2.0.0",
"karma-chrome-launcher": "^0.1.7", "karma-chrome-launcher": "^0.1.7",
"karma-cli": "~0.0.4", "karma-cli": "~0.0.4",
"karma-env-preprocessor": "^0.1.0",
"karma-firefox-launcher": "^0.1.4", "karma-firefox-launcher": "^0.1.4",
"karma-mocha": "^0.1.10", "karma-mocha": "^0.1.10",
"karma-mocha-reporter": "^0.3.1", "karma-mocha-reporter": "^0.3.1",

View File

@ -1,7 +1,5 @@
var expect = require("chai").expect; var expect = require("chai").expect;
var allTests = typeof window === "undefined" ? var allTests = (global.__env__ || process.env).ALL_TESTS === "1";
!!process.env.ALL_TESTS :
window.ALL_TESTS;
var bufferEqual = require("buffer-equal"); var bufferEqual = require("buffer-equal");
var bitmessage = require("./lib"); var bitmessage = require("./lib");