Skip to content

Tests are using code from npm instead of code from pull request #5440

Closed

Description

@brunolemos

Possibly a regression from 5fecfee.
Blocking #4837.

Is this a bug report?

Yes

Environment

System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Binaries:
Node: 8.11.4 - /usr/local/bin/node
Yarn: 1.10.1 - ~/.yarn/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 69.0.3497.100
Firefox: 59.0.2
Safari: 12.0
npmPackages:
@stiligita/react: 1.0.0-0
@types/react: 16.4.14
@types/react-dom: 16.0.8
react: 16.5.2
react-dom: 16.5.2
react-scripts: 2.0.5 (#4837)
npmGlobalPackages:
create-react-app: Not Found (#4837)

Steps to Reproduce

  • Fork TypeScript support using Babel 7 #4837
  • Run CI=false npx jest --config ./test/jest.config.js --testMatch '<rootDir>/**/typescript/*.test.js' (pass)
  • Run CI=true npx jest --config ./test/jest.config.js --testMatch '<rootDir>/**/typescript/*.test.js' (fail)

Expected Behavior

Tests should pass because they are correct.
CRA should use the current code of each pull request, not a version from npm.

Actual Behavior

TypeScript tests fails because it tries to use the cra version from npm, which doesn't support typescript.

Reproducible Demo

#4837

Possibly related code

https://github.com/facebook/create-react-app/blob/f89385f7438f39750b762590ebd9729534e30190/test/fixtures/__shared__/util/setup.js#L18

https://github.com/facebook/create-react-app/blob/f89385f7438f39750b762590ebd9729534e30190/test/fixtures/__shared__/util/setup.js#L37-L42

Activity

  1. changed the title [-]Regression: Tests are using code from npm instead of code from pull request[/-] [+]Tests are using code from npm instead of code from pull request[/+] on Oct 15, 2018
  2. Timer commented on Oct 15, 2018

    @Timer
    Contributor

    The tests are supposed to be using code from "npm" because the PR is published before the test are ran:
    https://github.com/facebook/create-react-app/blob/f89385f7438f39750b762590ebd9729534e30190/tasks/e2e-behavior.sh#L90-L100

    I suspect our registry override might be wiped out, or similar.

  3. Timer commented on Oct 15, 2018

    @Timer
    Contributor

    https://travis-ci.org/facebook/create-react-app/jobs/441577719#L606-L709 this looks suspicious. Nothing but yarn.lock should be removed.

  4. brunolemos commented on Oct 15, 2018

    @brunolemos
    ContributorAuthor

    I made the wrong diagnostic about the problem because locally I ran jest directly so it didn't make this publish to the local npm.

    I added a console.log to see the real test error on travis: https://travis-ci.org/facebook/create-react-app/jobs/441692012#L787-L797 (btw I wish it showed this by default):

     FAIL  fixtures/typescript/index.test.js (25.768s)
      ● Console
        console.error fixtures/typescript/index.test.js:7
          { Error: Command failed: yarnpkg test --env node --ci
          FAIL src/App.test.ts
            ● Test suite failed to run
          
              Cannot find module './App' from 'App.test.ts'
          
              > 1 | import App from './App';

    It loaded App.test.ts so it's using the correct code from the PR.
    But App.test.ts is not being able to import ./App which is weird.

  5. brunolemos commented on Oct 15, 2018

    @brunolemos
    ContributorAuthor

    Adding .disable-pnp fixed it 🤔🎉

  6. Timer commented on Oct 15, 2018

    @Timer
    Contributor

    Hmm, I'd like to figure out why this doesn't work with PnP (it should).

  7. locked and limited conversation to collaborators on Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions