fleet/frontend/test/jest.config.ts
Gabriel Hernandez 73d287eaeb
update msw (mock service worker) package to 2.5.1 (#23480)
relates to #23128

updates mock service worker package as it was using a version of
`path-to-regexp` that had a high security vulnerability. This updated
version of msw uses a newer version of the package that does not have
this vulnerability

I had to add the `jest-fixed-dom` package to update msw as well as
update our version of typescript to 4.7
2024-11-05 10:13:30 -06:00

57 lines
1.5 KiB
TypeScript

import type { Config } from "jest";
const esModules = [
"react-markdown",
"vfile",
"vfile-message",
"micromark.+",
"unist-.+",
"unified",
"bail",
"is-plain-obj",
"trough",
"remark-.+",
"mdast-util-.+",
"parse-entities",
"character-entities",
"property-information",
"comma-separated-tokens",
"hast-util-whitespace",
"remark-.+",
"space-separated-tokens",
"decode-named-character-reference",
"ccount",
"escape-string-regexp",
"markdown-table",
"trim-lines",
].join("|");
const config: Config = {
rootDir: "../../",
moduleDirectories: ["node_modules", "frontend"],
testEnvironment: "jest-fixed-jsdom",
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/frontend/__mocks__/fileMock.js",
"\\.(css|scss|sass)$": "identity-obj-proxy",
// "react-markdown":
// "<rootDir>/node_modules/react-markdown/react-markdown.min.js",
// "remark-gfm": "<rootDir>/node_modules/remark-gfm/index.js",
// "micromark-extension-gfm":
// "<rootDir>/node_models/micromark-extension-gfm/index.js",
},
testMatch: ["**/*tests.[jt]s?(x)"],
setupFilesAfterEnv: ["<rootDir>/frontend/test/test-setup.ts"],
clearMocks: true,
testEnvironmentOptions: {
url: "http://localhost:8080",
customExportConditions: [""],
},
// transformIgnorePatterns: ["node_modules/(?!react-markdown/)"],
transformIgnorePatterns: [`/node_modules/(?!(${esModules})/)`],
globals: {
TransformStream,
},
};
export default config;