Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronabramov authored and kyldvs committed Sep 10, 2016
1 parent 42feb52 commit 55480fb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 32 deletions.
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"gulp-rename": "^1.2.2",
"gulp-util": "^3.0.6",
"immutable": "^3.7.4",
"jest-cli": "^11.0.1",
"jest": "^15.1.1",
"object-assign": "^4.0.1",
"react": "^15.0.2",
"react-addons-test-utils": "^15.0.1",
Expand All @@ -71,18 +71,14 @@
"/lib/",
"/node_modules/"
],
"persistModuleRegistryBetweenSpecs": true,
"preprocessorIgnorePatterns": [
"/node_modules/"
],
"rootDir": "",
"rootDir": "./",
"scriptPreprocessor": "scripts/jest/preprocessor.js",
"setupEnvScriptFile": "scripts/jest/environment.js",
"setupFiles": ["scripts/jest/environment.js"],
"testPathDirs": [
"<rootDir>/src"
],
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/(?!fbemitter)"
]
}
}
11 changes: 2 additions & 9 deletions scripts/jest/preprocessor.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
var assign = require('object-assign');
var babel = require('babel-core');
var babelDefaultOptions = require('../babel/default-options');

var babelOpts = babelDefaultOptions;
var babelOpts = require('../babel/default-options');

module.exports = {
process: function(src, path) {
// TODO: Use preprocessorIgnorePatterns when it works.
// See https://github.com/facebook/jest/issues/385.
if (!path.match(/\/node_modules\//) && !path.match(/\/third_party\//)) {
return babel.transform(src, assign({filename: path}, babelOpts)).code;
}
return src;
return babel.transform(src, assign({filename: path}, babelOpts)).code;
}
};
3 changes: 0 additions & 3 deletions src/__tests__/Dispatcher-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/

jest.dontMock('Dispatcher');
jest.dontMock('invariant');

var Dispatcher = require('Dispatcher');

describe('Dispatcher', () => {
Expand Down
5 changes: 0 additions & 5 deletions src/__tests__/FluxStoreGroup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
* @typechecks
*/

jest
.dontMock('Dispatcher')
.dontMock('FluxStore')
.dontMock('FluxStoreGroup');

var Dispatcher = require('Dispatcher');
var FluxStore = require('FluxStore');
var FluxStoreGroup = require('FluxStoreGroup');
Expand Down
6 changes: 1 addition & 5 deletions src/stores/__tests__/FluxReduceStore-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
* @emails oncall+uiecommd
*/

jest
.dontMock('Dispatcher')
.dontMock('FluxReduceStore')
.dontMock('FluxStore');

var Dispatcher = require('Dispatcher');
var FluxReduceStore = require('FluxReduceStore');
var Immutable = require('immutable');
Expand Down Expand Up @@ -48,6 +43,7 @@ describe('FluxReduceStore', () => {
var dispatcher = new Dispatcher();
store = new FooStore(dispatcher);
dispatch = dispatcher.dispatch.bind(dispatcher);
store.__emitter.emit = jest.fn();
onChange = store.__emitter.emit;
});

Expand Down
5 changes: 2 additions & 3 deletions src/stores/__tests__/FluxStore-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
* @typechecks
*/

jest
.dontMock('FluxStore')
.dontMock('invariant'); // This shouldn't be necessary. Not sure why it is.
jest.mock('fbemitter');
jest.mock('Dispatcher');

var FluxStore = require('FluxStore');
var Dispatcher = require('Dispatcher');
Expand Down

0 comments on commit 55480fb

Please sign in to comment.