Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion grunt/tasks/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function writeTempConfig(callback) {
function run(done, configPath) {
grunt.log.writeln('running jest (this may take a while)');

var args = ['--harmony', path.join('node_modules', 'jest-cli', 'bin', 'jest')];
var args = ['--harmony', path.join('node_modules', 'jest-cli', 'bin', 'jest'), '--runInBand'];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @zpao @gaearon I'm gonna ship this with --runInBand – it should avoid the failures on travis you guys have been seeing. Let me know if you have any trouble with this.

if (configPath) {
args.push('--config', configPath);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"gulp-babel": "^6.0.0",
"gulp-flatten": "^0.2.0",
"gzip-js": "~0.3.2",
"jest-cli": "^0.9.0",
"jest-cli": "^12.0.2",
"loose-envify": "^1.1.0",
"object-assign": "^4.0.1",
"platform": "^1.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/core/__tests__/ReactErrorBoundaries-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('ReactErrorBoundaries', function() {

var EventPluginHub = require('EventPluginHub');
var container = document.createElement('div');
EventPluginHub.putListener = jest.genMockFn();
EventPluginHub.putListener = jest.fn();
ReactDOM.render(<Boundary />, container);
expect(EventPluginHub.putListener).not.toBeCalled();
});
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('ReactErrorBoundaries', function() {

var EventPluginHub = require('EventPluginHub');
var container = document.createElement('div');
EventPluginHub.putListener = jest.genMockFn();
EventPluginHub.putListener = jest.fn();
ReactDOM.render(<Boundary />, container);
expect(EventPluginHub.putListener).toBeCalled();
});
Expand Down
8 changes: 4 additions & 4 deletions src/isomorphic/classic/class/__tests__/ReactBind-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ describe('autobinding', function() {

it('Holds reference to instance', function() {

var mouseDidEnter = jest.genMockFn();
var mouseDidLeave = jest.genMockFn();
var mouseDidClick = jest.genMockFn();
var mouseDidEnter = jest.fn();
var mouseDidLeave = jest.fn();
var mouseDidClick = jest.fn();

var TestBindComponent = React.createClass({
getInitialState: function() {
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('autobinding', function() {
});

it('works with mixins', function() {
var mouseDidClick = jest.genMockFn();
var mouseDidClick = jest.fn();

var TestMixin = {
onClick: mouseDidClick,
Expand Down
10 changes: 5 additions & 5 deletions src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ describe('autobind optout', function() {

it('should work with manual binding', function() {

var mouseDidEnter = jest.genMockFn();
var mouseDidLeave = jest.genMockFn();
var mouseDidClick = jest.genMockFn();
var mouseDidEnter = jest.fn();
var mouseDidLeave = jest.fn();
var mouseDidClick = jest.fn();

var TestBindComponent = React.createClass({
autobind: false,
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('autobind optout', function() {
});

it('works with mixins that have not opted out of autobinding', function() {
var mouseDidClick = jest.genMockFn();
var mouseDidClick = jest.fn();

var TestMixin = {
onClick: mouseDidClick,
Expand All @@ -164,7 +164,7 @@ describe('autobind optout', function() {
});

it('works with mixins that have opted out of autobinding', function() {
var mouseDidClick = jest.genMockFn();
var mouseDidClick = jest.fn();

var TestMixin = {
autobind: false,
Expand Down
2 changes: 1 addition & 1 deletion src/isomorphic/classic/class/__tests__/ReactClass-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('ReactClass-spec', function() {
});

it('should copy prop types onto the Constructor', function() {
var propValidator = jest.genMockFn();
var propValidator = jest.fn();
var TestComponent = React.createClass({
propTypes: {
value: propValidator,
Expand Down
10 changes: 5 additions & 5 deletions src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe('ReactClass-mixin', function() {
beforeEach(function() {
React = require('React');
ReactTestUtils = require('ReactTestUtils');
mixinPropValidator = jest.genMockFn();
componentPropValidator = jest.genMockFn();
mixinPropValidator = jest.fn();
componentPropValidator = jest.fn();

var MixinA = {
propTypes: {
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('ReactClass-mixin', function() {
});

it('should support merging propTypes and statics', function() {
var listener = jest.genMockFn();
var listener = jest.fn();
var instance = <TestComponent listener={listener} />;
instance = ReactTestUtils.renderIntoDocument(instance);

Expand All @@ -122,7 +122,7 @@ describe('ReactClass-mixin', function() {
});

it('should support chaining delegate functions', function() {
var listener = jest.genMockFn();
var listener = jest.fn();
var instance = <TestComponent listener={listener} />;
instance = ReactTestUtils.renderIntoDocument(instance);

Expand All @@ -135,7 +135,7 @@ describe('ReactClass-mixin', function() {
});

it('should chain functions regardless of spec property order', function() {
var listener = jest.genMockFn();
var listener = jest.fn();
var instance = <TestComponentWithReverseSpec listener={listener} />;
instance = ReactTestUtils.renderIntoDocument(instance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var recordIDAndReturnFalse = function(id, event) {
recordID(id);
return false;
};
var LISTENER = jest.genMockFn();
var LISTENER = jest.fn();
var ON_CLICK_KEY = keyOf({onClick: null});
var ON_TOUCH_TAP_KEY = keyOf({onTouchTap: null});
var ON_CHANGE_KEY = keyOf({onChange: null});
Expand Down Expand Up @@ -284,7 +284,7 @@ describe('ReactBrowserEventEmitter', function() {
*/

it('should invoke handlers that were removed while bubbling', function() {
var handleParentClick = jest.genMockFn();
var handleParentClick = jest.fn();
var handleChildClick = function(event) {
EventPluginHub.deleteAllListeners(getInternal(PARENT));
};
Expand All @@ -303,7 +303,7 @@ describe('ReactBrowserEventEmitter', function() {
});

it('should not invoke newly inserted handlers while bubbling', function() {
var handleParentClick = jest.genMockFn();
var handleParentClick = jest.fn();
var handleChildClick = function(event) {
EventPluginHub.putListener(
getInternal(PARENT),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('ReactEventListener', function() {
ReactEventListener = require('ReactEventListener');
ReactTestUtils = require('ReactTestUtils');

handleTopLevel = jest.genMockFn();
handleTopLevel = jest.fn();
ReactEventListener._handleTopLevel = handleTopLevel;
});

Expand Down
4 changes: 2 additions & 2 deletions src/renderers/dom/client/__tests__/ReactMount-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ describe('ReactMount', function() {
it('should unmount and remount if the key changes', function() {
var container = document.createElement('container');

var mockMount = jest.genMockFn();
var mockUnmount = jest.genMockFn();
var mockMount = jest.fn();
var mockUnmount = jest.fn();

var Component = React.createClass({
componentDidMount: mockMount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('SelectEventPlugin', function() {
},
});

var cb = jest.genMockFn();
var cb = jest.fn();

var rendered = ReactTestUtils.renderIntoDocument(
<WithSelect onSelect={cb} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('DisabledInputUtils', function() {
return element;
}

var onClick = jest.genMockFn();
var onClick = jest.fn();

elements.forEach(function(tagName) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ describe('ReactDOMInput', function() {
});

it('should support ReactLink', function() {
var link = new ReactLink('yolo', jest.genMockFn());
var link = new ReactLink('yolo', jest.fn());
var instance = <input type="text" valueLink={link} />;

instance = ReactTestUtils.renderIntoDocument(instance);
Expand All @@ -262,15 +262,15 @@ describe('ReactDOMInput', function() {
});

it('should warn with value and no onChange handler', function() {
var link = new ReactLink('yolo', jest.genMockFn());
var link = new ReactLink('yolo', jest.fn());
ReactTestUtils.renderIntoDocument(<input type="text" valueLink={link} />);
expect(console.error.argsForCall.length).toBe(1);
expect(console.error.argsForCall[0][0]).toContain(
'`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.'
);

ReactTestUtils.renderIntoDocument(
<input type="text" value="zoink" onChange={jest.genMockFn()} />
<input type="text" value="zoink" onChange={jest.fn()} />
);
expect(console.error.argsForCall.length).toBe(1);
ReactTestUtils.renderIntoDocument(<input type="text" value="zoink" />);
Expand Down Expand Up @@ -302,7 +302,7 @@ describe('ReactDOMInput', function() {

it('should throw if both value and valueLink are provided', function() {
var node = document.createElement('div');
var link = new ReactLink('yolo', jest.genMockFn());
var link = new ReactLink('yolo', jest.fn());
var instance = <input type="text" valueLink={link} />;

expect(() => ReactDOM.render(instance, node)).not.toThrow();
Expand All @@ -322,7 +322,7 @@ describe('ReactDOMInput', function() {
});

it('should support checkedLink', function() {
var link = new ReactLink(true, jest.genMockFn());
var link = new ReactLink(true, jest.fn());
var instance = <input type="checkbox" checkedLink={link} />;

instance = ReactTestUtils.renderIntoDocument(instance);
Expand All @@ -340,7 +340,7 @@ describe('ReactDOMInput', function() {

it('should warn with checked and no onChange handler', function() {
var node = document.createElement('div');
var link = new ReactLink(true, jest.genMockFn());
var link = new ReactLink(true, jest.fn());
ReactDOM.render(<input type="checkbox" checkedLink={link} />, node);
expect(console.error.argsForCall.length).toBe(1);
expect(console.error.argsForCall[0][0]).toContain(
Expand All @@ -351,7 +351,7 @@ describe('ReactDOMInput', function() {
<input
type="checkbox"
checked="false"
onChange={jest.genMockFn()}
onChange={jest.fn()}
/>
);
expect(console.error.argsForCall.length).toBe(1);
Expand Down Expand Up @@ -379,7 +379,7 @@ describe('ReactDOMInput', function() {

it('should throw if both checked and checkedLink are provided', function() {
var node = document.createElement('div');
var link = new ReactLink(true, jest.genMockFn());
var link = new ReactLink(true, jest.fn());
var instance = <input type="checkbox" checkedLink={link} />;

expect(() => ReactDOM.render(instance, node)).not.toThrow();
Expand All @@ -401,7 +401,7 @@ describe('ReactDOMInput', function() {

it('should throw if both checkedLink and valueLink are provided', function() {
var node = document.createElement('div');
var link = new ReactLink(true, jest.genMockFn());
var link = new ReactLink(true, jest.fn());
var instance = <input type="checkbox" checkedLink={link} />;

expect(() => ReactDOM.render(instance, node)).not.toThrow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ describe('ReactDOMSelect', function() {
});

it('should support ReactLink', function() {
var link = new ReactLink('giraffe', jest.genMockFn());
var link = new ReactLink('giraffe', jest.fn());
var stub =
<select valueLink={link}>
<option value="monkey">A monkey!</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ describe('ReactDOMTextarea', function() {
});

it('should support ReactLink', function() {
var link = new ReactLink('yolo', jest.genMockFn());
var link = new ReactLink('yolo', jest.fn());
var instance = <textarea valueLink={link} />;

spyOn(console, 'error');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('ReactServerRendering', function() {

it('should not register event listeners', function() {
var EventPluginHub = require('EventPluginHub');
var cb = jest.genMockFn();
var cb = jest.fn();

ReactServerRendering.renderToString(
<span onClick={cb}>hello world</span>
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('ReactServerRendering', function() {

it('should not register event listeners', function() {
var EventPluginHub = require('EventPluginHub');
var cb = jest.genMockFn();
var cb = jest.fn();

ReactServerRendering.renderToString(
<span onClick={cb}>hello world</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ describe('DOMPropertyOperations', function() {
});

it('should use mutation method where applicable', function() {
var foobarSetter = jest.genMockFn();
var foobarSetter = jest.fn();
// inject foobar DOM property
DOMProperty.injection.injectDOMPropertyConfig({
Properties: {foobar: null},
Expand Down
18 changes: 9 additions & 9 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,11 @@ describe('ReactDOMComponent', function() {

var node = container.firstChild;
var nodeSetAttribute = node.setAttribute;
node.setAttribute = jest.genMockFn();
node.setAttribute = jest.fn();
node.setAttribute.mockImpl(nodeSetAttribute);

var nodeRemoveAttribute = node.removeAttribute;
node.removeAttribute = jest.genMockFn();
node.removeAttribute = jest.fn();
node.removeAttribute.mockImpl(nodeRemoveAttribute);

ReactDOM.render(<div id="" />, container);
Expand Down Expand Up @@ -488,7 +488,7 @@ describe('ReactDOMComponent', function() {

var node = container.firstChild;
var nodeValue = ''; // node.value always returns undefined
var nodeValueSetter = jest.genMockFn();
var nodeValueSetter = jest.fn();
Object.defineProperty(node, 'value', {
get: function() {
return nodeValue;
Expand Down Expand Up @@ -519,7 +519,7 @@ describe('ReactDOMComponent', function() {

var node = container.firstChild;
var nodeValue = true;
var nodeValueSetter = jest.genMockFn();
var nodeValueSetter = jest.fn();
Object.defineProperty(node, 'checked', {
get: function() {
return nodeValue;
Expand Down Expand Up @@ -552,7 +552,7 @@ describe('ReactDOMComponent', function() {
var container = document.createElement('div');
var node = ReactDOM.render(<div />, container);

var setter = jest.genMockFn();
var setter = jest.fn();
node.setAttribute = setter;

ReactDOM.render(<div dir={null} />, container);
Expand Down Expand Up @@ -839,8 +839,8 @@ describe('ReactDOMComponent', function() {
it('should execute custom event plugin listening behavior', function() {
var SimpleEventPlugin = require('SimpleEventPlugin');

SimpleEventPlugin.didPutListener = jest.genMockFn();
SimpleEventPlugin.willDeleteListener = jest.genMockFn();
SimpleEventPlugin.didPutListener = jest.fn();
SimpleEventPlugin.willDeleteListener = jest.fn();

var container = document.createElement('div');
ReactDOM.render(
Expand All @@ -858,8 +858,8 @@ describe('ReactDOMComponent', function() {
it('should handle null and missing properly with event hooks', function() {
var SimpleEventPlugin = require('SimpleEventPlugin');

SimpleEventPlugin.didPutListener = jest.genMockFn();
SimpleEventPlugin.willDeleteListener = jest.genMockFn();
SimpleEventPlugin.didPutListener = jest.fn();
SimpleEventPlugin.willDeleteListener = jest.fn();
var container = document.createElement('div');

ReactDOM.render(<div onClick={false} />, container);
Expand Down
Loading