Few things to keep in mind: 1. You need to set MEDUSA_FF_MEDUSA_V2 to true before running the tests to run with the v2 API 2. You can use the `breaking` function to differentiate between v1 and v2 differences. This can help us identify what was breaking pretty quickly afterwards 3. You will need to run specific tests for now instead of all if you want to target v2. I think that's fine though, as we don't really need these to run on every PR until we have feature parity (and by then, all tests would be both v1 and v2 compatible) **note: Adrien** - add a new way to load modules only to run their loaders comparable to the way to run the migrations only - improve tests runner to cleanup the data properly as well as re running all loaders and core defaults Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
89 lines
2.5 KiB
JavaScript
89 lines
2.5 KiB
JavaScript
const { Modules } = require("@medusajs/modules-sdk")
|
|
|
|
const DB_HOST = process.env.DB_HOST
|
|
const DB_USERNAME = process.env.DB_USERNAME
|
|
const DB_PASSWORD = process.env.DB_PASSWORD
|
|
const DB_NAME = process.env.DB_TEMP_NAME
|
|
const DB_URL = `postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}`
|
|
|
|
const redisUrl = process.env.REDIS_URL
|
|
const cacheTTL = process.env.CACHE_TTL ?? 15
|
|
const enableResponseCompression =
|
|
process.env.ENABLE_RESPONSE_COMPRESSION || true
|
|
const enableMedusaV2 = process.env.MEDUSA_FF_MEDUSA_V2 == "true"
|
|
|
|
process.env.POSTGRES_URL = DB_URL
|
|
process.env.LOG_LEVEL = "error"
|
|
|
|
module.exports = {
|
|
plugins: [],
|
|
projectConfig: {
|
|
redis_url: redisUrl,
|
|
database_url: DB_URL,
|
|
database_type: "postgres",
|
|
jwt_secret: "test",
|
|
cookie_secret: "test",
|
|
http_compression: {
|
|
enabled: enableResponseCompression,
|
|
},
|
|
},
|
|
featureFlags: {
|
|
medusa_v2: enableMedusaV2,
|
|
},
|
|
modules: {
|
|
cacheService: {
|
|
resolve: "@medusajs/cache-inmemory",
|
|
options: { ttl: cacheTTL },
|
|
},
|
|
workflows: true,
|
|
// We don't want to load the modules if v2 is not enabled, as they run data operations and migrations on load.
|
|
...(enableMedusaV2
|
|
? {
|
|
[Modules.AUTH]: {
|
|
scope: "internal",
|
|
resources: "shared",
|
|
resolve: "@medusajs/auth",
|
|
options: {
|
|
providers: [
|
|
{
|
|
name: "emailpass",
|
|
scopes: {
|
|
admin: {},
|
|
store: {},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
[Modules.USER]: {
|
|
scope: "internal",
|
|
resources: "shared",
|
|
resolve: "@medusajs/user",
|
|
options: {
|
|
jwt_secret: "test",
|
|
},
|
|
},
|
|
[Modules.CACHE]: {
|
|
resolve: "@medusajs/cache-inmemory",
|
|
options: { ttl: 0 }, // Cache disabled
|
|
},
|
|
[Modules.STOCK_LOCATION]: true,
|
|
[Modules.INVENTORY]: true,
|
|
[Modules.PRODUCT]: true,
|
|
[Modules.PRICING]: true,
|
|
[Modules.PROMOTION]: true,
|
|
[Modules.CUSTOMER]: true,
|
|
[Modules.SALES_CHANNEL]: true,
|
|
[Modules.CART]: true,
|
|
[Modules.WORKFLOW_ENGINE]: true,
|
|
[Modules.REGION]: true,
|
|
[Modules.API_KEY]: true,
|
|
[Modules.STORE]: true,
|
|
[Modules.TAX]: true,
|
|
[Modules.CURRENCY]: true,
|
|
[Modules.PAYMENT]: true,
|
|
}
|
|
: {}),
|
|
},
|
|
}
|