feat: Add http integration tests and enable them in pipeline (#7532)

This commit is contained in:
Stevche Radevski
2024-05-30 10:51:31 +02:00
committed by GitHub
parent 5ad6864b82
commit 6698f3ab7b
13 changed files with 774 additions and 1111 deletions

4
integration-tests/http/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
dist/
node_modules
*yarn-error.log

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
process.chdir(__dirname)
module.exports = {
name: "HTTP Integration Tests",
testEnvironment: `node`,
rootDir: "./",
transformIgnorePatterns: ["/dist", "/node_modules/"],
transform: {
"^.+\\.[jt]s$": ["@swc/jest"],
},
setupFiles: ["../setup-env.js"],
}

View File

@@ -0,0 +1,19 @@
const { defineConfig } = require("@medusajs/utils")
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}`
process.env.DATABASE_URL = DB_URL
process.env.LOG_LEVEL = "error"
module.exports = defineConfig({
admin: {
disable: true,
},
projectConfig: {
http: {
jwtSecret: "test",
},
},
})

View File

@@ -0,0 +1,45 @@
{
"name": "integration-tests-http",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"scripts": {
"test:integration": "jest --no-cache --maxWorkers=50% --bail --detectOpenHandles --forceExit --logHeapUsage",
"test:integration:chunk": "jest --silent --no-cache --bail --maxWorkers=50% --forceExit --testPathPattern=$(echo $CHUNKS | jq -r \".[${CHUNK}] | .[]\")",
"build": "tsc ./src/* --allowJs --outDir ./dist"
},
"dependencies": {
"@medusajs/api-key": "workspace:^",
"@medusajs/auth": "workspace:*",
"@medusajs/cache-inmemory": "workspace:*",
"@medusajs/customer": "workspace:^",
"@medusajs/event-bus-local": "workspace:*",
"@medusajs/fulfillment": "workspace:^",
"@medusajs/fulfillment-manual": "workspace:^",
"@medusajs/inventory-next": "workspace:^",
"@medusajs/medusa": "workspace:*",
"@medusajs/modules-sdk": "workspace:^",
"@medusajs/pricing": "workspace:^",
"@medusajs/product": "workspace:^",
"@medusajs/promotion": "workspace:^",
"@medusajs/region": "workspace:^",
"@medusajs/stock-location-next": "workspace:^",
"@medusajs/store": "workspace:^",
"@medusajs/tax": "workspace:^",
"@medusajs/user": "workspace:^",
"@medusajs/utils": "workspace:^",
"@medusajs/workflow-engine-inmemory": "workspace:*",
"faker": "^5.5.3",
"medusa-test-utils": "workspace:*",
"pg": "^8.11.0"
},
"devDependencies": {
"@medusajs/types": "workspace:^",
"@swc/core": "^1.4.8",
"@swc/jest": "^0.2.36",
"jest": "^26.6.3",
"jest-environment-node": "26.6.2",
"typescript": "^4.1.3"
}
}

View File

@@ -0,0 +1 @@
// noop