mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
Minor refactoring to future proof against ts preset changes
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const path = require("path");
|
||||
const { defaults: tsjPreset } = require("ts-jest/presets");
|
||||
const ts = require("typescript");
|
||||
|
||||
// For a detailed explanation regarding each configuration property, visit:
|
||||
// https://jestjs.io/docs/en/configuration.html
|
||||
@@ -16,12 +15,25 @@ const modulesToTransform = [
|
||||
"openapi-typescript-fetch",
|
||||
].join("|");
|
||||
|
||||
const tsjPresetTransform = tsjPreset.transform;
|
||||
|
||||
// Override verbatimModuleSyntax to false to allow jest to transform the module syntax like it wants.
|
||||
// This is necessary to allow jest to transform the module syntax to commonjs, which is necessary for
|
||||
// jest to work properly. I think.
|
||||
tsjPresetTransform[0].tsconfig.verbatimModuleSyntax = false;
|
||||
|
||||
const configOverride = {
|
||||
"^.+.tsx?$": [
|
||||
"ts-jest",
|
||||
{
|
||||
tsconfig: {
|
||||
verbatimModuleSyntax: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const mergedTSJTransform = {
|
||||
...tsjPreset.transform,
|
||||
...configOverride,
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
preset: "ts-jest",
|
||||
@@ -56,7 +68,7 @@ module.exports = {
|
||||
"^.*\\.(vue)$": "@vue/vue2-jest",
|
||||
"^.+\\.ya?ml$": "<rootDir>/tests/jest/yaml-jest.js",
|
||||
"^.+\\.txt$": "<rootDir>/tests/jest/jest-raw-loader.js",
|
||||
...tsjPresetTransform,
|
||||
...mergedTSJTransform,
|
||||
},
|
||||
transformIgnorePatterns: [`/node_modules/(?!${modulesToTransform})`],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user