Skip to content

Commit 05b1cad

Browse files
committed
Add Jest matchers & assertions
1 parent ef4f239 commit 05b1cad

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
A simplified zero-configuration wrapper around [Karma], [Webpack], [Jasmine] & [Puppeteer].
44

5+
Think of it like Jest for cross-browser testing (it uses the same [expect syntax](https://jestjs.io/docs/en/using-matchers)).
56

67
## Why do I want this?
78

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"babel-plugin-istanbul": "^5.2.0",
4646
"chalk": "^2.3.0",
4747
"dlv": "^1.1.3",
48+
"expect": "^24.9.0",
4849
"istanbul-instrumenter-loader": "^3.0.1",
4950
"jasmine-core": "^3.3.0",
5051
"karma": "^4.3.0",

src/configure.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,13 @@ export default function configure(options) {
218218
}],
219219

220220
files: [
221-
// @TODO remove me
222-
// { pattern: moduleDir('babel-polyfill')+'/dist/polyfill.js', watched: false, included: true, served: true }
221+
// Inject Jest matchers:
222+
{
223+
pattern: path.resolve(__dirname, '../node_modules/expect/build-es5/index.js'),
224+
watched: false,
225+
included: true,
226+
served: true
227+
}
223228
].concat( ...files.map( pattern => {
224229
// Expand '**/xx' patterns but exempt node_modules and gitignored directories
225230
let matches = pattern.match(/^\*\*\/(.+)$/);

test/jest-style.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('jest-style', () => {
2+
describe('not.stringContaining', () => {
3+
const expected = 'Hello world!';
4+
5+
it('matches if the received value does not contain the expected substring', () => {
6+
expect('How are you?').toEqual(expect.not.stringContaining(expected));
7+
});
8+
});
9+
});

0 commit comments

Comments
 (0)