|
| 1 | +/* eslint-disable */ |
| 2 | +import { readFileSync } from 'fs'; |
| 3 | +import { Config } from 'jest'; |
| 4 | + |
| 5 | +// Reading the SWC compilation config and remove the "exclude" |
| 6 | +// for the test files to be compiled by SWC |
| 7 | +const { exclude: _, ...swcJestConfig } = JSON.parse( |
| 8 | + readFileSync(`${__dirname}/.swcrc`, 'utf-8') |
| 9 | +); |
| 10 | + |
| 11 | +// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves. |
| 12 | +// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude" |
| 13 | +if (swcJestConfig.swcrc === undefined) { |
| 14 | + swcJestConfig.swcrc = false; |
| 15 | +} |
| 16 | + |
| 17 | +// Uncomment if using global setup/teardown files being transformed via swc |
| 18 | +// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries |
| 19 | +// jest needs EsModule Interop to find the default exported setup/teardown functions |
| 20 | +// swcJestConfig.module.noInterop = false; |
| 21 | + |
| 22 | +const config: Config = { |
| 23 | + displayName: 'payments-email', |
| 24 | + preset: '../../../jest.preset.js', |
| 25 | + transform: { |
| 26 | + '^.+\\.[tj]s$': ['@swc/jest', swcJestConfig], |
| 27 | + }, |
| 28 | + moduleFileExtensions: ['ts', 'js', 'html'], |
| 29 | + testEnvironment: 'node', |
| 30 | + coverageDirectory: '../../../coverage/libs/payments/email', |
| 31 | + reporters: [ |
| 32 | + 'default', |
| 33 | + [ |
| 34 | + 'jest-junit', |
| 35 | + { |
| 36 | + outputDirectory: 'artifacts/tests/payments-email', |
| 37 | + outputName: 'payments-email-jest-unit-results.xml', |
| 38 | + }, |
| 39 | + ], |
| 40 | + ], |
| 41 | +}; |
| 42 | + |
| 43 | +export default config; |
0 commit comments