diff --git a/jest.config.js b/jest.config.js index 19a27a53a..ffc6a9ad6 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,7 +4,7 @@ module.exports = { watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"], transform: { "^.+\\.[t|j]sx?$": "babel-jest", - "\\.(html|xml|svg)$": "jest-raw-loader", + "\\.(html|xml|svg)$": "/webpack/jest-raw-loader.js", }, moduleNameMapper: { "\\.(css|less|sass|scss)$": "identity-obj-proxy", diff --git a/package.json b/package.json index 226a04fca..c9d294bce 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "inspectpack": "^4.7.1", "jest": "^28.1.0", "jest-environment-jsdom": "^28.1.0", - "jest-raw-loader": "^1.0.1", "jest-watch-typeahead": "^1.1.0", "prettier": "^2.6.2", "regenerator-runtime": "^0.13.9", diff --git a/webpack/jest-raw-loader.js b/webpack/jest-raw-loader.js new file mode 100644 index 000000000..23103f8e8 --- /dev/null +++ b/webpack/jest-raw-loader.js @@ -0,0 +1,9 @@ +// jest-raw-loader compatibility with Jest version 28. +// See: https://github.com/keplersj/jest-raw-loader/pull/239 +module.exports = { + process: (content) => { + return { + code: "module.exports = " + JSON.stringify(content), + }; + }, +};