cssinjs/jss

[react-jss] Jest tests error

Open

#1.395 aberto em 23 de set. de 2020

Ver no GitHub
 (7 comments) (10 reactions) (0 assignees)JavaScript (7.000 stars) (434 forks)batch import
help wantedquestion

Description

Problem with testing react with jest. I am getting this error whenever I use jss in a component.

Screenshot from 2020-09-23 17-41-26

Also i have a valid config for jest:

{
  "moduleDirectories": [
    "node_modules",
    "src"
  ],
  "moduleFileExtensions": [
    "ts",
    "tsx",
    "js",
    "jsx",
    "json",
    "node"
  ],
  "moduleNameMapper": {
    "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|pdf)$": "identity-obj-proxy"
  },
  "preset": "ts-jest",
  "roots": [
    "<rootDir>/src"
  ],
  "setupFilesAfterEnv": [
    "<rootDir>/src/setupTests.js"
  ],
  "testEnvironment": "jsdom",
  "testMatch": [
    "<rootDir>/src/**/__tests__/**/*.{ts,tsx}",
    "<rootDir>/src/**/*(*.)(spec|test).{ts,tsx}",
    "<rootDir>/test/**/*.{ts,tsx}",
    "<rootDir>/test/**/?(*.)(spec|test).{ts,tsx}"
  ],
  "transform": {
    "^.+\\.tsx?$": "ts-jest",
    "^.+\\.jsx?$": "babel-jest"
  },
  "verbose": true
}

Guia do colaborador