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

Jest issue? #253

Closed
m0ngr31 opened this issue Jul 27, 2021 · 2 comments
Closed

Jest issue? #253

m0ngr31 opened this issue Jul 27, 2021 · 2 comments

Comments

@m0ngr31
Copy link

m0ngr31 commented Jul 27, 2021

Describe the bug

Trying to run Jest tests creates an error:

 ● Test suite failed to run

    Styles were unable to be assigned to a file. This is generally caused by one of the following:

    - You may have created styles outside of a '.css.ts' context
    - You may have incorrect configuration. See https://vanilla-extract.style/documentation/setup

      1 | import { style } from '@vanilla-extract/css';
      2 |
    > 3 | export const button = style({
.....

I've tried using import '@vanilla-extract/css/disableRuntimeStyles' in my setupFilesAfterEnv file, but it doesn't seem to effect anything. I followed the webpack tutorial, and everything else seems to be working. Just broken on unit tests.

System Info

Output of npx envinfo --system --npmPackages @vanilla-extract/css,@vanilla-extract/webpack-plugin,@vanilla-extract/esbuild-plugin,@vanilla-extract/vite-plugin,@vanilla-extract/sprinkles,webpack,esbuild,vite --binaries --browsers:

 System:
    OS: macOS 11.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 1.43 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.1 - ~/.nvm/versions/node/v14.17.1/bin/node
    npm: 7.19.0 - ~/.nvm/versions/node/v14.17.1/bin/npm
  Browsers:
    Chrome: 91.0.4472.114
    Firefox: 90.0
    Safari: 14.1.1
  npmPackages:
    @vanilla-extract/css: ^1.1.2 => 1.1.2
    @vanilla-extract/webpack-plugin: ^1.0.3 => 1.0.3
    webpack: ^5.11.1 => 5.44.
@mattcompiles
Copy link
Contributor

Have you added the @vanilla-extract/babel-plugin to your babel config for your tests? Outside of that impossible to say without a reproduction.

@m0ngr31
Copy link
Author

m0ngr31 commented Jul 27, 2021

Turns out I'm just an idiot 🤦. I was using ts-jest instead of babel-jest.

@m0ngr31 m0ngr31 closed this as completed Jul 27, 2021
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

No branches or pull requests

2 participants