|
| 1 | +/* eslint-disable */ |
| 2 | +var { readFileSync } = require('fs'); |
| 3 | +var path = require('path'); |
| 4 | +var os = require('os'); |
| 5 | +var rimraf = require('rimraf'); |
| 6 | + |
| 7 | +// Reading the SWC compilation config and remove the "exclude" |
| 8 | +// for the test files to be compiled by SWC |
| 9 | +var swcJestConfig = JSON.parse( |
| 10 | + readFileSync(path.join(__dirname, '.swcrc'), 'utf-8'), |
| 11 | +); |
| 12 | + |
| 13 | +rimraf.sync(path.join(__dirname, 'test/js')); |
| 14 | + |
| 15 | +// Disable .swcrc look-up by SWC core because we're passing in swcJestConfig |
| 16 | +// ourselves. If we do not disable this, SWC Core will read .swcrc and won't |
| 17 | +// transform our test files due to "exclude". |
| 18 | +if (swcJestConfig && typeof swcJestConfig.exclude !== 'undefined') { |
| 19 | + delete swcJestConfig.exclude; |
| 20 | +} |
| 21 | + |
| 22 | +if (swcJestConfig.swcrc === undefined) { |
| 23 | + swcJestConfig.swcrc = false; |
| 24 | +} |
| 25 | + |
| 26 | +/** @type {import('jest').Config} */ |
| 27 | +var config = { |
| 28 | + displayName: 'enhanced', |
| 29 | + preset: '../../jest.preset.js', |
| 30 | + cacheDirectory: path.join(os.tmpdir(), 'enhanced'), |
| 31 | + transform: { |
| 32 | + '^.+\\.[tj]s$': ['@swc/jest', swcJestConfig], |
| 33 | + }, |
| 34 | + moduleFileExtensions: ['ts', 'js', 'html'], |
| 35 | + coverageDirectory: '../../coverage/packages/enhanced', |
| 36 | + rootDir: __dirname, |
| 37 | + testMatch: [ |
| 38 | + '<rootDir>/test/*.basictest.js', |
| 39 | + '<rootDir>/test/unit/**/*.test.ts', |
| 40 | + ], |
| 41 | + silent: true, |
| 42 | + verbose: false, |
| 43 | + testEnvironment: path.resolve(__dirname, './test/patch-node-env.js'), |
| 44 | + setupFilesAfterEnv: ['<rootDir>/test/setupTestFramework.js'], |
| 45 | +}; |
| 46 | + |
| 47 | +module.exports = config; |
0 commit comments