jsdom-ts-cjs
jsdom-ts-cjs runs TypeScript tests as CommonJS in the jsdom environment. ts-jest transforms TypeScript, and
jest-esm-transformer-2 transforms JavaScript, including ESM packages in node_modules.
module.exports = { preset: '@repobuddy/jest/presets/jsdom-ts-cjs',}Options
Section titled “Options”None. A preset takes no options.
Effective config
Section titled “Effective config”Printed from the built preset, in a directory that has a src folder:
{ transform: { '^.+\\.(ts|tsx|cts|mts)$': ['ts-jest', { isolatedModules: true }], '\\.m?jsx?$': 'jest-esm-transformer-2', }, transformIgnorePatterns: [], collectCoverageFrom: [ '<rootDir>/src/**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}', '!<rootDir>/src/**/*.stories.*', ], roots: ['<rootDir>/src'], testEnvironment: 'jsdom', testMatch: [ '**/?*\\.(spec|test|unit|accept|integrate|learning|system|perf|stress)?(.jsdom).(js|jsx|cjs|mjs|ts|tsx|cts|mts)', ],}It is built from configs.tsCjs,
configs.configSource(), and
configs.jsdom.
Packages it needs
Section titled “Packages it needs”extract.extractPackages() on the preset returns:
['jest-environment-jsdom', 'jest-esm-transformer-2', 'ts-jest']@repobuddy/jest does not declare jest-environment-jsdom. Install it yourself. ts-jest also needs typescript.
Behavior
Section titled “Behavior”- Same transforms as
ts-cjs, includingtransformIgnorePatterns: []. - Uses
testMatchinstead oftestRegex. See test file names. - Sets no
coveragePathIgnorePatterns. Jest skips test files from coverage on its own.
jsdom-ts-cjs-watch variant
Section titled “jsdom-ts-cjs-watch variant”@repobuddy/jest/presets/jsdom-ts-cjs-watch is jsdom-ts-cjs plus the watch plugins of the
watch preset.
Examples
Section titled “Examples”module.exports = { preset: '@repobuddy/jest/presets/jsdom-ts-cjs-watch',}