UNPKG

@storm-software/testing-tools

Version:

⚡ A package containing various testing tools used by Storm workspaces to drive unit and e2e testing.

36 lines (33 loc) 1.1 kB
import type { Config } from "jest"; import { join } from "node:path"; /** * Config for Jest unit tests * * https://jestjs.io/docs/configuration#projects-arraystring--projectconfig */ /** * Config for Jest unit tests * * @remarks Please see [the Jest documentation](https://jestjs.io/docs/configuration#projects-arraystring--projectconfig) for more information. * * @param projectDir The directory of the project * @param isNode Whether the project is a Node project * @param displayName The name to display in the Jest output * @returns The Jest configuration */ export const getJestConfig = ( projectDir: string, isNode = true, displayName?: string, ): Config => ({ displayName: displayName ? displayName : projectDir.replaceAll("\\", "-").replaceAll("/", "-"), preset: "@storm-software/testing-tools/jest/preset.js", testEnvironment: isNode ? "node" : "jsdom", transform: { "^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }], }, moduleFileExtensions: ["ts", "js", "html"], coverageDirectory: join("../../coverage", projectDir), });