feat(tests): harmonize and clean-up yarn test commands convention (#3695)

## What

Harmonize and clean-up yarn test commands convention.

## Why

Current strategy to filter integration tests from unit tests was cumbersome to maintain. Also, some packages declared `test:unit` which ended up being an alias to `test`.

## How

* Remove all occurrences of `test:unit`
* Rename all `test` commands under `/integration-tests/**/package.json` to `test:integration`
* In the root `package.json`, rewrite `test:integration` command to run `turbo run test:integration`
* In the root `package.json`, remove filtering on the `test` command
* Introduce a new `test:integration` task in the Turborepo config.
This commit is contained in:
Patrick
2023-04-04 09:47:54 -04:00
committed by GitHub
parent 4bb1f833b1
commit 089f1eb19e
18 changed files with 31 additions and 31 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
feat(tests): harmonize and clean-up yarn test commands convention

View File

@@ -5,7 +5,7 @@
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {
"test": "jest --silent=false --runInBand --bail --detectOpenHandles --forceExit", "test:integration": "jest --silent=false --runInBand --bail --detectOpenHandles --forceExit",
"build": "babel src -d dist --extensions \".ts,.js\"" "build": "babel src -d dist --extensions \".ts,.js\""
}, },
"dependencies": { "dependencies": {

View File

@@ -5,7 +5,7 @@
"main": "jest.config.js", "main": "jest.config.js",
"private": true, "private": true,
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test:integration": "echo \"Error: no test specified\" && exit 1"
}, },
"author": "Zakaria S. El Asri", "author": "Zakaria S. El Asri",
"license": "ISC", "license": "ISC",

View File

@@ -5,7 +5,7 @@
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {
"test": "jest --silent=false --runInBand --bail --detectOpenHandles --forceExit", "test:integration": "jest --silent=false --runInBand --bail --detectOpenHandles --forceExit",
"build": "babel src -d dist --extensions \".ts,.js\"" "build": "babel src -d dist --extensions \".ts,.js\""
}, },
"dependencies": { "dependencies": {

View File

@@ -5,7 +5,7 @@
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {
"test": "jest --silent=false --runInBand --bail --detectOpenHandles --forceExit" "test:integration": "jest --silent=false --runInBand --bail --detectOpenHandles --forceExit"
}, },
"dependencies": { "dependencies": {
"@medusajs/medusa": "1.8.0-rc.6", "@medusajs/medusa": "1.8.0-rc.6",

View File

@@ -70,11 +70,11 @@
"lint:docs": "eslint -c docs/.eslintrc.js --ignore-path docs/.eslintignore docs/content", "lint:docs": "eslint -c docs/.eslintrc.js --ignore-path docs/.eslintignore docs/content",
"prettier": "prettier", "prettier": "prettier",
"jest": "jest", "jest": "jest",
"test": "turbo run test --no-daemon --filter=!integration-tests-api --filter=!integration-tests-plugins --filter=!integration-tests-repositories", "test": "turbo run test --no-daemon",
"test:integration": "turbo run test --no-daemon --filter=integration-tests-api --filter=integration-tests-plugins --filter=integration-tests-repositories", "test:integration": "turbo run test:integration --no-daemon",
"test:integration:api": "turbo run test --no-daemon --filter=integration-tests-api", "test:integration:api": "turbo run test:integration --no-daemon --filter=integration-tests-api",
"test:integration:plugins": "turbo run test --no-daemon --filter=integration-tests-plugins", "test:integration:plugins": "turbo run test:integration --no-daemon --filter=integration-tests-plugins",
"test:integration:repositories": "turbo run test --no-daemon --filter=integration-tests-repositories", "test:integration:repositories": "turbo run test:integration --no-daemon --filter=integration-tests-repositories",
"openapi:generate": "yarn ./packages/oas/oas-github-ci run ci", "openapi:generate": "yarn ./packages/oas/oas-github-ci run ci",
"medusa-oas": "yarn ./packages/oas/medusa-oas-cli run medusa-oas", "medusa-oas": "yarn ./packages/oas/medusa-oas-cli run medusa-oas",
"generate:services": "typedoc --options typedoc.services.js", "generate:services": "typedoc --options typedoc.services.js",

View File

@@ -27,8 +27,7 @@
"watch": "tsc --build --watch", "watch": "tsc --build --watch",
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
}, },
"dependencies": { "dependencies": {
"@medusajs/modules-sdk": "0.1.0-rc.4" "@medusajs/modules-sdk": "0.1.0-rc.4"

View File

@@ -27,8 +27,7 @@
"watch": "tsc --build --watch", "watch": "tsc --build --watch",
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
}, },
"dependencies": { "dependencies": {
"@medusajs/modules-sdk": "0.1.0-rc.4", "@medusajs/modules-sdk": "0.1.0-rc.4",

View File

@@ -27,8 +27,7 @@
"watch": "tsc --build --watch", "watch": "tsc --build --watch",
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
}, },
"dependencies": { "dependencies": {
"@medusajs/modules-sdk": "0.1.0-rc.4", "@medusajs/modules-sdk": "0.1.0-rc.4",

View File

@@ -28,8 +28,7 @@
"watch": "tsc --build --watch", "watch": "tsc --build --watch",
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
}, },
"dependencies": { "dependencies": {
"@medusajs/modules-sdk": "0.1.0-rc.4", "@medusajs/modules-sdk": "0.1.0-rc.4",

View File

@@ -33,7 +33,6 @@
"watch": "tsc --build --watch", "watch": "tsc --build --watch",
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
} }
} }

View File

@@ -35,8 +35,7 @@
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"serve": "node dist/app.js", "serve": "node dist/app.js",
"test": "jest", "test": "jest"
"test:unit": "jest"
}, },
"peerDependencies": { "peerDependencies": {
"@medusajs/types": "0.0.2-rc.1", "@medusajs/types": "0.0.2-rc.1",

View File

@@ -33,7 +33,6 @@
"scripts": { "scripts": {
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"test": "jest", "test": "jest"
"test:unit": "jest"
} }
} }

View File

@@ -32,8 +32,7 @@
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"medusa-oas": "ts-node src/index.ts", "medusa-oas": "ts-node src/index.ts",
"test": "jest src", "test": "jest src"
"test:unit": "jest src"
}, },
"dependencies": { "dependencies": {
"@medusajs/medusa": "1.8.0-rc.6", "@medusajs/medusa": "1.8.0-rc.6",

View File

@@ -18,8 +18,7 @@
"ci": "node scripts/build-openapi.js", "ci": "node scripts/build-openapi.js",
"preview:admin": "yarn redocly preview-docs ../../../docs/api/admin/openapi.yaml --config=../../../docs-util/redocly/config.yaml", "preview:admin": "yarn redocly preview-docs ../../../docs/api/admin/openapi.yaml --config=../../../docs-util/redocly/config.yaml",
"preview:store": "yarn redocly preview-docs ../../../docs/api/store/openapi.yaml --config=../../../docs-util/redocly/config.yaml", "preview:store": "yarn redocly preview-docs ../../../docs/api/store/openapi.yaml --config=../../../docs-util/redocly/config.yaml",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
}, },
"dependencies": { "dependencies": {
"@medusajs/medusa-oas-cli": "0.2.0-rc.6", "@medusajs/medusa-oas-cli": "0.2.0-rc.6",

View File

@@ -22,8 +22,7 @@
"prepare": "cross-env NODE_ENV=production yarn run release", "prepare": "cross-env NODE_ENV=production yarn run release",
"build": "rollup --config --environment NODE_ENV:development", "build": "rollup --config --environment NODE_ENV:development",
"release": "rollup --config --environment NODE_ENV:production", "release": "rollup --config --environment NODE_ENV:production",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
}, },
"dependencies": { "dependencies": {
"camelcase": "^6.3.0", "camelcase": "^6.3.0",

View File

@@ -33,7 +33,6 @@
"watch": "tsc --build --watch", "watch": "tsc --build --watch",
"prepare": "cross-env NODE_ENV=production yarn run build", "prepare": "cross-env NODE_ENV=production yarn run build",
"build": "tsc --build", "build": "tsc --build",
"test": "jest --passWithNoTests", "test": "jest --passWithNoTests"
"test:unit": "jest --passWithNoTests"
} }
} }

View File

@@ -16,6 +16,12 @@
"build" "build"
], ],
"outputs": [] "outputs": []
},
"test:integration": {
"dependsOn": [
"build"
],
"outputs": []
} }
}, },
"globalDependencies": [ "globalDependencies": [