-
Notifications
You must be signed in to change notification settings - Fork 3
Javascript unit testing
ΖΛΚ edited this page Dec 13, 2017
·
2 revisions
At Nimbletank we use Jest javascript unit test
npm install --save-dev jest
yarn add --dev jest
"test": "jest --verbose",
"test:watch": "jest --watch --verbose",
"test:coverage": "jest --coverage --verbose"
npm run test
npm run test:watch
npm run test:coverage
http://facebook.github.io/jest/docs/en/using-matchers.html#content
test('two plus two is four', () => {
expect(2 + 2).toBe(4);
});
test('Title for the test case', () => {
let result = function(value);
expect(result).toBe(expectedValue);
});
test('Title for the test case', () => {
let result = function(value);
expect(result).toEqual(expectedValue);
});
http://facebook.github.io/jest/docs/en/configuration.html
We will be using jest.config.js config instead of package.json config
module.exports = {
verbose: true,
coveragePathIgnorePatterns: ["./lib/"]
};
More config options here