fix: make plugin tests run with integration test suites (#1101)
* fix: make plugin tests run with integration test suites" * add: plugins to test pipeline * add: run integration tests on different jobs + fix failing test command * fix: typo * fix: pipeline
This commit is contained in:
committed by
olivermrbl
parent
4d1c8e1ec5
commit
2cfe56ad0d
@@ -1,5 +1,5 @@
|
|||||||
name: Medusa Pipeline
|
name: Medusa Pipeline
|
||||||
on: [push, pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-tests:
|
unit-tests:
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: yarn test
|
run: yarn test
|
||||||
|
|
||||||
integration-tests:
|
integration-tests-api:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
@@ -73,7 +73,68 @@ jobs:
|
|||||||
uses: ./.github/actions/cache-bootstrap
|
uses: ./.github/actions/cache-bootstrap
|
||||||
with:
|
with:
|
||||||
extension: integration-tests
|
extension: integration-tests
|
||||||
|
|
||||||
|
- name: Build Packages
|
||||||
|
run: lerna run build
|
||||||
|
|
||||||
|
- name: Install dev cli
|
||||||
|
run: sudo npm i -g medusa-dev-cli
|
||||||
|
|
||||||
|
- name: Set path to medusa repo
|
||||||
|
run: medusa-dev --set-path-to-repo `pwd`
|
||||||
|
|
||||||
|
- name: Force install API
|
||||||
|
run: medusa-dev --force-install
|
||||||
|
working-directory: integration-tests/api
|
||||||
|
|
||||||
|
- name: Build integration tests
|
||||||
|
run: yarn build
|
||||||
|
working-directory: integration-tests/api
|
||||||
|
|
||||||
|
- name: Run API integration tests
|
||||||
|
run: yarn test:integration:api --maxWorkers=50% --silent=false
|
||||||
|
env:
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
|
||||||
|
integration-tests-plugins:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Cancel Previous Runs
|
||||||
|
uses: styfle/cancel-workflow-action@0.9.1
|
||||||
|
with:
|
||||||
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2.3.5
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Node.js environment
|
||||||
|
uses: actions/setup-node@v2.4.1
|
||||||
|
with:
|
||||||
|
node-version: "14"
|
||||||
|
cache: "yarn"
|
||||||
|
|
||||||
|
- name: Bootstrap packages
|
||||||
|
uses: ./.github/actions/cache-bootstrap
|
||||||
|
with:
|
||||||
|
extension: integration-tests
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: lerna run build
|
run: lerna run build
|
||||||
|
|
||||||
@@ -85,13 +146,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Force install
|
- name: Force install
|
||||||
run: medusa-dev --force-install
|
run: medusa-dev --force-install
|
||||||
working-directory: integration-tests/api
|
working-directory: integration-tests/plugins
|
||||||
|
|
||||||
- name: Build integration tests
|
- name: Build plugin integration tests
|
||||||
run: yarn build
|
run: yarn build
|
||||||
working-directory: integration-tests/api
|
working-directory: integration-tests/plugins
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run plugin integration tests
|
||||||
run: yarn test:integration --maxWorkers=50% --silent=false
|
run: yarn test:integration:plugins --maxWorkers=50% --silent=false
|
||||||
env:
|
env:
|
||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// API
|
// API
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
name: "api",
|
||||||
testEnvironment: `node`,
|
testEnvironment: `node`,
|
||||||
|
rootDir: "./",
|
||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
`/examples/`,
|
`/examples/`,
|
||||||
`/www/`,
|
`/www/`,
|
||||||
@@ -11,6 +13,7 @@ module.exports = {
|
|||||||
`__testfixtures__`,
|
`__testfixtures__`,
|
||||||
`.cache`,
|
`.cache`,
|
||||||
],
|
],
|
||||||
|
transformIgnorePatterns: [`/dist`],
|
||||||
transform: { "^.+\\.[jt]s$": `../../jest-transformer.js` },
|
transform: { "^.+\\.[jt]s$": `../../jest-transformer.js` },
|
||||||
setupFilesAfterEnv: ["../setup.js"],
|
setupFilesAfterEnv: ["../setup.js"],
|
||||||
globalSetup: "../globalSetup.js",
|
globalSetup: "../globalSetup.js",
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ module.exports = {
|
|||||||
globalTeardown: "<rootDir>/integration-tests/globalTeardown.js",
|
globalTeardown: "<rootDir>/integration-tests/globalTeardown.js",
|
||||||
rootDir: `../`,
|
rootDir: `../`,
|
||||||
roots: pkgs,
|
roots: pkgs,
|
||||||
|
projects: [
|
||||||
|
"<rootDir>/integration-tests/api/jest.config.js",
|
||||||
|
"<rootDir>/integration-tests/plugins/jest.config.js",
|
||||||
|
],
|
||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
`/examples/`,
|
`/examples/`,
|
||||||
`/www/`,
|
`/www/`,
|
||||||
`/dist/`,
|
`/dist/`,
|
||||||
`/node_modules/`,
|
`/node_modules/`,
|
||||||
`/plugins/`,
|
|
||||||
`__tests__/fixtures`,
|
`__tests__/fixtures`,
|
||||||
`__testfixtures__`,
|
`__testfixtures__`,
|
||||||
`.cache`,
|
`.cache`,
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ const { setPort, useApi } = require("../../../helpers/use-api")
|
|||||||
|
|
||||||
const adminSeeder = require("../../helpers/admin-seeder")
|
const adminSeeder = require("../../helpers/admin-seeder")
|
||||||
|
|
||||||
|
jest.setTimeout(30000)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
simpleOrderFactory,
|
simpleOrderFactory,
|
||||||
simpleStoreFactory,
|
simpleStoreFactory,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// API
|
process.chdir(__dirname)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
name: "Plugins",
|
||||||
testEnvironment: `node`,
|
testEnvironment: `node`,
|
||||||
|
rootDir: "./",
|
||||||
testPathIgnorePatterns: [
|
testPathIgnorePatterns: [
|
||||||
`/examples/`,
|
`/examples/`,
|
||||||
`/www/`,
|
`/www/`,
|
||||||
|
|||||||
@@ -62,6 +62,8 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"prettier": "prettier",
|
"prettier": "prettier",
|
||||||
"test:integration": "jest --config=integration-tests/jest.config.js",
|
"test:integration": "jest --config=integration-tests/jest.config.js",
|
||||||
|
"test:integration:api": "jest --config=integration-tests/jest.config.js --projects=integration-tests/api",
|
||||||
|
"test:integration:plugins": "jest --config=integration-tests/jest.config.js --projects=integration-tests/plugins",
|
||||||
"test:fixtures": "jest --config=docs-util/jest.config.js --runInBand"
|
"test:fixtures": "jest --config=docs-util/jest.config.js --runInBand"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user