Closed kyptov closed 1 year ago
until this is fixed, I did the following on my project:
// /scripts/patch-esbuild-jest.js
#!/usr/bin/env node
const fs = require('fs');
const file = `
Object.defineProperty(exports, "__esModule", { value: true });
var esbuild_1 = require("./esbuild");
require("./register");
function process(src, filename) {
return {
code: (0, esbuild_1.transpile)(src, filename, { type: "transform" })
}
}
exports.default = { process: process };
`;
fs.writeFileSync('./node_modules/esbuild-runner/lib/jest.js', file);
$ chmod +x /scripts/patch-esbuild-jest.js
//in package.json
{
"scripts" : {
"postinstall": "./scripts/patch-esbuild-jest.js",
[...]
}
}
In jest version 28 was changed transform return type https://jestjs.io/docs/upgrading-to-jest28#transformer
I used this patch to bypass the problem