Skip to content

Commit 769d356

Browse files
committed
Replace Mocha + Chai with Jest
1 parent dc0dbfa commit 769d356

File tree

4 files changed

+2387
-165
lines changed

4 files changed

+2387
-165
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ node_js:
88
cache: yarn
99

1010
script:
11-
- yarn test
11+
- yarn test --coverage

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"babel-preset-env": "^1.2.2",
55
"babel-preset-latest": "^6.24.0",
66
"babel-register": "^6.22.0",
7-
"chai": "^3.5.0",
8-
"mocha": "^3.2.0"
7+
"jest": "^21.0.0"
98
},
109
"name": "babel-plugin-debug-macros",
1110
"version": "0.1.11",
@@ -20,7 +19,7 @@
2019
"url": "https://github.com/chadhietala/babel-debug-macros"
2120
},
2221
"scripts": {
23-
"test": "mocha src/tests/**-test.js"
22+
"test": "jest"
2423
},
2524
"keywords": [
2625
"babel",
@@ -34,5 +33,10 @@
3433
"license": "MIT",
3534
"dependencies": {
3635
"semver": "^5.3.0"
36+
},
37+
"jest": {
38+
"testMatch": [
39+
"<rootDir>/src/tests/**/*-test.js"
40+
]
3741
}
3842
}

src/tests/debug-tools-test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const DebugToolsPlugin = require('../index');
44
const transform = require('babel-core').transform;
5-
const expect = require('chai').expect;
65
const fs = require('fs');
76

87
const presets = [["latest", {
@@ -422,14 +421,14 @@ function transformTestHelper(options) {
422421
it(fixtureName, function() {
423422
let sample = fs.readFileSync(`./fixtures/${fixtureName}/sample.js`, 'utf-8');
424423
let expectation = fs.readFileSync(`./fixtures/${fixtureName}/expectation.js`, 'utf-8');
425-
expect(transform(sample, options).code).to.equal(expectation);
424+
expect(transform(sample, options).code).toEqual(expectation);
426425
});
427426
},
428427

429428
generateErrorTest(fixtureName, error) {
430429
it(fixtureName, function() {
431430
let sample = fs.readFileSync(`./fixtures/${fixtureName}/sample.js`, 'utf-8');
432-
expect(() => transform(sample, options)).to.throw(error);
431+
expect(() => transform(sample, options)).toThrow(error);
433432
});
434433
},
435434
};

0 commit comments

Comments
 (0)