diff --git a/fixtures/behavior/builds-with-multiple-runtimes/package.json b/fixtures/behavior/builds-with-multiple-runtimes/package.json deleted file mode 100644 index a8cfdd29cce..00000000000 --- a/fixtures/behavior/builds-with-multiple-runtimes/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "builds-with-multiple-runtimes", - "description": "Tests that a build succeeds with multiple runtime versions", - "dependencies": { - "dva": "2.4.0", - "ky": "0.3.0" - } -} diff --git a/fixtures/output/jest.config.js b/fixtures/output/jest.config.js new file mode 100644 index 00000000000..fa718fa3ea3 --- /dev/null +++ b/fixtures/output/jest.config.js @@ -0,0 +1,5 @@ +module.exports = { + testEnvironment: 'node', + testMatch: ['**/*.test.js'], + setupTestFrameworkScriptFile: './setupOutputTests.js', +}; diff --git a/fixtures/output/setupOutputTests.js b/fixtures/output/setupOutputTests.js new file mode 100644 index 00000000000..b709406980f --- /dev/null +++ b/fixtures/output/setupOutputTests.js @@ -0,0 +1,6 @@ +beforeAll(() => { + jest.setTimeout(1000 * 60 * 5); +}); +beforeEach(() => { + jest.setTimeout(1000 * 60 * 5); +}); diff --git a/fixtures/output/webpack-message-formatting/__snapshots__/index.test.js.snap b/fixtures/output/webpack-message-formatting/__snapshots__/index.test.js.snap new file mode 100644 index 00000000000..923ae734dee --- /dev/null +++ b/fixtures/output/webpack-message-formatting/__snapshots__/index.test.js.snap @@ -0,0 +1,102 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`webpack message formatting formats babel syntax error 1`] = ` +Object { + "stderr": "Creating an optimized production build... +Failed to compile. + +./src/App.js +Syntax error: Unterminated JSX contents (8:12) + + 6 |
", - ], - "warnings": Array [], -} -`; - -exports[`formats various webpack errors correctly module not found 1`] = ` -Object { - "errors": Array [ - "[7m./template/src/App.js[27m -Module not found: Can't resolve 'blabla' in '/Users/joe/Documents/Development/OSS/create-react-app/packages/react-scripts/template/src'", - ], - "warnings": Array [ - "[7m./template/src/App.js[27m - [1mLine 5:[22m 'bla' is defined but never used [33m[4mno-unused-vars[24m[39m", - ], -} -`; diff --git a/packages/react-dev-utils/__tests__/formatWebpackMessages.test.js b/packages/react-dev-utils/__tests__/formatWebpackMessages.test.js deleted file mode 100644 index 8f19406b631..00000000000 --- a/packages/react-dev-utils/__tests__/formatWebpackMessages.test.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -'use strict'; - -const formatWebpackMessages = require('../formatWebpackMessages'); - -// TODO: test these messages by actually running a build so we can validate -// webpack upgrades didn't break any of our massaging -// https://github.com/facebook/create-react-app/pull/5137 -describe('formats various webpack errors correctly', () => { - it('invalid js syntax (babel)', () => { - const json = { - errors: [ - './template/src/App.js\nModule Error (from /Users/joe/Documents/Development/OSS/create-react-app/node_modules/thread-loader/dist/cjs.js):\n\n Line 10: Parsing error: Expected corresponding JSX closing tag for
\n\n\n @ ./template/src/index.js 1:77-100 1:182-185\n @ multi ./config/polyfills.js ./template/src/index.js', - './template/src/App.js\nModule build failed (from /Users/joe/Documents/Development/OSS/create-react-app/node_modules/thread-loader/dist/cjs.js):\nThread Loader (Worker 0)\n/Users/joe/Documents/Development/OSS/create-react-app/packages/react-scripts/template/src/App.js: Expected corresponding JSX closing tag for
\n\n at _class.raise (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:779:15)\n at _class.jsxParseElementAt (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:8111:18)\n at _class.jsxParseElement (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:8137:19)\n at _class.parseExprAtom (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:8144:21)\n at _class.parseExprSubscripts (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:2758:21)\n at _class.parseMaybeUnary (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:2737:21)\n at _class.parseExprOps (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:2646:21)\n at _class.parseMaybeConditional (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:2618:21)\n at _class.parseMaybeAssign (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:2565:21)\n at _class.parseMaybeAssign (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/@babel/core/node_modules/babylon/lib/index.js:7270:57)\n @ ./template/src/index.js 1:77-100 1:182-185\n @ multi ./config/polyfills.js ./template/src/index.js',
- ],
- warnings: [],
- };
-
- expect(formatWebpackMessages(json)).toMatchSnapshot();
- });
-
- it('invalid css syntax', () => {
- const json = {
- errors: [
- './template/src/App.css\nModule build failed (from /Users/joe/Documents/Development/OSS/create-react-app/node_modules/mini-css-extract-plugin/dist/loader.js):\nModuleBuildError: Module build failed (from /Users/joe/Documents/Development/OSS/create-react-app/node_modules/postcss-loader/lib/index.js):\nSyntax Error \n\n(19:1) Unexpected }\n\n 17 | font-size: calc(10px + 2vmin);\n 18 | color: white;\n> 19 | }\n | ^\n 20 | \n 21 | .App-link {\n\n at runLoaders (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/webpack/lib/NormalModule.js:286:20)\n at /Users/joe/Documents/Development/OSS/create-react-app/node_modules/loader-runner/lib/LoaderRunner.js:364:11\n at /Users/joe/Documents/Development/OSS/create-react-app/node_modules/loader-runner/lib/LoaderRunner.js:230:18\n at context.callback (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)\n at Promise.resolve.then.then.catch (/Users/joe/Documents/Development/OSS/create-react-app/node_modules/postcss-loader/lib/index.js:194:44)\n at