Jest to vitest migration error; equivalent of moduleNameMapper

Viewed 47

I am trying to migrate from jest to vitest. at some point I get this error : Syntax Error: Invalid or unexpected token

It seems one of the packages we have in project has this line that causes the issue:

require("./lib/somefont.woff")

I checked jest and jest has this line which resolved the issue:

"moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
      "\\.(css|less|scss|sass)$": "identity-obj-proxy"
    },

I was wondering how I can resolve the issue in vitest? is there an equivalent of moduleNameMapper in vitest?

0 Answers
Related