2020/01/13 CreateReactApp

CreateReactAppのテスト動かす

github.com

masterはCIコケてるので3.3.0タグで

git checkout -b 3.3.0 v3.3.0
yarn
yarn test

pass

create-react-app/test at master · facebook/create-react-app · GitHub

cd packages/react-scripts/ && yarn link; cd ../../test/ && ../node_modules/.bin/jest --watchAll
 PASS  fixtures/issue-5947-not-typescript/index.test.js
 PASS  fixtures/mjs-support/index.test.js (53.148s)
 PASS  fixtures/typescript-typecheck/index.test.js (49.245s)
 PASS  fixtures/relative-paths/index.test.js (10.431s)
 FAIL  fixtures/typescript-advanced/index.test.js (46.686s)
  ● builds in development

    expect(received).toBe(expected) // Object.is equality

    Expected: true
    Received: false

      3 | test('builds in development', async () => {
      4 |   const { fulfilled } = await testSetup.scripts.start({ smoke: true });
    > 5 |   expect(fulfilled).toBe(true);
        |                     ^
      6 | });
      7 | test('builds in production', async () => {
      8 |   const { fulfilled } = await testSetup.scripts.build();

      at Object.<anonymous> (fixtures/typescript-advanced/index.test.js:5:21)

 PASS  fixtures/node_path/index.test.js (42.694s)
 PASS  fixtures/boostrap-sass/index.test.js (10.628s)
 PASS  fixtures/issue-5176-flow-class-properties/index.test.js (8.218s)
 FAIL  fixtures/webpack-message-formatting/index.test.js (123.476s)
  ● helps when users tries to use sass

    expect(received).toMatchSnapshot()

    Snapshot name: `helps when users tries to use sass 1`

    - Snapshot
    + Received

    @@ -3,10 +3,22 @@
      Failed to compile.
      
      ./src/AppSass.scss
      To import Sass files, you first need to install node-sass.
      Run `npm install node-sass` or `yarn add node-sass` inside your workspace.
    + Require stack:
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/sass-loader/dist/getDefaultSassImplementation.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/sass-loader/dist/getSassImplementation.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/sass-loader/dist/index.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/sass-loader/dist/cjs.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/loader-runner/lib/loadLoader.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/loader-runner/lib/LoaderRunner.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/webpack/lib/NormalModule.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/webpack/lib/NormalModuleFactory.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/webpack/lib/Compiler.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/node_modules/webpack/lib/webpack.js
    + - /home/yokomotod/workspace/yokomotod/create-react-app/packages/react-scripts/scripts/build.js
      
      
      ",
        "stdout": "",
      }

       98 | 
       99 |   const { stdout, stderr } = await testSetup.scripts.build();
    > 100 |   expect({ stdout, stderr }).toMatchSnapshot();
          |                              ^
      101 | });
      102 | 
      103 | test('formats file not found error', async () => {

      at Object.<anonymous> (fixtures/webpack-message-formatting/index.test.js:100:30)

 › 1 snapshot failed.
 PASS  fixtures/typescript/index.test.js (5.853s)
 PASS  fixtures/builds-with-multiple-runtimes/index.test.js (36.341s)

Snapshot Summary
 › 1 snapshot failed from 1 test suite. Inspect your code changes or press `u` to update them.

Test Suites: 2 failed, 9 passed, 11 total
Tests:       2 failed, 28 passed, 30 total
Snapshots:   1 failed, 12 passed, 13 total
Time:        142.977s

コケる・・・

$ grep -r "Require stack" ../node_modules/
../node_modules/eslint/lib/shared/relative-module-resolver.js:                error.message += `\nRequire stack:\n- ${relativeToPath}`;

エラーメッセージがeslintから出てきてるっぽい・・・? 根が深そう

yarn e2e:docker

こっちもコケる・・・