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

styled-jsx and jest could not run in Next@6 #4501

Closed
blackbing opened this issue May 30, 2018 · 4 comments
Closed

styled-jsx and jest could not run in Next@6 #4501

blackbing opened this issue May 30, 2018 · 4 comments

Comments

@blackbing
Copy link

blackbing commented May 30, 2018

Bug report

Describe the bug

This is a smallest reproduce example of styled-jsx-scss+jest problem. It is worked on next@5.1.0 In my project, but when upgrading to next@6, it will broke jest test. so I create an example to reproduce this problem.

Here is a repo:
https://github.com/blackbing/next-with-jest-style-jsx-error

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. clone this https://github.com/blackbing/next-with-jest-style-jsx-error
  2. yarn test

Expected behavior

jest pass

System information

  • OS: macOS
  • node: 8.11.2(10 could reproduce too)
  • Version of Next.js: 6.0.3

Additional context

$ NODE_ENV=test jest
 FAIL  __tests__/index.test.js
  With Enzyme
    ✕ App shows "Hello world!" (9ms)
  With Snapshot Testing
    ✕ App shows "Hello world!" (10ms)

  ● With Enzyme › App shows "Hello world!"

    ReferenceError: style is not defined

      2 |
      3 | export default () => (
  > 4 |   <div className='hello'>
      5 |     <p>Hello World</p>
      6 |     <style jsx global>{style}</style>
      7 |   </div>

      at Object._default [as type] (pages/index.js:4:3)
      at Object.<anonymous> (__tests__/index.test.js:11:17)

  ● With Snapshot Testing › App shows "Hello world!"

    ReferenceError: style is not defined



      at _default (pages/index.js:21:10)
      at Object.<anonymous> (__tests__/index.test.js:22:48)
@blackbing
Copy link
Author

related to #4265

@JimLin94
Copy link

JimLin94 commented May 30, 2018

This is critical concern to me to jump into next6 as well!

@blackbing blackbing changed the title styled-jsx-scss and jest could not run in Next@6 styled-jsx and jest could not run in Next@6 May 31, 2018
@blackbing
Copy link
Author

@timneutkens
Copy link
Member

As the issue on styled-jsx was closed as fixed I'll close this issue.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants