Module ... in the snapshotSerializers option was not found

Viewed 414

I'm trying to add custom serializer in Jest (with Jest docs). And I have an error: "Module custom-serializer in the snapshotSerializers option was not found.".

I tried custom-serializer.js, but this also doesn't work.

Project structure:

src
  ...
  node_modules
  utils
    custom-serializer.js
  jest.config.json
  ...

jest.config.json:

{
  "verbose": true,
  "testEnvironment": "jsdom",
  "testMatch": [
    "**/tests/**/*.js"
  ],
  "moduleDirectories": [
    "node_modules",
    "utils"
  ],
  "snapshotSerializers": [
    "custom-serializer"
  ]
}
0 Answers
Related