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

Test suite is breaking with react-bootstrap #406

Closed
flavioribeiro opened this issue Feb 20, 2017 · 3 comments · Fixed by #414
Closed

Test suite is breaking with react-bootstrap #406

flavioribeiro opened this issue Feb 20, 2017 · 3 comments · Fixed by #414

Comments

@flavioribeiro
Copy link
Contributor

kyt version: 0.4.0
react-bootstrap version: 0.30.7

When trying to run the tests with $ npm run test I see the following error:

flv@nyt ~/Development/kyt-and-react-bootstrap-bug ⚡ npm run test

> @1.0.0 test /Users/207112/Development/kyt-and-react-bootstrap-bug
> kyt test


ℹ️  Using kyt config at /Users/207112/Development/kyt-and-react-bootstrap-bug/kyt.config.js
 PASS  components/Home/index.test.js
 PASS  components/Tools/index.test.js
 FAIL  components/App/index.test.js
  ● Test suite failed to run

    TypeError: styles.forEach is not a function

      at ../node_modules/react-bootstrap/lib/utils/bootstrapUtils.js:70:10
      at ../node_modules/react-bootstrap/lib/utils/bootstrapUtils.js:38:17
      at Object.<anonymous> (../node_modules/react-bootstrap/lib/Alert.js:125:51)
      at Object.<anonymous> (../node_modules/react-bootstrap/lib/index.js:10:15)

Test Suites: 1 failed, 2 passed, 3 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        1.275s
Ran all test suites.

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/Cellar/node/7.5.0/bin/node" "/usr/local/bin/npm" "run" "test"
npm ERR! node v7.5.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! @1.0.0 test: `kyt test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @1.0.0 test script 'kyt test'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     kyt test
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/207112/Development/kyt-and-react-bootstrap-bug/npm-debug.log

How to Reproduce?

I created a repo using the universal starter kyt, installed react-bootstrap with npm install --save react-bootstrap and included a react component to the App as shown here. It's important to note that I have no issues when running the app (npm run dev) and rendering the components.

@delambo
Copy link
Member

delambo commented Feb 21, 2017

Hey, @flavioribeiro - I played around with this a bit and I think I found the problem. I'm not sure if this is a good long term solution, but if you're blocked, you can add this modifyJestConfig callback to your kyt.config.js file:

  modifyJestConfig: (config) => {
    if (config.moduleNameMapper['babel-runtime']) {
      delete config.moduleNameMapper['babel-runtime'];
    }
    return config;
  }

@tizmagik - Do you think it's safe to remove the babel runtime plugin now? https://github.com/NYTimes/kyt/blob/master/packages/kyt-core/config/jest.js#L16

@flavioribeiro
Copy link
Contributor Author

thanks @delambo! your snippet fixes my build. Should I close this or wait for a fix on your side?

@tizmagik
Copy link
Contributor

@delambo it might be safe to remove it now? Although I think we originally added it because Jest 16 at the time needed it to run on our codebase for our internal project. We can try removing it and seeing if we have any issues locally. I think Jest 19 handles things a bit better so hopefully this wrinkle goes away with #394

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants