medusa-test-utils 1.1.45-snapshot-20240607093839 → 1.1.45-snapshot-20240701122250
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/database.js +56 -142
- package/dist/database.js.map +1 -1
- package/dist/events.js +7 -54
- package/dist/events.js.map +1 -1
- package/dist/id-map.js +8 -13
- package/dist/id-map.js.map +1 -1
- package/dist/init-modules.js +37 -98
- package/dist/init-modules.js.map +1 -1
- package/dist/jest.js +14 -62
- package/dist/jest.js.map +1 -1
- package/dist/medusa-test-runner-utils/bootstrap-app.js +48 -141
- package/dist/medusa-test-runner-utils/bootstrap-app.js.map +1 -1
- package/dist/medusa-test-runner-utils/use-db.js +26 -99
- package/dist/medusa-test-runner-utils/use-db.js.map +1 -1
- package/dist/medusa-test-runner.d.ts +7 -0
- package/dist/medusa-test-runner.js +130 -290
- package/dist/medusa-test-runner.js.map +1 -1
- package/dist/mock-event-bus-service.d.ts +4 -4
- package/dist/mock-event-bus-service.js +13 -53
- package/dist/mock-event-bus-service.js.map +1 -1
- package/dist/module-test-runner.js +57 -128
- package/dist/module-test-runner.js.map +1 -1
- package/package.json +6 -6
package/dist/jest.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,SAAgB,wBAAwB;IACtC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,WAAW,CAAA;IAClD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,UAAU,CAAA;IACzD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAA;IACjD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAA;IAE9C,MAAM,gBAAgB,GAAG;QACvB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,WAAW;QACrB,IAAI,EAAE,OAAO;KACd,CAAA;IAED,QAAQ,CAAC,KAAK,IAAI,EAAE;QAClB,IAAI,CAAC;YACH,MAAM,IAAA,qBAAY,EAAC,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,gBAAgB,CAAC,CAAA;QACjE,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CACX,qIAAqI,CAAC,CAAC,OAAO,EAAE,CACjJ,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AArBD,4DAqBC"}
|
@@ -1,153 +1,60 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
-
}
|
37
|
-
};
|
38
|
-
var __read = (this && this.__read) || function (o, n) {
|
39
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
40
|
-
if (!m) return o;
|
41
|
-
var i = m.call(o), r, ar = [], e;
|
42
|
-
try {
|
43
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
44
|
-
}
|
45
|
-
catch (error) { e = { error: error }; }
|
46
|
-
finally {
|
47
|
-
try {
|
48
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
49
|
-
}
|
50
|
-
finally { if (e) throw e.error; }
|
51
|
-
}
|
52
|
-
return ar;
|
53
|
-
};
|
54
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
55
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
56
4
|
};
|
57
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
58
6
|
exports.startApp = void 0;
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
function bootstrapApp() {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
Object.entries(env).forEach(function (_a) {
|
73
|
-
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
74
|
-
return (process.env[k] = v);
|
75
|
-
});
|
76
|
-
}
|
77
|
-
loaders = require("@medusajs/medusa/dist/loaders").default;
|
78
|
-
return [4 /*yield*/, loaders({
|
79
|
-
directory: (0, path_1.resolve)(cwd || process.cwd()),
|
80
|
-
expressApp: app,
|
81
|
-
})];
|
82
|
-
case 1:
|
83
|
-
_b = _e.sent(), container = _b.container, shutdown = _b.shutdown;
|
84
|
-
return [4 /*yield*/, (0, get_port_1.default)()];
|
85
|
-
case 2:
|
86
|
-
PORT = _e.sent();
|
87
|
-
return [2 /*return*/, {
|
88
|
-
shutdown: shutdown,
|
89
|
-
container: container,
|
90
|
-
app: app,
|
91
|
-
port: PORT,
|
92
|
-
}];
|
93
|
-
}
|
94
|
-
});
|
7
|
+
const express_1 = __importDefault(require("express"));
|
8
|
+
const get_port_1 = __importDefault(require("get-port"));
|
9
|
+
const path_1 = require("path");
|
10
|
+
const utils_1 = require("@medusajs/utils");
|
11
|
+
async function bootstrapApp({ cwd, env = {}, } = {}) {
|
12
|
+
const app = (0, express_1.default)();
|
13
|
+
if ((0, utils_1.isObject)(env)) {
|
14
|
+
Object.entries(env).forEach(([k, v]) => (process.env[k] = v));
|
15
|
+
}
|
16
|
+
const loaders = require("@medusajs/medusa/dist/loaders").default;
|
17
|
+
const { container, shutdown } = await loaders({
|
18
|
+
directory: (0, path_1.resolve)(cwd || process.cwd()),
|
19
|
+
expressApp: app,
|
95
20
|
});
|
21
|
+
const PORT = await (0, get_port_1.default)();
|
22
|
+
return {
|
23
|
+
shutdown,
|
24
|
+
container,
|
25
|
+
app,
|
26
|
+
port: PORT,
|
27
|
+
};
|
96
28
|
}
|
97
|
-
function startApp() {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
124
|
-
var server = app
|
125
|
-
.listen(port)
|
126
|
-
.on("error", function (err) { return __awaiter(_this, void 0, void 0, function () {
|
127
|
-
return __generator(this, function (_a) {
|
128
|
-
switch (_a.label) {
|
129
|
-
case 0: return [4 /*yield*/, shutdown()];
|
130
|
-
case 1:
|
131
|
-
_a.sent();
|
132
|
-
return [2 /*return*/, reject(err)];
|
133
|
-
}
|
134
|
-
});
|
135
|
-
}); })
|
136
|
-
.on("listening", function () {
|
137
|
-
var _a;
|
138
|
-
(_a = process.send) === null || _a === void 0 ? void 0 : _a.call(process, port);
|
139
|
-
resolve({
|
140
|
-
shutdown: shutdown,
|
141
|
-
container: container,
|
142
|
-
port: port,
|
143
|
-
});
|
144
|
-
});
|
145
|
-
// TODO: fix that once we find the appropriate place to put this util
|
146
|
-
expressServer = utils_1.GracefulShutdownServer.create(server);
|
147
|
-
})];
|
148
|
-
case 2: return [2 /*return*/, _e.sent()];
|
149
|
-
}
|
29
|
+
async function startApp({ cwd, env = {}, } = {}) {
|
30
|
+
const { app, port, container, shutdown: medusaShutdown, } = await bootstrapApp({
|
31
|
+
cwd,
|
32
|
+
env,
|
33
|
+
});
|
34
|
+
let expressServer;
|
35
|
+
const shutdown = async () => {
|
36
|
+
await (0, utils_1.promiseAll)([expressServer?.shutdown(), medusaShutdown()]);
|
37
|
+
if (typeof global !== "undefined" && global?.gc) {
|
38
|
+
global.gc();
|
39
|
+
}
|
40
|
+
};
|
41
|
+
return await new Promise((resolve, reject) => {
|
42
|
+
const server = app
|
43
|
+
.listen(port)
|
44
|
+
.on("error", async (err) => {
|
45
|
+
await shutdown();
|
46
|
+
return reject(err);
|
47
|
+
})
|
48
|
+
.on("listening", () => {
|
49
|
+
process.send?.(port);
|
50
|
+
resolve({
|
51
|
+
shutdown,
|
52
|
+
container,
|
53
|
+
port,
|
54
|
+
});
|
150
55
|
});
|
56
|
+
// TODO: fix that once we find the appropriate place to put this util
|
57
|
+
expressServer = utils_1.GracefulShutdownServer.create(server);
|
151
58
|
});
|
152
59
|
}
|
153
60
|
exports.startApp = startApp;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"bootstrap-app.js","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/bootstrap-app.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"bootstrap-app.js","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/bootstrap-app.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAC7B,wDAA8B;AAC9B,+BAA8B;AAC9B,2CAA8E;AAG9E,KAAK,UAAU,YAAY,CAAC,EAC1B,GAAG,EACH,GAAG,GAAG,EAAE,MACoC,EAAE;IAC9C,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAA;IAErB,IAAI,IAAA,gBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC/D,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC,OAAO,CAAA;IAEhE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,OAAO,CAAC;QAC5C,SAAS,EAAE,IAAA,cAAO,EAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACxC,UAAU,EAAE,GAAG;KAChB,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,MAAM,IAAA,kBAAO,GAAE,CAAA;IAE5B,OAAO;QACL,QAAQ;QACR,SAAS;QACT,GAAG;QACH,IAAI,EAAE,IAAI;KACX,CAAA;AACH,CAAC;AAEM,KAAK,UAAU,QAAQ,CAAC,EAC7B,GAAG,EACH,GAAG,GAAG,EAAE,MACoC,EAAE;IAK9C,MAAM,EACJ,GAAG,EACH,IAAI,EACJ,SAAS,EACT,QAAQ,EAAE,cAAc,GACzB,GAAG,MAAM,YAAY,CAAC;QACrB,GAAG;QACH,GAAG;KACJ,CAAC,CAAA;IAEF,IAAI,aAAa,CAAA;IAEjB,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;QAC1B,MAAM,IAAA,kBAAU,EAAC,CAAC,aAAa,EAAE,QAAQ,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,CAAA;QAE/D,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,EAAE,EAAE,EAAE,CAAC;YAChD,MAAM,CAAC,EAAE,EAAE,CAAA;QACb,CAAC;IACH,CAAC,CAAA;IAED,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,GAAG;aACf,MAAM,CAAC,IAAI,CAAC;aACZ,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACzB,MAAM,QAAQ,EAAE,CAAA;YAChB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC,CAAC;aACD,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;YACpB,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAA;YAEpB,OAAO,CAAC;gBACN,QAAQ;gBACR,SAAS;gBACT,IAAI;aACL,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEJ,qEAAqE;QACrE,aAAa,GAAG,8BAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;AACJ,CAAC;AAhDD,4BAgDC"}
|
@@ -1,107 +1,34 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.initDb = void 0;
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
5
|
+
const awilix_1 = require("awilix");
|
6
|
+
async function initDb({ cwd, env = {}, }) {
|
7
|
+
if ((0, utils_1.isObject)(env)) {
|
8
|
+
Object.entries(env).forEach(([k, v]) => (process.env[k] = v));
|
36
9
|
}
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
10
|
+
const container = (0, utils_1.createMedusaContainer)();
|
11
|
+
const configModule = await require("@medusajs/medusa/dist/loaders/config").default(cwd);
|
12
|
+
const pgConnection = await require("@medusajs/medusa/dist/loaders/pg-connection").default({
|
13
|
+
configModule,
|
14
|
+
container,
|
15
|
+
});
|
16
|
+
const featureFlagRouter = require("@medusajs/medusa/dist/loaders/feature-flags").default(configModule);
|
17
|
+
container.register({
|
18
|
+
[utils_1.ContainerRegistrationKeys.CONFIG_MODULE]: (0, awilix_1.asValue)(configModule),
|
19
|
+
[utils_1.ContainerRegistrationKeys.LOGGER]: (0, awilix_1.asValue)(console),
|
20
|
+
[utils_1.ContainerRegistrationKeys.PG_CONNECTION]: (0, awilix_1.asValue)(pgConnection),
|
21
|
+
[utils_1.ContainerRegistrationKeys.FEATURE_FLAG_ROUTER]: (0, awilix_1.asValue)(featureFlagRouter),
|
22
|
+
});
|
42
23
|
try {
|
43
|
-
|
24
|
+
const { migrateMedusaApp, } = require("@medusajs/medusa/dist/loaders/medusa-app");
|
25
|
+
await migrateMedusaApp({ configModule, container });
|
44
26
|
}
|
45
|
-
catch (
|
46
|
-
|
47
|
-
|
48
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
49
|
-
}
|
50
|
-
finally { if (e) throw e.error; }
|
27
|
+
catch (err) {
|
28
|
+
console.error("Something went wrong while running the migrations");
|
29
|
+
throw err;
|
51
30
|
}
|
52
|
-
return
|
53
|
-
};
|
54
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
55
|
-
exports.initDb = void 0;
|
56
|
-
var utils_1 = require("@medusajs/utils");
|
57
|
-
var awilix_1 = require("awilix");
|
58
|
-
function initDb(_a) {
|
59
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
60
|
-
var container, configModule, pgConnection, featureFlagRouter, migrateMedusaApp, err_1;
|
61
|
-
var _c;
|
62
|
-
var cwd = _b.cwd, _d = _b.env, env = _d === void 0 ? {} : _d;
|
63
|
-
return __generator(this, function (_e) {
|
64
|
-
switch (_e.label) {
|
65
|
-
case 0:
|
66
|
-
if ((0, utils_1.isObject)(env)) {
|
67
|
-
Object.entries(env).forEach(function (_a) {
|
68
|
-
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
69
|
-
return (process.env[k] = v);
|
70
|
-
});
|
71
|
-
}
|
72
|
-
container = (0, utils_1.createMedusaContainer)();
|
73
|
-
return [4 /*yield*/, require("@medusajs/medusa/dist/loaders/config").default(cwd)];
|
74
|
-
case 1:
|
75
|
-
configModule = _e.sent();
|
76
|
-
return [4 /*yield*/, require("@medusajs/medusa/dist/loaders/pg-connection").default({
|
77
|
-
configModule: configModule,
|
78
|
-
container: container,
|
79
|
-
})];
|
80
|
-
case 2:
|
81
|
-
pgConnection = _e.sent();
|
82
|
-
featureFlagRouter = require("@medusajs/medusa/dist/loaders/feature-flags").default(configModule);
|
83
|
-
container.register((_c = {},
|
84
|
-
_c[utils_1.ContainerRegistrationKeys.CONFIG_MODULE] = (0, awilix_1.asValue)(configModule),
|
85
|
-
_c[utils_1.ContainerRegistrationKeys.LOGGER] = (0, awilix_1.asValue)(console),
|
86
|
-
_c[utils_1.ContainerRegistrationKeys.PG_CONNECTION] = (0, awilix_1.asValue)(pgConnection),
|
87
|
-
_c[utils_1.ContainerRegistrationKeys.FEATURE_FLAG_ROUTER] = (0, awilix_1.asValue)(featureFlagRouter),
|
88
|
-
_c));
|
89
|
-
_e.label = 3;
|
90
|
-
case 3:
|
91
|
-
_e.trys.push([3, 5, , 6]);
|
92
|
-
migrateMedusaApp = require("@medusajs/medusa/dist/loaders/medusa-app").migrateMedusaApp;
|
93
|
-
return [4 /*yield*/, migrateMedusaApp({ configModule: configModule, container: container })];
|
94
|
-
case 4:
|
95
|
-
_e.sent();
|
96
|
-
return [3 /*break*/, 6];
|
97
|
-
case 5:
|
98
|
-
err_1 = _e.sent();
|
99
|
-
console.error("Something went wrong while running the migrations");
|
100
|
-
throw err_1;
|
101
|
-
case 6: return [2 /*return*/, pgConnection];
|
102
|
-
}
|
103
|
-
});
|
104
|
-
});
|
31
|
+
return pgConnection;
|
105
32
|
}
|
106
33
|
exports.initDb = initDb;
|
107
34
|
//# sourceMappingURL=use-db.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-db.js","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/use-db.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"use-db.js","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/use-db.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AACxB,mCAAgC;AAEzB,KAAK,UAAU,MAAM,CAAC,EAC3B,GAAG,EACH,GAAG,GAAG,EAAE,GAIT;IACC,IAAI,IAAA,gBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC/D,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,6BAAqB,GAAE,CAAA;IAEzC,MAAM,YAAY,GAChB,MAAM,OAAO,CAAC,sCAAsC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAEpE,MAAM,YAAY,GAChB,MAAM,OAAO,CAAC,6CAA6C,CAAC,CAAC,OAAO,CAAC;QACnE,YAAY;QACZ,SAAS;KACV,CAAC,CAAA;IAEJ,MAAM,iBAAiB,GACrB,OAAO,CAAC,6CAA6C,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;IAE9E,SAAS,CAAC,QAAQ,CAAC;QACjB,CAAC,iCAAyB,CAAC,aAAa,CAAC,EAAE,IAAA,gBAAO,EAAC,YAAY,CAAC;QAChE,CAAC,iCAAyB,CAAC,MAAM,CAAC,EAAE,IAAA,gBAAO,EAAC,OAAO,CAAC;QACpD,CAAC,iCAAyB,CAAC,aAAa,CAAC,EAAE,IAAA,gBAAO,EAAC,YAAY,CAAC;QAChE,CAAC,iCAAyB,CAAC,mBAAmB,CAAC,EAAE,IAAA,gBAAO,EAAC,iBAAiB,CAAC;KAC5E,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,MAAM,EACJ,gBAAgB,GACjB,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAA;QACvD,MAAM,gBAAgB,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAA;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAA;QAClE,MAAM,GAAG,CAAA;IACX,CAAC;IAED,OAAO,YAAY,CAAA;AACrB,CAAC;AA3CD,wBA2CC"}
|
@@ -3,6 +3,13 @@ export interface MedusaSuiteOptions<TService = unknown> {
|
|
3
3
|
dbConnection: any;
|
4
4
|
getContainer: () => MedusaContainer;
|
5
5
|
api: any;
|
6
|
+
dbUtils: {
|
7
|
+
create: (dbName: string) => Promise<void>;
|
8
|
+
teardown: (options: {
|
9
|
+
schema?: string;
|
10
|
+
}) => Promise<void>;
|
11
|
+
shutdown: (dbName: string) => Promise<void>;
|
12
|
+
};
|
6
13
|
dbConfig: {
|
7
14
|
dbName: string;
|
8
15
|
schema: string;
|