Skip to content

Commit

Permalink
Replace mocha with jest
Browse files Browse the repository at this point in the history
  • Loading branch information
langpavel committed Jul 22, 2017
1 parent 3a9f4d3 commit 5fa108a
Show file tree
Hide file tree
Showing 5 changed files with 628 additions and 59 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ module.exports = {
'prettier/flowtype',
],

plugins: ['flowtype', 'prettier'],
plugins: ['flowtype', 'prettier', 'jest'],

globals: {
__DEV__: true,
},

env: {
browser: true,
'jest/globals': true,
},

rules: {
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-eslint": "^7.0.0",
"babel-jest": "^20.0.3",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-flow": "^6.23.0",
"babel-preset-latest": "^6.16.0",
Expand All @@ -44,21 +45,22 @@
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-flowtype": "^2.35.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jest": "^20.0.3",
"eslint-plugin-prettier": "^2.1.2",
"flow-bin": "^0.51.0",
"istanbul": "^1.1.0-alpha.1",
"jest": "^20.0.4",
"jest-codemods": "^0.10.2",
"mocha": "^3.1.2",
"prettier": "^1.5.3",
"regenerator-runtime": "^0.10.5",
"rollup": "^0.45.2",
"rollup-plugin-babel": "^2.6.1",
"sinon": "^2.0.0-pre.3"
},
"scripts": {
"lint": "eslint src test tools",
"test": "mocha --compilers js:babel-register",
"test:watch": "mocha --compilers js:babel-register --reporter min --watch",
"test:cover": "babel-node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha",
"test": "jest",
"test:watch": "jest --watch",
"test:cover": "jest --coverage",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"build": "node tools/build",
"prepublish": "npm run build",
Expand Down
7 changes: 3 additions & 4 deletions test/GreetingSpec.js → src/__tests__/GreetingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@
* LICENSE.txt file in the root directory of this source tree.
*/

import { expect } from 'chai';
import Greeting from '../src/Greeting';
import Greeting from '../Greeting';

describe('Greeting', () => {
describe('greeting.hello()', () => {
it('should return welcome message for a guest user', () => {
const greeting = new Greeting();
const message = greeting.hello();
expect(message).to.be.equal('Welcome, Guest!');
expect(message).toBe('Welcome, Guest!');
});

it('should return welcome message for a named user', () => {
const greeting = new Greeting('John');
const message = greeting.hello();
expect(message).to.be.equal('Welcome, John!');
expect(message).toBe('Welcome, John!');
});
});
});
16 changes: 0 additions & 16 deletions test/.eslintrc

This file was deleted.

Loading

0 comments on commit 5fa108a

Please sign in to comment.