Skip to content

Commit

Permalink
Replace chai-arrays with chai-as-promised for runner scripts
Browse files Browse the repository at this point in the history
chai-arrays does not support the assertion style which is inconsistent. And it turns out to not be very useful.
chai-as-promised is very useful because almost all script commands are asynchronous
  • Loading branch information
Joris-van-der-Wel committed Dec 8, 2017
1 parent a5dd384 commit d88a62a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -66,7 +66,7 @@
"brace": "^0.11.0",
"browserify": "^14.4.0",
"chai": "^4.1.2",
"chai-arrays": "^2.0.0",
"chai-as-promised": "^7.1.1",
"chai-dom": "^1.5.0",
"chai-subset": "^1.6.0",
"cjson": "^0.5.0",
Expand Down
4 changes: 2 additions & 2 deletions runner-modules/chai/lib/chai.js
Expand Up @@ -2,11 +2,11 @@
/* global window */
const chai = require('chai');
const chaiSubset = require('chai-subset');
const chaiArrays = require('chai-arrays');
const chaiAsPromised = require('chai-as-promised');
const chaiDom = require('chai-dom');

chai.use(chaiSubset);
chai.use(chaiArrays);
chai.use(chaiAsPromised);
if (typeof window === 'object' && window.HTMLDocument) {
chai.use(chaiDom);
}
Expand Down
10 changes: 8 additions & 2 deletions test/integration/chai.test.js
Expand Up @@ -24,7 +24,10 @@ describe('integration/chai', {timeout: 60000, slow: 10000}, () => {
document.body.id = 'foo';
expect(document.body).to.have.id('foo');
expect({a: 'b', foo: 'bar'}).to.containSubset({a: 'b'});
expect([1, 2, 3]).to.be.containingAllOf([1]);
await assert.isRejected(
Promise.reject(Error('FOO BAR')),
/FOO/i
);
});
}, {url: `http://localhost:${testServerPort()}/static/static.html`});
/* eslint-enable no-undef */
Expand All @@ -46,7 +49,10 @@ describe('integration/chai', {timeout: 60000, slow: 10000}, () => {
expect(123).to.equal(123);
expect('foo bar baz').to.match(/bar/);
expect({a: 'b', foo: 'bar'}).to.containSubset({a: 'b'});
expect([1, 2, 3]).to.be.containingAllOf([1]);
await assert.isRejected(
Promise.reject(Error('FOO BAR')),
/FOO/i
);
});
/* eslint-enable no-undef */

Expand Down

0 comments on commit d88a62a

Please sign in to comment.