@samitouri / QOS-React-2 / commits / 2d26451821

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.

Ben Alpert committed May 13, 2014 at 00:40 UTC 2d26451821e024c287d3f2377610051a56a33315
3 files changed +19
jest/environment.js new
+1
@@ -0,0 +1 @@
1 +__DEV__ = true;
jest/preprocessor.js new
+9
@@ -0,0 +1,9 @@
1 +"use strict";
2 +
3 +var ReactTools = require('../main.js');
4 +
5 +module.exports = {
6 + process: function(src) {
7 + return ReactTools.transform(src, {harmony: true});
8 + }
9 +};
package.json
+9
@@ -54,6 +54,7 @@
54 "grunt-contrib-jshint": "~0.8.0",
55 "gzip-js": "~0.3.2",
56 "jasmine-tapreporter": "~0.2.2",
57 + "jest-cli": "~0.1.5",
58 "lodash": "~2.4.1",
59 "microtime": "~0.5.1",
60 "optimist": "~0.6.0",
@@ -77,5 +78,13 @@
78 },
79 "scripts": {
80 "test": "./node_modules/.bin/grunt test"
81 + },
82 + "jest": {
83 + "rootDir": "src",
84 + "scriptPreprocessor": "../jest/preprocessor.js",
85 + "setupEnvScriptFile": "../jest/environment.js",
86 + "unmockedModulePathPatterns": [
87 + ""
88 + ]
89 }
90 }