feat(medusa): Performance improvements of Carts domain (#2648)

**What**

I have created a new method on the cart service which is `addLineItems`, allowing a user to add one or multiple items in an optimized way. Also updated the `generate` method from the line item service which now also accept a object data or a collection of data which. Various places have been optimized and cache support has been added to the price selection strategy.

The overall optimization allows to reach another 9000% improvement in the response time as a median (Creating a cart with 6 items):

|   | Min (ms)  | Median (ms)  | Max (ms)  | Median Improvement (%)
|---|:-:|---|---|---|
| Before optimisation  | 1200  | 9999 | 12698  |  N/A
| After optimisation | 63  | 252  | 500  | 39x
| After re optimisation | 56 | 82  | 399  | 121x
| After including addressed feedback | 65 | 202  | 495  | 49x

FIXES CORE-722
This commit is contained in:
Adrien de Peretti
2022-12-07 14:39:12 +00:00
committed by GitHub
parent 3b2c929408
commit 42d9c7222b
71 changed files with 1204 additions and 439 deletions
@@ -29,7 +29,7 @@ describe("/admin/collections", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: true })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -26,7 +26,7 @@ describe("/admin/draft-orders", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: true })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -29,7 +29,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/draft-orders", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
@@ -40,7 +40,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/order-edits", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -10,8 +10,8 @@ const adminSeeder = require("../../../helpers/admin-seeder")
const {
simpleRegionFactory,
simpleShippingOptionFactory,
simpleOrderFactory
} = require("../../../factories");
simpleOrderFactory,
} = require("../../../factories")
jest.setTimeout(30000)
@@ -24,7 +24,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/orders", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -50,7 +49,7 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/orders", () => {
country_code: "us",
}
const region = await simpleRegionFactory(dbConnection, {
id: "test-region"
id: "test-region",
})
order = await simpleOrderFactory(dbConnection, {
id: "test-order",
@@ -58,16 +57,19 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/orders", () => {
shipping_address: shippingAddress,
currency_code: "usd",
})
includesTaxShippingOption = await simpleShippingOptionFactory(dbConnection, {
includes_tax: true,
region_id: region.id
})
includesTaxShippingOption = await simpleShippingOptionFactory(
dbConnection,
{
includes_tax: true,
region_id: region.id,
}
)
} catch (err) {
console.log(err)
}
})
afterEach(async() => {
afterEach(async () => {
const db = useDb()
return await db.teardown()
})
@@ -76,26 +78,27 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/orders", () => {
const api = useApi()
const orderWithShippingMethodRes = await api.post(
`/admin/orders/${order.id}/shipping-methods`,
{
option_id: includesTaxShippingOption.id,
price: 10,
`/admin/orders/${order.id}/shipping-methods`,
{
option_id: includesTaxShippingOption.id,
price: 10,
},
{
headers: {
Authorization: "Bearer test_token",
},
{
headers: {
Authorization: "Bearer test_token",
},
}
}
)
expect(orderWithShippingMethodRes.status).toEqual(200)
expect(orderWithShippingMethodRes.data.order.shipping_methods)
.toEqual(expect.arrayContaining([
expect(orderWithShippingMethodRes.data.order.shipping_methods).toEqual(
expect.arrayContaining([
expect.objectContaining({
shipping_option_id: includesTaxShippingOption.id,
includes_tax: true,
})
]))
}),
])
)
})
})
})
@@ -33,7 +33,7 @@ describe("/admin/orders", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -28,7 +28,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment-collections", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
verbose: true,
})
dbConnection = connection
medusaProcess = process
@@ -31,7 +31,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /admin/payment", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -1415,7 +1415,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/price-lists", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -36,7 +36,9 @@ describe("/admin/products", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({
cwd,
})
})
afterAll(async () => {
@@ -43,7 +43,6 @@ describe("[MEDUSA_FF_PUBLISHABLE_API_KEYS] Publishable API keys", () => {
MEDUSA_FF_PUBLISHABLE_API_KEYS: true,
MEDUSA_FF_SALES_CHANNELS: true,
},
verbose: false,
})
dbConnection = connection
medusaProcess = process
+17 -15
View File
@@ -2,11 +2,12 @@ const path = require("path")
const { Region } = require("@medusajs/medusa")
const setupServer = require("../../../helpers/setup-server")
const startServerWithEnvironment = require("../../../helpers/start-server-with-environment").default
const startServerWithEnvironment =
require("../../../helpers/start-server-with-environment").default
const { useApi } = require("../../../helpers/use-api")
const { initDb, useDb } = require("../../../helpers/use-db")
const adminSeeder = require("../../helpers/admin-seeder")
const { simpleRegionFactory } = require("../../factories");
const { simpleRegionFactory } = require("../../factories")
const adminReqConfig = {
headers: {
@@ -304,7 +305,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/regions", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -364,7 +364,7 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/regions", () => {
name: "region-including-taxes",
})
)
});
})
it("should allow to update a region that includes tax", async function () {
const api = useApi()
@@ -376,17 +376,19 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/regions", () => {
expect(response.data.region.includes_tax).toBe(false)
response = await api.post(
`/admin/regions/${region1TaxInclusiveId}`,
{
includes_tax: true,
},
adminReqConfig,
).catch((err) => {
console.log(err)
})
response = await api
.post(
`/admin/regions/${region1TaxInclusiveId}`,
{
includes_tax: true,
},
adminReqConfig
)
.catch((err) => {
console.log(err)
})
expect(response.data.region.includes_tax).toBe(true)
});
})
})
})
})
@@ -15,7 +15,7 @@ describe("/admin/return-reasons", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -34,7 +34,6 @@ describe("sales channels", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_SALES_CHANNELS: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -1,15 +1,17 @@
const path = require("path")
const {
ShippingProfile,
} = require("@medusajs/medusa")
const { ShippingProfile } = require("@medusajs/medusa")
const setupServer = require("../../../helpers/setup-server")
const startServerWithEnvironment = require("../../../helpers/start-server-with-environment").default
const startServerWithEnvironment =
require("../../../helpers/start-server-with-environment").default
const { useApi } = require("../../../helpers/use-api")
const { initDb, useDb } = require("../../../helpers/use-db")
const adminSeeder = require("../../helpers/admin-seeder")
const shippingOptionSeeder = require("../../helpers/shipping-option-seeder")
const { simpleShippingOptionFactory, simpleRegionFactory } = require("../../factories")
const {
simpleShippingOptionFactory,
simpleRegionFactory,
} = require("../../factories")
const adminReqConfig = {
headers: {
@@ -475,7 +477,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/shipping-options", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -517,9 +518,12 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/shipping-options", () => {
it("should creates a shipping option that includes tax", async () => {
const api = useApi()
const defaultProfile = await dbConnection.manager.findOne(ShippingProfile, {
type: "default",
})
const defaultProfile = await dbConnection.manager.findOne(
ShippingProfile,
{
type: "default",
}
)
const payload = {
name: "Test option",
@@ -551,7 +555,10 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/shipping-options", () => {
const api = useApi()
let response = await api
.get(`/admin/shipping-options/${shippingOptionIncludesTaxId}`, adminReqConfig)
.get(
`/admin/shipping-options/${shippingOptionIncludesTaxId}`,
adminReqConfig
)
.catch((err) => {
console.log(err)
})
@@ -573,7 +580,11 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /admin/shipping-options", () => {
}
response = await api
.post(`/admin/shipping-options/${shippingOptionIncludesTaxId}`, payload, adminReqConfig)
.post(
`/admin/shipping-options/${shippingOptionIncludesTaxId}`,
payload,
adminReqConfig
)
.catch((err) => {
console.log(err)
})
@@ -363,7 +363,6 @@ describe("/admin/swaps", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -28,7 +28,7 @@ describe("/admin/users", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -1,6 +1,6 @@
const path = require("path")
const fs = require("fs/promises")
import { sep, resolve } from "path"
import { resolve, sep } from "path"
const setupServer = require("../../../../helpers/setup-server")
const { useApi } = require("../../../../helpers/use-api")
@@ -31,7 +31,6 @@ describe("Batchjob with type order-export", () => {
cwd,
redisUrl: "redis://127.0.0.1:6379",
uploadDir: __dirname,
verbose: false,
})
})
@@ -66,7 +66,6 @@ describe("Price list import batch job", () => {
cwd,
redisUrl: "redis://127.0.0.1:6379",
uploadDir: __dirname,
verbose: false,
})
})
@@ -16,7 +16,7 @@ const adminReqConfig = {
},
}
jest.setTimeout(100000000)
jest.setTimeout(180000)
describe("Batch job of product-export type", () => {
let medusaProcess
@@ -31,7 +31,6 @@ describe("Batch job of product-export type", () => {
cwd,
redisUrl: "redis://127.0.0.1:6379",
uploadDir: __dirname,
verbose: false,
})
})
@@ -61,7 +61,6 @@ describe("Product import - Sales Channel", () => {
env: { MEDUSA_FF_SALES_CHANNELS: true },
redisUrl: "redis://127.0.0.1:6379",
uploadDir: __dirname,
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -59,7 +59,6 @@ describe("Product import batch job", () => {
cwd,
redisUrl: "redis://127.0.0.1:6379",
uploadDir: __dirname,
verbose: false,
})
})
@@ -23,7 +23,6 @@ describe("Line Item - Sales Channel", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_SALES_CHANNELS: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -28,7 +28,6 @@ describe("tax inclusive prices", () => {
const [process, conn] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = conn // await initDb({ cwd })
medusaProcess = process // await setupServer({ cwd })
@@ -74,7 +74,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /store/carts", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -47,7 +47,7 @@ describe("/store/carts", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -28,7 +28,6 @@ describe("[MEDUSA_FF_SALES_CHANNELS] /store/carts", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_SALES_CHANNELS: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -27,7 +27,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /store/carts", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -261,6 +260,25 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /store/carts", () => {
})
describe("with a cart with full tax inclusive variant pricing", () => {
const variantId1 = IdMap.getId("test-variant-1-tax-inclusive")
const variantId2 = IdMap.getId("test-variant-2-tax-inclusive")
const productId1 = IdMap.getId("test-product-1-tax-inclusive")
const productId2 = IdMap.getId("test-product-2-tax-inclusive")
const createCartPayload = {
region_id: regionId,
items: [
{
variant_id: variantId1,
quantity: 1,
},
{
variant_id: variantId2,
quantity: 1,
},
],
}
beforeEach(async () => {
await simpleRegionFactory(dbConnection, regionData)
await simpleProductFactory(
@@ -319,6 +337,25 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING] /store/carts", () => {
})
describe("with a cart mixing tax inclusive and exclusive variant pricing", () => {
const variantId1 = IdMap.getId("test-variant-1-mixed-tax-inclusive")
const variantId2 = IdMap.getId("test-variant-2-mixed-tax-inclusive")
const productId1 = IdMap.getId("test-product-1-mixed-tax-inclusive")
const productId2 = IdMap.getId("test-product-2-mixed-tax-inclusive")
const createCartPayload = {
region_id: regionId,
items: [
{
variant_id: variantId1,
quantity: 1,
},
{
variant_id: variantId2,
quantity: 1,
},
],
}
beforeEach(async () => {
await simpleRegionFactory(dbConnection, regionData)
await simpleProductFactory(
@@ -14,7 +14,7 @@ describe("/store/collections", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: true })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -19,7 +19,7 @@ describe("/store/customers", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -30,7 +30,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /store/order-edits", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -31,7 +31,7 @@ describe("/store/carts", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -25,7 +25,6 @@ describe("[MEDUSA_FF_ORDER_EDITING] /store/payment-collections", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_ORDER_EDITING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -15,7 +15,7 @@ describe("/store/variants", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -31,7 +31,6 @@ describe("sales channels", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_SALES_CHANNELS: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -28,7 +28,7 @@ describe("Automatic Cart Taxes", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -25,7 +25,7 @@ describe("Manual Cart Taxes", () => {
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."))
dbConnection = await initDb({ cwd })
medusaProcess = await setupServer({ cwd, verbose: false })
medusaProcess = await setupServer({ cwd })
})
afterAll(async () => {
@@ -22,7 +22,6 @@ describe("[MEDUSA_FF_TAX_INCLUSIVE_PRICING]: Order Taxes", () => {
const [process, connection] = await startServerWithEnvironment({
cwd,
env: { MEDUSA_FF_TAX_INCLUSIVE_PRICING: true },
verbose: false,
})
dbConnection = connection
medusaProcess = process
@@ -1,8 +1,9 @@
import {
PriceList,
CustomerGroup,
MoneyAmount,
PriceListType,
PriceList,
PriceListStatus,
PriceListType,
} from "@medusajs/medusa"
import faker from "faker"
import { Connection } from "typeorm"
@@ -41,7 +42,7 @@ export const simplePriceListFactory = async (
const listId = data.id || `simple-price-list-${Math.random() * 1000}`
let customerGroups = []
let customerGroups: CustomerGroup[] = []
if (typeof data.customer_groups !== "undefined") {
customerGroups = await Promise.all(
data.customer_groups.map((group) =>
+3 -3
View File
@@ -8,16 +8,16 @@
"build": "babel src -d dist --extensions \".ts,.js\""
},
"dependencies": {
"@medusajs/medusa": "1.6.5-dev-1669708431707",
"@medusajs/medusa": "1.6.5-dev-1670340951307",
"faker": "^5.5.3",
"medusa-interfaces": "1.3.3-dev-1669708431707",
"medusa-interfaces": "1.3.3-dev-1670340951307",
"typeorm": "^0.2.31"
},
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/node": "^7.12.10",
"babel-preset-medusa-package": "1.1.19-dev-1669708431707",
"babel-preset-medusa-package": "1.1.19-dev-1670340951307",
"jest": "^26.6.3"
}
}
+37 -37
View File
@@ -1775,9 +1775,9 @@ __metadata:
languageName: node
linkType: hard
"@medusajs/medusa-cli@npm:1.3.5-dev-1669708431707":
version: 1.3.5-dev-1669708431707
resolution: "@medusajs/medusa-cli@npm:1.3.5-dev-1669708431707"
"@medusajs/medusa-cli@npm:1.3.5-dev-1670340951307":
version: 1.3.5-dev-1670340951307
resolution: "@medusajs/medusa-cli@npm:1.3.5-dev-1670340951307"
dependencies:
"@babel/polyfill": ^7.8.7
"@babel/runtime": ^7.9.6
@@ -1793,8 +1793,8 @@ __metadata:
inquirer: ^8.0.0
is-valid-path: ^0.1.1
meant: ^1.0.1
medusa-core-utils: 1.1.35-dev-1669708431707
medusa-telemetry: 0.0.15-dev-1669708431707
medusa-core-utils: 1.1.35-dev-1670340951307
medusa-telemetry: 0.0.15-dev-1670340951307
netrc-parser: ^3.1.6
open: ^8.0.6
ora: ^5.4.1
@@ -1809,15 +1809,15 @@ __metadata:
yargs: ^15.3.1
bin:
medusa: cli.js
checksum: 779d98b21775542534466272d8fe415620024846aba435b45ae9956eab3fc7c627f85540ac0ac7a5282a0ab15d2c04c2dd99e72ca071b46f55da20f34effb69a
checksum: 7588d1b5ef91b720c36379db278da61b308403f30807d4c470418f1072203238b2820ce14d8b8ddf154b7f61f6ae79afc081ad9e481311e83cfc44546026ba01
languageName: node
linkType: hard
"@medusajs/medusa@npm:1.6.5-dev-1669708431707":
version: 1.6.5-dev-1669708431707
resolution: "@medusajs/medusa@npm:1.6.5-dev-1669708431707"
"@medusajs/medusa@npm:1.6.5-dev-1670340951307":
version: 1.6.5-dev-1670340951307
resolution: "@medusajs/medusa@npm:1.6.5-dev-1670340951307"
dependencies:
"@medusajs/medusa-cli": 1.3.5-dev-1669708431707
"@medusajs/medusa-cli": 1.3.5-dev-1670340951307
"@types/ioredis": ^4.28.10
"@types/lodash": ^4.14.168
awilix: ^8.0.0
@@ -1839,8 +1839,8 @@ __metadata:
ioredis-mock: ^5.6.0
iso8601-duration: ^1.3.0
jsonwebtoken: ^8.5.1
medusa-core-utils: 1.1.35-dev-1669708431707
medusa-test-utils: 1.1.37-dev-1669708431707
medusa-core-utils: 1.1.35-dev-1670340951307
medusa-test-utils: 1.1.37-dev-1670340951307
morgan: ^1.9.1
multer: ^1.4.2
node-schedule: ^2.1.0
@@ -1865,7 +1865,7 @@ __metadata:
typeorm: 0.2.x
bin:
medusa: cli.js
checksum: 7a7ec5ba7971112e74652791cff5eb8bfde640158618b300289d67bd753859c8312256fb2aa93f3523d2a4399f6d8b6c106e03e253f9a9518405b1224043299d
checksum: 274637b6e19db96f5cc561837b254bf2f5a1fea62ecc5258739413b48e568d7b3bdd0d486b32009d7e3ee27d684bbd3451943e6a42d092624882331139befee3
languageName: node
linkType: hard
@@ -2446,11 +2446,11 @@ __metadata:
"@babel/cli": ^7.12.10
"@babel/core": ^7.12.10
"@babel/node": ^7.12.10
"@medusajs/medusa": 1.6.5-dev-1669708431707
babel-preset-medusa-package: 1.1.19-dev-1669708431707
"@medusajs/medusa": 1.6.5-dev-1670340951307
babel-preset-medusa-package: 1.1.19-dev-1670340951307
faker: ^5.5.3
jest: ^26.6.3
medusa-interfaces: 1.3.3-dev-1669708431707
medusa-interfaces: 1.3.3-dev-1670340951307
typeorm: ^0.2.31
languageName: unknown
linkType: soft
@@ -2757,9 +2757,9 @@ __metadata:
languageName: node
linkType: hard
"babel-preset-medusa-package@npm:1.1.19-dev-1669708431707":
version: 1.1.19-dev-1669708431707
resolution: "babel-preset-medusa-package@npm:1.1.19-dev-1669708431707"
"babel-preset-medusa-package@npm:1.1.19-dev-1670340951307":
version: 1.1.19-dev-1670340951307
resolution: "babel-preset-medusa-package@npm:1.1.19-dev-1670340951307"
dependencies:
"@babel/plugin-proposal-class-properties": ^7.12.1
"@babel/plugin-proposal-decorators": ^7.12.1
@@ -2773,7 +2773,7 @@ __metadata:
core-js: ^3.7.0
peerDependencies:
"@babel/core": ^7.11.6
checksum: 2b01b0754da0a4bec26abcb6c94d91d7c2fd06bf9d58c23dac9266dc8c7cb470a6a8874d1564af84b068684d34028fb0288c7eae5f271a16cd1570ccaf1aa413
checksum: b091e66d23c22e26a55f8039810f73910a3860af5838904aada35e6066d3d1f9c85e5897e2879388452fd424663e676a4e19ad960167a1d001105e2d797715bc
languageName: node
linkType: hard
@@ -6919,29 +6919,29 @@ __metadata:
languageName: node
linkType: hard
"medusa-core-utils@npm:1.1.35-dev-1669708431707":
version: 1.1.35-dev-1669708431707
resolution: "medusa-core-utils@npm:1.1.35-dev-1669708431707"
"medusa-core-utils@npm:1.1.35-dev-1670340951307":
version: 1.1.35-dev-1670340951307
resolution: "medusa-core-utils@npm:1.1.35-dev-1670340951307"
dependencies:
joi: ^17.3.0
joi-objectid: ^3.0.1
checksum: ac797ee8b9a165a6e90e11fbe9312bcfcaaa4271a9ef79b2cb659b053697cbee80580b3aae9bead7e2b738a864df30f150b01d9598fceb8262d6d11496a68ab4
checksum: 9304c0426dec41f33973dd122491bd3025a65eabc94616de7f63b492b558e71234fc0e02af3a13cea014b8a4bead91053e0416e107cc0b74657af9782d5c6023
languageName: node
linkType: hard
"medusa-interfaces@npm:1.3.3-dev-1669708431707":
version: 1.3.3-dev-1669708431707
resolution: "medusa-interfaces@npm:1.3.3-dev-1669708431707"
"medusa-interfaces@npm:1.3.3-dev-1670340951307":
version: 1.3.3-dev-1670340951307
resolution: "medusa-interfaces@npm:1.3.3-dev-1670340951307"
peerDependencies:
medusa-core-utils: ^1.1.31
typeorm: 0.x
checksum: edad068df3783072f178cac3adfa646e8886a55bf07409addec4ab18eab8f8e09e9d5ac34c1e06c65cd111330f003325c72f9dc8585348d20382a1dacf3d3536
checksum: 9eda49c0cb3922f3e1109ad231389b54ad49f730444108fd10876beab9f7845c47b965dcfe32e7169a9a4845edd143cfad96187c5a5814cbd05f45852d56c130
languageName: node
linkType: hard
"medusa-telemetry@npm:0.0.15-dev-1669708431707":
version: 0.0.15-dev-1669708431707
resolution: "medusa-telemetry@npm:0.0.15-dev-1669708431707"
"medusa-telemetry@npm:0.0.15-dev-1670340951307":
version: 0.0.15-dev-1670340951307
resolution: "medusa-telemetry@npm:0.0.15-dev-1670340951307"
dependencies:
axios: ^0.21.1
axios-retry: ^3.1.9
@@ -6952,18 +6952,18 @@ __metadata:
is-docker: ^2.2.1
remove-trailing-slash: ^0.1.1
uuid: ^8.3.2
checksum: 0116c6d4d70811290ba423868cbd5fc8600cf66c81942c0fb69eab41910e783f6f90b8d401e95f2847e4aa0fc74dbcd5115e30cd9758be2f01b4577d934fcb2c
checksum: 15f3b7d1d639b3024d964792455a13f820fc596d7f01583f44de9803d44f129e39b201a00dab94dc43b67f31b4852835e96fd58363b55a71d6979856be58df75
languageName: node
linkType: hard
"medusa-test-utils@npm:1.1.37-dev-1669708431707":
version: 1.1.37-dev-1669708431707
resolution: "medusa-test-utils@npm:1.1.37-dev-1669708431707"
"medusa-test-utils@npm:1.1.37-dev-1670340951307":
version: 1.1.37-dev-1670340951307
resolution: "medusa-test-utils@npm:1.1.37-dev-1670340951307"
dependencies:
"@babel/plugin-transform-classes": ^7.9.5
medusa-core-utils: 1.1.35-dev-1669708431707
medusa-core-utils: 1.1.35-dev-1670340951307
randomatic: ^3.1.1
checksum: b89c99be68369aae6f72c395eaec11f06c64415ff6b1e9a8616fd2e14e68a1f3cfb58e7722f48057c0da7da5d1dcb260ecaa49bd89c241a55d38767b2307600b
checksum: 8e96932f28e402c9561f6ea6c13a5d5ac8b5b83dc38a5e41d4ad5bcac73aa35886fe3b6d55809692594b468fc7be6e89477b6cd3d694be23f6a5abac7cb61c62
languageName: node
linkType: hard
@@ -11,6 +11,8 @@ module.exports = ({ cwd, redisUrl, uploadDir, verbose, env }) => {
const workerId = parseInt(process.env.JEST_WORKER_ID || "1")
const redisUrlWithDatabase = `${redisUrl}/${workerId - 1}`
verbose = verbose ?? false
return new Promise((resolve, reject) => {
const medusaProcess = spawn("node", [path.resolve(serverPath)], {
cwd,
@@ -21,6 +23,7 @@ module.exports = ({ cwd, redisUrl, uploadDir, verbose, env }) => {
COOKIE_SECRET: "test",
REDIS_URL: redisUrl ? redisUrlWithDatabase : undefined, // If provided, will use a real instance, otherwise a fake instance
UPLOAD_DIR: uploadDir, // If provided, will be used for the fake local file service
CACHE_TTL: 0, // By default the cache service is disabled and 0 means that none of the cache key/value will be stored.
...env,
},
stdio: verbose