mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 12:20:38 +01:00
Add configuration for running tests with Jest
Can be run with `node_modules/.bin/jest` for now; didn't want to disturb the grunt setup.
Right now one test fails with:
```
FAIL browser/ui/__tests__/ReactDOMComponent-test.js (1.423s)
● ReactDOMComponent › updateDOM › it should update styles when mutating style object
- Expected: '0' toEqual: '0.5'
at Spec.<anonymous> (src/browser/ui/__tests__/ReactDOMComponent-test.js:99:33)
```
which I can only assume is a jsdom problem -- no other asserts fail.
This commit is contained in:
parent
5933d97cb6
commit
2d26451821
1
jest/environment.js
Normal file
1
jest/environment.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
__DEV__ = true;
|
||||||
9
jest/preprocessor.js
Normal file
9
jest/preprocessor.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var ReactTools = require('../main.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
process: function(src) {
|
||||||
|
return ReactTools.transform(src, {harmony: true});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -54,6 +54,7 @@
|
||||||
"grunt-contrib-jshint": "~0.8.0",
|
"grunt-contrib-jshint": "~0.8.0",
|
||||||
"gzip-js": "~0.3.2",
|
"gzip-js": "~0.3.2",
|
||||||
"jasmine-tapreporter": "~0.2.2",
|
"jasmine-tapreporter": "~0.2.2",
|
||||||
|
"jest-cli": "~0.1.5",
|
||||||
"lodash": "~2.4.1",
|
"lodash": "~2.4.1",
|
||||||
"microtime": "~0.5.1",
|
"microtime": "~0.5.1",
|
||||||
"optimist": "~0.6.0",
|
"optimist": "~0.6.0",
|
||||||
|
|
@ -77,5 +78,13 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./node_modules/.bin/grunt test"
|
"test": "./node_modules/.bin/grunt test"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"rootDir": "src",
|
||||||
|
"scriptPreprocessor": "../jest/preprocessor.js",
|
||||||
|
"setupEnvScriptFile": "../jest/environment.js",
|
||||||
|
"unmockedModulePathPatterns": [
|
||||||
|
""
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user