presets
presets holds every preset as a plain config object. Each value is the same object the
@repobuddy/jest/presets/<name> entry exports as its default.
import { presets } from '@repobuddy/jest'Use it to read a preset’s values or to spread one into a config. To apply a preset, the preset key with the entry
path is the usual way.
Members
Section titled “Members”| Member | Entry | Page |
|---|---|---|
ts |
@repobuddy/jest/presets/ts |
ts |
tsWatch |
@repobuddy/jest/presets/ts-watch |
ts |
tsEsm |
@repobuddy/jest/presets/ts-esm |
ts-esm |
tsEsmWatch |
@repobuddy/jest/presets/ts-esm-watch |
ts-esm |
tsCjs |
@repobuddy/jest/presets/ts-cjs |
ts-cjs |
tsCjsWatch |
@repobuddy/jest/presets/ts-cjs-watch |
ts-cjs |
jsEsm |
@repobuddy/jest/presets/js-esm |
js-esm |
jsEsmWatch |
@repobuddy/jest/presets/js-esm-watch |
js-esm |
jsCjs |
@repobuddy/jest/presets/js-cjs |
js-cjs |
jsCjsWatch |
@repobuddy/jest/presets/js-cjs-watch |
js-cjs |
jsdomTs |
@repobuddy/jest/presets/jsdom-ts |
jsdom-ts |
jsdomTsWatch |
@repobuddy/jest/presets/jsdom-ts-watch |
jsdom-ts |
jsdomTsEsm |
@repobuddy/jest/presets/jsdom-ts-esm |
jsdom-ts-esm |
jsdomTsEsmWatch |
@repobuddy/jest/presets/jsdom-ts-esm-watch |
jsdom-ts-esm |
jsdomTsCjs |
@repobuddy/jest/presets/jsdom-ts-cjs |
jsdom-ts-cjs |
jsdomTsCjsWatch |
@repobuddy/jest/presets/jsdom-ts-cjs-watch |
jsdom-ts-cjs |
watch |
@repobuddy/jest/presets/watch |
watch |
Behavior
Section titled “Behavior”- Importing the main entry evaluates every preset.
ts,tsWatch,jsdomTs, andjsdomTsWatchreadpackage.jsonfrom the working directory, and every preset exceptwatchchecks for the source folder there. - The values are shared objects. Copy before you change one:
{ ...presets.tsEsm, roots: ['<rootDir>/lib'] }.
Examples
Section titled “Examples”Read a preset’s moduleNameMapper and extend it:
import { presets } from '@repobuddy/jest'
export default { ...presets.tsEsm, moduleNameMapper: { ...presets.tsEsm.moduleNameMapper, '^#utils$': '<rootDir>/src/utils.ts', },}The single-preset entry gives the same object:
import tsEsm from '@repobuddy/jest/presets/ts-esm'