moonfire-nvr/ui/jest.config.ts
Scott Lamb 24880a5c2d switch from create-react-app to vite
create-react-app is apparently deprecated, so the cool kids use vite,
I guess.
2023-12-18 17:08:09 -08:00

37 lines
1012 B
TypeScript

// This file is part of Moonfire NVR, a security camera network video recorder.
// Copyright (C) 2023 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
import type { Config } from "jest";
const config: Config = {
testEnvironment: "./FixJSDomEnvironment.ts",
transform: {
// https://github.com/swc-project/jest
"\\.[tj]sx?$": [
"@swc/jest",
{
// https://swc.rs/docs/configuration/compilation
// https://github.com/swc-project/jest/issues/167#issuecomment-1809868077
jsc: {
transform: {
react: {
runtime: "automatic",
},
},
},
},
],
},
setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"],
// https://github.com/jaredLunde/react-hook/issues/300#issuecomment-1845227937
moduleNameMapper: {
"@react-hook/(.*)": "<rootDir>/node_modules/@react-hook/$1/dist/main",
},
};
export default config;