Skip to content

Commit

Permalink
chore(project): bump dev dependencies
Browse files Browse the repository at this point in the history
+ karma@1
- chai-spies
+ sinon, sinon-chai
  • Loading branch information
nikku committed Nov 13, 2017
1 parent e42a5be commit 21bd468
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 64 deletions.
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,26 @@
"devDependencies": {
"brfs": "^1.4.2",
"browser-unpack": "^1.1.1",
"browserify": "^14.0.0",
"chai": "^3.4.1",
"chai-spies": "^0.7.1",
"browserify": "^14.5.0",
"chai": "^4.1.2",
"grunt": "~1.0.1",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.3",
"grunt-mocha-test": "^0.12.7",
"grunt-release": "^0.13.0",
"jasmine-core": "^2.4.1",
"karma": "^0.13.19",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.3",
"karma": "^1.7.1",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.4",
"load-grunt-tasks": "^3.4.0",
"mocha": "^2.3.4",
"phantomjs": "^1.9.19",
"mocha": "^4.0.1",
"resolve": "^1.1.6",
"touch": "^1.0.0",
"tsify": "^0.13.1",
"watchify": "^3.6.1"
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"touch": "^3.1.0",
"tsify": "^3.0.3",
"typescript": "^2.6.1",
"watchify": "^3.9.0"
},
"peerDependencies": {
"karma": ">=0.10.0",
Expand Down
4 changes: 2 additions & 2 deletions test/expect.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var chai = require('chai');
var spies = require('chai-spies');
var sinonChai = require('sinon-chai');

chai.use(spies);
chai.use(sinonChai);

// expose expect as global
global.expect = chai.expect;
9 changes: 5 additions & 4 deletions test/integration/auto-watch.conf.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use strict';

var base = require('./single-run.conf');
var configure = require('./configure');

module.exports = function(karma) {
base(karma);
var singleRun = require('./single-run.conf');

module.exports = configure(singleRun, function(karma) {

karma.set({
singleRun: false,
autoWatch: true
});
};
});
23 changes: 23 additions & 0 deletions test/integration/configure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = function() {

// hooks
var hooks = Array.prototype.slice.call(arguments);

// actual config fn
return function(karma) {

var opts = {};

var fakeKarma = {
set: function(props) {
opts = Object.assign(opts, props);
}
};

hooks.forEach(function(h) {
h(fakeKarma);
});

karma.set(opts);
};
}
8 changes: 4 additions & 4 deletions test/integration/dependency-error.conf.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';

var base = require('./error.conf');
var configure = require('./configure');

module.exports = function(karma) {
var error = require('./error.conf');

base(karma);
module.exports = configure(error, function(karma) {

karma.set({
files: [
'test/error/dependencyErrorSpec.js'
]
});
};
});
8 changes: 4 additions & 4 deletions test/integration/error.conf.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var base = require('./karma.conf');
var configure = require('./configure');

module.exports = function(karma) {
var base = require('./karma.conf');

base(karma);
module.exports = configure(base, function(karma) {

karma.set({

Expand All @@ -23,4 +23,4 @@ module.exports = function(karma) {
singleRun: true,
autoWatch: false,
});
};
});
2 changes: 1 addition & 1 deletion test/integration/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var platformSuffix = /^win/.test(process.platform) ? '-win' : '',
prebundledCommon = 'prebundled/common' + platformSuffix + '.js';

module.exports = function(karma) {

karma.set({

plugins: ['karma-*', require('../..')],
Expand Down Expand Up @@ -50,7 +51,6 @@ module.exports = function(karma) {

// configure browserify
configure: function(b) {

b.on('prebundle', function() {
b.external('lib/common.js');
});
Expand Down
11 changes: 5 additions & 6 deletions test/integration/no-auto-watch.conf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';

var configure = require('./configure');

var base = require('./karma.conf');

module.exports = function(karma) {
base(karma);
module.exports = configure(base, function(karma) {

karma.set({
files: [
Expand All @@ -23,8 +24,6 @@ module.exports = function(karma) {
debug: true
},

reporters: [],

logLevel: 'ERROR'
logLevel: 'DEBUG'
});
};
});
9 changes: 5 additions & 4 deletions test/integration/single-run.conf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';

var configure = require('./configure');

var base = require('./karma.conf');

module.exports = function(karma) {
base(karma);
module.exports = configure(base, function(karma) {

karma.set({
files: [
Expand All @@ -20,9 +21,9 @@ module.exports = function(karma) {
browserify: {
debug: true
},

reporters: [],

logLevel: 'ERROR'
});
};
});
8 changes: 4 additions & 4 deletions test/integration/test-error.conf.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict';

var base = require('./error.conf');
var configure = require('./configure');

module.exports = function(karma) {
var error = require('./error.conf');

base(karma);
module.exports = configure(error, function(karma) {

karma.set({
files: [
'test/error/testErrorSpec.js'
]
});
};
});
7 changes: 4 additions & 3 deletions test/integration/typescript-error.conf.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';

var configure = require('./configure');

var base = require('./karma.conf');

module.exports = function(karma) {
base(karma);
module.exports = configure(base, function(karma) {

karma.set({
files: [
Expand All @@ -23,4 +24,4 @@ module.exports = function(karma) {

logLevel: 'ERROR'
});
};
});
18 changes: 12 additions & 6 deletions test/spec/integrationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var singleRunConfig = require.resolve('../integration/single-run.conf'),

var path = require('path');
var resolve = require('resolve');
var chai = require('chai');
var sinon = require('sinon');
var chokidar = require(resolve.sync('chokidar', {
basedir: path.resolve(__dirname, '../../node_modules/watchify')
}));
Expand All @@ -26,31 +26,37 @@ function triggerRun(configFile, done) {
}


describe('karma-browserify', function() {
describe.only('karma-browserify', function() {

var runner;
var runner,
watchSpy;

beforeEach(function() {
runner = new Runner();
});

afterEach(function() {
runner.stop();
});

chokidar.watch = chai.spy(chokidar.watch);
if (watchSpy) {
watchSpy.restore();
watchSpy = null;
}
});

this.timeout(10 * 1000);


it('should perform a simple run', function(done) {

watchSpy = sinon.spy(chokidar, 'watch');

runner.start(singleRunConfig, function(result) {
expect(result).to.equal(0);

// Verify that a single run doesn't create a bunch of watchers.
// (This test assumes that watchify uses chokidar for watching).
expect(chokidar.watch).to.not.have.been.called();
expect(watchSpy).not.to.have.been.called;
done();
});
});
Expand Down
27 changes: 12 additions & 15 deletions test/spec/pluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var Bro = require('../../lib/bro');
var BundleFile = require('../../lib/bundle-file');
var RestorableFile = require('../restorable-file');
var LoggerFactory = require('./logger-factory');
var chai = require('chai');
var sinon = require('sinon');
var path = require('path');
var fs = require('fs');
var unpack = require('browser-unpack');
Expand Down Expand Up @@ -128,9 +128,9 @@ describe('karma-browserify', function() {

bundle = new BundleFile();

bundle.update = chai.spy(bundle.update);
bundle.touch = chai.spy(bundle.touch);
bundle.remove = chai.spy(bundle.remove);
sinon.spy(bundle, 'update');
sinon.spy(bundle, 'touch');
sinon.spy(bundle, 'remove');

bro = new Bro(bundle);
});
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('karma-browserify', function() {
createPlugin(config);

// then
expect(bundle.touch).to.have.been.called();
expect(bundle.touch).to.have.been.called;

expect(config.files[0].pattern).to.eql(bundle.location);
});
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('karma-browserify', function() {
emitter.emit('exit', function() { });

// then
expect(bundle.remove).to.have.been.called();
expect(bundle.remove).to.have.been.called;
});

});
Expand Down Expand Up @@ -354,8 +354,7 @@ describe('karma-browserify', function() {
plugin.preprocess(bundleFile, [ testFile ], function() {

// reset spy on bundle
bundle.update.__spy.calls = [];
bundle.update.__spy.called = false;
bundle.update.reset();

// when
// update bundle file
Expand All @@ -367,7 +366,7 @@ describe('karma-browserify', function() {
delay(function() {

// then
expect(bundle.update).to.have.been.called();
expect(bundle.update).to.have.been.called;

done();
}, BUNDLE_UPDATE_CHECK_DELAY);
Expand Down Expand Up @@ -412,8 +411,7 @@ describe('karma-browserify', function() {
plugin.preprocess(bundleFile, [ testFile ], function() {

// reset spy on bundle
bundle.update.__spy.calls = [];
bundle.update.__spy.called = false;
bundle.update.reset();

// when
// update bundle file
Expand All @@ -426,7 +424,7 @@ describe('karma-browserify', function() {

// then
// no update on parse error
expect(bundle.update).to.have.been.called.with('throw new Error("bundle error (see logs)");');
expect(bundle.update).to.have.been.calledWith('throw new Error("bundle error (see logs)");');

done();
}, BUNDLE_UPDATE_CHECK_DELAY);
Expand All @@ -451,8 +449,7 @@ describe('karma-browserify', function() {
plugin.preprocess(bundleFile, [ testFile ], function() {

// reset spy on bundle
bundle.update.__spy.calls = [];
bundle.update.__spy.called = false;
bundle.update.reset();

// when
// remove file
Expand All @@ -470,7 +467,7 @@ describe('karma-browserify', function() {

// then
// update with file deleted
expect(bundle.update).to.have.been.called();
expect(bundle.update).to.have.been.called;

expect(bundleFile.realContents()).not.to.contain('/b.js');
done();
Expand Down

0 comments on commit 21bd468

Please sign in to comment.