Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CI; closes #2867 #2868

Merged
merged 5 commits into from
Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ module.exports = function (config) {
'expect',
'mocha'
],
plugins: [
'karma-browserify',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-expect',
'karma-mocha',
'karma-spec-reporter',
require('@coderbyheart/karma-sauce-launcher')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin is named 'karma-sauce-launcher', but the package is named something else, so we have to do this. Unfortunately, if you start specifying plugins, you have to specify all of them.

],
files: [
// we use the BDD interface for all of the tests that
// aren't interface-specific.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@
"supports-color": "3.1.2"
},
"devDependencies": {
"@coderbyheart/karma-sauce-launcher": "coderbyheart/karma-sauce-launcher#5259942cd6d40090eaa13ceeef5b0b8738c7710f",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

karma-sauce-launcher was a misnomer. npm@3 and npm@4 install this anyway, but npm@5 does not; see npm/npm#17193.

I'm using the changeset SHA here to avoid pulling down any subsequent commits to master, since this is someone else's repo.

I have another branch wherein the Mocha org owns a fork, so we have complete control over how it behaves -- and what upgrades it receives.

(This was done in the first place because the original package is not-very-well maintained)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to switching to our fork, although I have some questions I need to get on there and ask about that too...

"assert": "^1.4.1",
"browserify": "^13.0.0",
"coffee-script": "^1.10.0",
Expand All @@ -337,7 +338,6 @@
"karma-expect": "^1.1.2",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "0.2.3",
"karma-sauce-launcher": "coderbyheart/karma-sauce-launcher",
"karma-spec-reporter": "0.0.26",
"nyc": "^10.0.0",
"os-name": "^2.0.1",
Expand Down
3 changes: 1 addition & 2 deletions test/jsapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ var mocha = new Mocha({
growl: true
});

// mocha.reporter('spec');
require('should');
global.expect = require('expect.js');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in #2882, should is problematic for non-ES5-compliant environments, so we can't run tests using should in those environments.

jsapi runs a subset of the unit tests, which now all use expect rather than should.


mocha.addFile('test/unit/suite.spec.js');
mocha.addFile('test/unit/runner.spec.js');
Expand Down
12 changes: 6 additions & 6 deletions test/unit/grep.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ describe('Mocha', function () {
describe('"grep" option', function () {
it('should add a RegExp to the mocha.options object', function () {
var mocha = new Mocha({ grep: /foo.*/ });
mocha.options.grep.toString().should.equal('/foo.*/');
expect(mocha.options.grep.toString()).to.equal('/foo.*/');
});

it('should convert string to a RegExp', function () {
var mocha = new Mocha({ grep: 'foo.*' });
mocha.options.grep.toString().should.equal('/foo.*/');
expect(mocha.options.grep.toString()).to.equal('/foo.*/');
});
});

describe('"fgrep" option', function () {
it('should escape and convert string to a RegExp', function () {
var mocha = new Mocha({ fgrep: 'foo.*' });
mocha.options.grep.toString().should.equal('/foo\\.\\*/');
expect(mocha.options.grep.toString()).to.equal('/foo\\.\\*/');
});
});

Expand All @@ -27,7 +27,7 @@ describe('Mocha', function () {
function testGrep (mocha) {
return function testGrep (grep, expected) {
mocha.grep(grep);
mocha.options.grep.toString().should.equal(expected);
expect(mocha.options.grep.toString()).to.equal(expected);
};
}

Expand All @@ -54,14 +54,14 @@ describe('Mocha', function () {

it('should return it\'s parent Mocha object for chainability', function () {
var mocha = new Mocha();
mocha.grep().should.equal(mocha);
expect(mocha.grep()).to.equal(mocha);
});
});

describe('"invert" option', function () {
it('should add a Boolean to the mocha.options object', function () {
var mocha = new Mocha({ invert: true });
mocha.options.invert.should.be.ok;
expect(mocha.options.invert).to.be.ok;
});
});
});
8 changes: 4 additions & 4 deletions test/unit/hook-async.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('async', function () {

after(function () {
calls.push('root after all');
calls.should.eql([
expect(calls).to.eql([
'root before all',
'before all',
'parent before',
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('async', function () {
});

it('one', function (done) {
calls.should.eql([
expect(calls).to.eql([
'root before all',
'before all',
'parent before',
Expand All @@ -79,7 +79,7 @@ describe('async', function () {
});

it('two', function () {
calls.should.eql([
expect(calls).to.eql([
'root before all',
'before all',
'parent before',
Expand All @@ -97,7 +97,7 @@ describe('async', function () {
});

it('three', function () {
calls.should.eql([
expect(calls).to.eql([
'root before all',
'before all',
'parent before',
Expand Down
8 changes: 4 additions & 4 deletions test/unit/hook-sync-nested.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ describe('serial', function () {
});

it('foo', function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'parent before test foo'
]);
calls.push('foo');
});

it('bar', function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'parent before test foo',
'foo',
Expand All @@ -47,7 +47,7 @@ describe('serial', function () {
});

it('one', function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'parent before test foo',
'foo',
Expand All @@ -66,7 +66,7 @@ describe('serial', function () {
});

it('two', function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'parent before test foo',
'foo',
Expand Down
8 changes: 4 additions & 4 deletions test/unit/hook-sync.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('serial', function () {
});

it('one', function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'before',
'before test one'
Expand All @@ -29,7 +29,7 @@ describe('serial', function () {
});

it('two', function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'before',
'before test one',
Expand All @@ -45,7 +45,7 @@ describe('serial', function () {
});

it('three', function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'before',
'before test one',
Expand Down Expand Up @@ -75,7 +75,7 @@ describe('serial', function () {
});

after(function () {
calls.should.eql([
expect(calls).to.eql([
'parent before',
'before',
'before test one',
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mocha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Mocha', function () {
});
mocha.suite.addTest(failingTest);
mocha.run(function (failures) {
failures.should.equal(1);
expect(failures).to.equal(1);
done();
});
});
Expand Down
50 changes: 25 additions & 25 deletions test/unit/ms.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,72 +11,72 @@ describe('.ms()', function () {
};
describe('get a value that less than 1 second', function () {
it('should return milliseconds representation', function () {
ms(200).should.equal('200ms');
ms(30).should.equal('30ms');
ms(2000).should.not.equal('2000ms');
expect(ms(200)).to.equal('200ms');
expect(ms(30)).to.equal('30ms');
expect(ms(2000)).to.not.equal('2000ms');
});
});

describe('seconds representation', function () {
it('should return short format', function () {
ms(2000).should.equal('2s');
expect(ms(2000)).to.equal('2s');
});

it('should return long format', function () {
ms(2000, { long: true }).should.equal('2 seconds');
ms(1000, { long: true }).should.equal('1 second');
ms(1010, { long: true }).should.equal('1 second');
expect(ms(2000, { long: true })).to.equal('2 seconds');
expect(ms(1000, { long: true })).to.equal('1 second');
expect(ms(1010, { long: true })).to.equal('1 second');
});
});

describe('minutess representation', function () {
it('should return short format', function () {
ms(time.minutes(1)).should.equal('1m');
expect(ms(time.minutes(1))).to.equal('1m');
});

it('should return long format', function () {
ms(time.minutes(1), { long: true }).should.equal('1 minute');
ms(time.minutes(3), { long: true }).should.equal('3 minutes');
expect(ms(time.minutes(1), { long: true })).to.equal('1 minute');
expect(ms(time.minutes(3), { long: true })).to.equal('3 minutes');
});
});

describe('hours representation', function () {
it('should return short format', function () {
ms(time.hours(1)).should.equal('1h');
expect(ms(time.hours(1))).to.equal('1h');
});

it('should return long format', function () {
ms(time.hours(1), { long: true }).should.equal('1 hour');
ms(time.hours(3), { long: true }).should.equal('3 hours');
expect(ms(time.hours(1), { long: true })).to.equal('1 hour');
expect(ms(time.hours(3), { long: true })).to.equal('3 hours');
});
});

describe('days representation', function () {
it('should return short format', function () {
ms(time.days(1)).should.equal('1d');
expect(ms(time.days(1))).to.equal('1d');
});

it('should return long format', function () {
ms(time.days(1), { long: true }).should.equal('1 day');
ms(time.days(3), { long: true }).should.equal('3 days');
expect(ms(time.days(1), { long: true })).to.equal('1 day');
expect(ms(time.days(3), { long: true })).to.equal('3 days');
});
});

describe('Getting string value', function () {
it('should return the milliseconds representation(Number)', function () {
ms('1 second').should.equal(1000);
expect(ms('1 second')).to.equal(1000);

ms('1 minute').should.equal(time.minutes(1));
ms('6 minutes').should.equal(time.minutes(6));
expect(ms('1 minute')).to.equal(time.minutes(1));
expect(ms('6 minutes')).to.equal(time.minutes(6));

ms('1 hour').should.equal(time.hours(1));
ms('5 hours').should.equal(time.hours(5));
expect(ms('1 hour')).to.equal(time.hours(1));
expect(ms('5 hours')).to.equal(time.hours(5));

ms('1 day').should.equal(time.days(1));
ms('3 days').should.equal(time.days(3));
expect(ms('1 day')).to.equal(time.days(1));
expect(ms('3 days')).to.equal(time.days(3));

ms('1 year').should.equal(time.years(1));
ms('2 years').should.equal(time.years(2));
expect(ms('1 year')).to.equal(time.years(1));
expect(ms('2 years')).to.equal(time.years(2));
});
});
});
Loading