You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created an issue/question for this in SST at sst/sst#1065. I'm wondering if I'm doing something wrong or if this just a shortcoming of esbuild-runner. How come the jest.mock() calls are not hoisted to the top in the generated JavaScript files of Jest tests written in TypeScript? Below is snippet of the resulting JavaScript, notice the jest.mock() calls appear towards the middle, nowhere near the top as Jest babel-jest transformer for example would do,
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const lambda = __importStar(require("../src/acme-lambda"));
jest.mock('ioredis');
jest.mock('@acme/common-util');
...
The text was updated successfully, but these errors were encountered:
Can confirm, using esbuild-runner with tests that need to jest.mock imported functions will break things. If you want to quickly reproduce this problem you can setup any test that required mocking imported functions
I created an issue/question for this in SST at sst/sst#1065. I'm wondering if I'm doing something wrong or if this just a shortcoming of
esbuild-runner
. How come thejest.mock()
calls are not hoisted to the top in the generated JavaScript files of Jest tests written in TypeScript? Below is snippet of the resulting JavaScript, notice thejest.mock()
calls appear towards the middle, nowhere near the top as Jestbabel-jest
transformer for example would do,The text was updated successfully, but these errors were encountered: