mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
Introduce jest as test-framework for gui code (react).
jest is somewhat documented here: https://facebook.github.io/jest/ related to #61
This commit is contained in:
parent
89dddae4b1
commit
50973142f8
7
jest-preprocessor.js
Normal file
7
jest-preprocessor.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// preprocessor.js
|
||||||
|
var ReactTools = require('react-tools');
|
||||||
|
module.exports = {
|
||||||
|
process: function(src) {
|
||||||
|
return ReactTools.transform(src);
|
||||||
|
}
|
||||||
|
};
|
10
package.json
10
package.json
@ -25,7 +25,8 @@
|
|||||||
"test-bamboo-ci": "mocha test test/*",
|
"test-bamboo-ci": "mocha test test/*",
|
||||||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",
|
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec",
|
||||||
"coverage-report": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
|
"coverage-report": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
|
||||||
"postinstall": "npm run build"
|
"postinstall": "npm run build",
|
||||||
|
"jest": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bluebird": "2.2.2",
|
"bluebird": "2.2.2",
|
||||||
@ -50,13 +51,20 @@
|
|||||||
"chai": "1.9.1",
|
"chai": "1.9.1",
|
||||||
"coveralls": "^2.11.2",
|
"coveralls": "^2.11.2",
|
||||||
"istanbul": "0.3.2",
|
"istanbul": "0.3.2",
|
||||||
|
"jest-cli": "^0.1.18",
|
||||||
"jshint": "2.5.2",
|
"jshint": "2.5.2",
|
||||||
"mocha": "1.20.1",
|
"mocha": "1.20.1",
|
||||||
"mocha-lcov-reporter": "0.0.1",
|
"mocha-lcov-reporter": "0.0.1",
|
||||||
"mockery": "1.4.0",
|
"mockery": "1.4.0",
|
||||||
"pre-commit": "0.0.9",
|
"pre-commit": "0.0.9",
|
||||||
|
"react-tools": "^0.12.0",
|
||||||
"supertest": "0.13.0",
|
"supertest": "0.13.0",
|
||||||
"supervisor": "0.6.0",
|
"supervisor": "0.6.0",
|
||||||
"xmlbuilder": "2.4.4"
|
"xmlbuilder": "2.4.4"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"scriptPreprocessor": "<rootDir>/jest-preprocessor.js",
|
||||||
|
"unmockedModulePathPatterns": ["<rootDir>/node_modules/react"],
|
||||||
|
"moduleFileExtensions": ["jsx", "js"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
public/js/__tests__/Menu-test.js
Normal file
14
public/js/__tests__/Menu-test.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/** @jsx React.DOM */
|
||||||
|
|
||||||
|
jest.dontMock("../components/Menu");
|
||||||
|
|
||||||
|
var Menu = require("../components/Menu");
|
||||||
|
var React = require("react/addons");
|
||||||
|
var TestUtils = React.addons.TestUtils;
|
||||||
|
|
||||||
|
describe('Menu test', function () {
|
||||||
|
it('should include unleash in menu', function () {
|
||||||
|
var Compononent = TestUtils .renderIntoDocument(<Menu />);
|
||||||
|
expect(Compononent.getDOMNode().textContent).toMatch('unleash');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user