From 8693fcb41ef93fa0b9f8c3d44af955a4599a113d Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 6 Dec 2022 15:36:32 -0500 Subject: [PATCH] Add transformer wrapper for yaml-jest to be compatible with v28, following the hint at https://github.com/sumwatshade/jest-transform-yaml/issues/19#issuecomment-1232857013 --- client/tests/jest/jest.config.js | 6 +++--- client/tests/jest/yaml-jest.js | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 client/tests/jest/yaml-jest.js diff --git a/client/tests/jest/jest.config.js b/client/tests/jest/jest.config.js index a702f74f22e..2bd799c9dce 100644 --- a/client/tests/jest/jest.config.js +++ b/client/tests/jest/jest.config.js @@ -184,9 +184,9 @@ module.exports = { transform: { ...tsjPreset.transform, "^.+\\.js$": "babel-jest", - ".*\\.(vue)$": "@vue/vue2-jest", - "\\.yml$": "yaml-jest", - "\\.txt$": "jest-raw-loader", + "^.*\\.(vue)$": "@vue/vue2-jest", + "^.+\\.ya?ml$": "/tests/jest/yaml-jest.js", + "^.+\\.txt$": "jest-raw-loader", }, // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation diff --git a/client/tests/jest/yaml-jest.js b/client/tests/jest/yaml-jest.js new file mode 100644 index 00000000000..8e84063fe5b --- /dev/null +++ b/client/tests/jest/yaml-jest.js @@ -0,0 +1,13 @@ +const transformer = require("yaml-jest").default + +const newTransformer = { + ...transformer, + process: function (...params) { + return { + code: transformer?.process(...params), + map: null, + } + }, +} + +module.exports = newTransformer