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:
Ben Alpert 2014-05-13 00:40:29 -07:00
parent 5933d97cb6
commit 2d26451821
3 changed files with 19 additions and 0 deletions

1
jest/environment.js Normal file
View File

@ -0,0 +1 @@
__DEV__ = true;

9
jest/preprocessor.js Normal file
View File

@ -0,0 +1,9 @@
"use strict";
var ReactTools = require('../main.js');
module.exports = {
process: function(src) {
return ReactTools.transform(src, {harmony: true});
}
};

View File

@ -54,6 +54,7 @@
"grunt-contrib-jshint": "~0.8.0",
"gzip-js": "~0.3.2",
"jasmine-tapreporter": "~0.2.2",
"jest-cli": "~0.1.5",
"lodash": "~2.4.1",
"microtime": "~0.5.1",
"optimist": "~0.6.0",
@ -77,5 +78,13 @@
},
"scripts": {
"test": "./node_modules/.bin/grunt test"
},
"jest": {
"rootDir": "src",
"scriptPreprocessor": "../jest/preprocessor.js",
"setupEnvScriptFile": "../jest/environment.js",
"unmockedModulePathPatterns": [
""
]
}
}