Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run 90% of tests on compiled bundles (both development and production) #11633

Merged
merged 23 commits into from
Nov 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ed4b018
Extract Jest config into a separate file
gaearon Nov 22, 2017
e944d7e
Refactor Jest scripts directory structure
gaearon Nov 22, 2017
18dbd55
Add yarn test-bundles and yarn test-prod-bundles
gaearon Nov 22, 2017
8e6e601
Fix error decoding for production bundles
gaearon Nov 23, 2017
ef4b581
Build production version of react-noop-renderer
gaearon Nov 23, 2017
6d03d8d
Switch to blacklist (exclude .private.js tests)
gaearon Nov 23, 2017
936e500
Rename tests that are currently broken against bundles to *-test.inte…
gaearon Nov 23, 2017
7409c6a
Add bundle tests to CI
gaearon Nov 23, 2017
f05ff6b
Split private and public ReactJSXElementValidator tests
gaearon Nov 23, 2017
95a356e
Remove internal deps from ReactServerRendering-test and make it public
gaearon Nov 23, 2017
cb26615
Only run tests directly in __tests__
gaearon Nov 23, 2017
0a90485
Remove ExecutionEnvironment dependency from DOMServerIntegrationTest
gaearon Nov 23, 2017
0df06f4
Split up ReactDOMServerIntegration into test suite and utilities
gaearon Nov 23, 2017
8a35e3b
Split Fragment tests from other DOMServerIntegration tests
gaearon Nov 23, 2017
96ccaf1
Split ReactDOMServerIntegration into different test files
gaearon Nov 23, 2017
3fb1d4a
Don't reset the cache twice in DOMServerIntegration tests
gaearon Nov 23, 2017
c14cae5
Rename test-bundles* commands to test-build*
gaearon Nov 23, 2017
0ecf429
Use regenerator polyfill for react-noop
gaearon Nov 23, 2017
40ea898
Run most Incremental tests against bundles
gaearon Nov 23, 2017
111bab1
Update sizes
gaearon Nov 23, 2017
ef69681
Fix ReactMount test
gaearon Nov 23, 2017
4da70e7
Enable ReactDOMComponent test
gaearon Nov 23, 2017
8888c46
Fix a warning issue uncovered by flat bundle testing
gaearon Nov 23, 2017
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
37 changes: 6 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"babel-plugin-transform-es3-property-literals": "^6.5.0",
"babel-plugin-transform-object-rest-spread": "^6.6.5",
"babel-plugin-transform-react-jsx-source": "^6.8.0",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-preset-react": "^6.5.0",
"babel-traverse": "^6.9.0",
"babylon": "6.15.0",
Expand Down Expand Up @@ -103,40 +104,14 @@
"linc": "node ./scripts/tasks/linc.js",
"lint": "node ./scripts/tasks/eslint.js",
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
"test": "cross-env NODE_ENV=development jest",
"test-prod": "cross-env NODE_ENV=production jest",
"test": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source.js",
"test-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source.js",
"test-prod-build": "yarn test-build-prod",
"test-build": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.build.js",
"test-build-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.build.js",
"flow": "node ./scripts/tasks/flow.js",
"prettier": "node ./scripts/prettier/index.js write-changed",
"prettier-all": "node ./scripts/prettier/index.js write",
"version-check": "node ./scripts/tasks/version-check.js"
},
"jest": {
"modulePathIgnorePatterns": [
"<rootDir>/scripts/rollup/shims/",
"<rootDir>/scripts/bench/"
],
"transform": {
".*": "./scripts/jest/preprocessor.js"
},
"setupFiles": [
"./scripts/jest/environment.js"
],
"setupTestFrameworkScriptFile": "./scripts/jest/test-framework-setup.js",
"testRegex": "/__tests__/.*(\\.js|\\.coffee|[^d]\\.ts)$",
"moduleFileExtensions": [
"js",
"json",
"node",
"coffee",
"ts"
],
"roots": [
"<rootDir>/packages",
"<rootDir>/scripts"
],
"collectCoverageFrom": [
"packages/**/*.js"
],
"timers": "fake"
}
}
33 changes: 24 additions & 9 deletions packages/react-dom/src/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1709,15 +1709,25 @@ describe('ReactDOMComponent', () => {
it('should warn about incorrect casing on event handlers (ssr)', () => {
spyOnDev(console, 'error');
ReactDOMServer.renderToString(
React.createElement('input', {type: 'text', onclick: '1'}),
React.createElement('input', {type: 'text', oninput: '1'}),
);
ReactDOMServer.renderToString(
React.createElement('input', {type: 'text', onKeydown: '1'}),
);
if (__DEV__) {
expect(console.error.calls.count()).toBe(2);
expect(console.error.calls.argsFor(0)[0]).toContain('onClick');
expect(console.error.calls.argsFor(1)[0]).toContain('onKeyDown');
expect(console.error.calls.count()).toBe(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
'Invalid event handler property `oninput`. ' +
'React events use the camelCase naming convention, ' +
// Note: we don't know the right event name so we
// use a generic one (onClick) as a suggestion.
// This is because we don't bundle the event system
// on the server.
'for example `onClick`.',
);
// We can't warn for `onKeydown` on the server because
// there is no way tell if this is a valid event or not
// without access to the event system (which we don't bundle).
}
});

Expand All @@ -1735,14 +1745,14 @@ describe('ReactDOMComponent', () => {
it('should warn about incorrect casing on event handlers', () => {
spyOnDev(console, 'error');
ReactTestUtils.renderIntoDocument(
React.createElement('input', {type: 'text', onclick: '1'}),
React.createElement('input', {type: 'text', oninput: '1'}),
);
ReactTestUtils.renderIntoDocument(
React.createElement('input', {type: 'text', onKeydown: '1'}),
);
if (__DEV__) {
expect(console.error.calls.count()).toBe(2);
expect(console.error.calls.argsFor(0)[0]).toContain('onClick');
expect(console.error.calls.argsFor(0)[0]).toContain('onInput');
expect(console.error.calls.argsFor(1)[0]).toContain('onKeyDown');
}
});
Expand Down Expand Up @@ -1860,15 +1870,20 @@ describe('ReactDOMComponent', () => {
it('gives source code refs for unknown prop warning (ssr)', () => {
spyOnDev(console, 'error');
ReactDOMServer.renderToString(<div class="paladin" />);
ReactDOMServer.renderToString(<input type="text" onclick="1" />);
ReactDOMServer.renderToString(<input type="text" oninput="1" />);
if (__DEV__) {
expect(console.error.calls.count()).toBe(2);
expect(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
);
expect(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
'Warning: Invalid event handler property `onclick`. Did you mean ' +
'`onClick`?\n in input (at **)',
'Warning: Invalid event handler property `oninput`. ' +
// Note: we don't know the right event name so we
// use a generic one (onClick) as a suggestion.
// This is because we don't bundle the event system
// on the server.
'React events use the camelCase naming convention, for example `onClick`.' +
'\n in input (at **)',
);
}
});
Expand Down
Loading