Use karma-env-preprocessor
This commit is contained in:
parent
2ee782090d
commit
edf254c6e5
|
@ -1 +0,0 @@
|
||||||
window.ALL_TESTS = true;
|
|
|
@ -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: [
|
||||||
],
|
],
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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",
|
||||||
|
|
4
test.js
4
test.js
|
@ -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");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user