Skip to content

Commit

Permalink
Separate PHP and JS Unit Tests (woocommerce#40639)
Browse files Browse the repository at this point in the history
Since some projects might have both kinds of tests we are
going to have a `test:php` and a `test:js` script for each.
  • Loading branch information
ObliviousHarmony authored Oct 6, 2023
1 parent e7711f1 commit 1c30563
Show file tree
Hide file tree
Showing 38 changed files with 118 additions and 24 deletions.
4 changes: 4 additions & 0 deletions packages/js/ai/changelog/update-separate-php-and-js-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name --",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
Expand Down
4 changes: 4 additions & 0 deletions packages/js/api/changelog/update-separate-php-and-js-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"scripts": {
"turbo:build": "pnpm run clean && npm run compile",
"turbo:test": "jest",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"prepare": "composer install",
"changelog": "composer exec -- changelogger",
"clean": "rm -rf ./dist ./tsconfig.tsbuildinfo",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/block-templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
"prepare": "composer install",
"changelog": "composer exec -- changelogger",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json --ext=js,ts,tsx src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/csv-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/currency/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/customer-effort-score/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
Expand Down
4 changes: 4 additions & 0 deletions packages/js/data/changelog/update-separate-php-and-js-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
Expand Down
4 changes: 4 additions & 0 deletions packages/js/date/changelog/update-separate-php-and-js-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/date/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
Expand Down
4 changes: 4 additions & 0 deletions packages/js/explat/changelog/update-separate-php-and-js-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/explat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/integrate-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/navigation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
Expand Down
4 changes: 4 additions & 0 deletions packages/js/number/changelog/update-separate-php-and-js-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/number/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\"",
"prepack": "pnpm run clean && pnpm run build",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/onboarding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
"start": "concurrently \"tsc --project tsconfig.json --watch\" \"tsc --project tsconfig-cjs.json --watch\" \"webpack --watch\"",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"prepack": "pnpm run clean && pnpm run build",
"lint:fix": "eslint src --fix",
"test-staged": "jest --bail --config ./jest.config.json --findRelatedTests"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

3 changes: 2 additions & 1 deletion packages/js/product-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@
"changelog": "composer exec -- changelogger",
"clean": "pnpm exec rimraf tsconfig.tsbuildinfo build build-*",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "eslint --output-file eslint_report.json --format json src",
"build:js": "tsc --project tsconfig.json && tsc --project tsconfig-cjs.json",
"build:css": "webpack",
Expand Down
3 changes: 2 additions & 1 deletion plugins/woocommerce-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"turbo:test": "pnpm run test:client",
"analyze": "cross-env NODE_ENV=production ANALYZE=true webpack",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "pnpm run lint:js && pnpm run lint:css",
"build:feature-config": "php ../woocommerce/bin/generate-feature-config.php",
"clean": "rimraf ../woocommerce/assets/client/admin/*",
Expand Down
7 changes: 5 additions & 2 deletions plugins/woocommerce-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
"build": "wp-scripts build",
"start": "wp-scripts start",
"postinstall": "composer install",
"test:env-setup": "wp-env start && wp-env run cli --env-cwd=wp-content/plugins/woocommerce-docs composer install",
"test:unit": "pnpm run test:env-setup && wp-env run tests-cli vendor/bin/phpunit --env-cwd=wp-content/plugins/woocommerce-docs"
"test": "pnpm test:php",
"test:env:start": "wp-env start && wp-env run cli --env-cwd=wp-content/plugins/woocommerce-docs composer install",
"test:php": "wp-env run tests-cli vendor/bin/phpunit --env-cwd=wp-content/plugins/woocommerce-docs",
"test:env-setup": "pnpm test:env:start",
"test:unit": "pnpm test:env:start && pnpm test:php"
},
"keywords": [],
"author": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: This is just a change to developer commands.

10 changes: 7 additions & 3 deletions plugins/woocommerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"postinstall": "composer install",
"changelog": "composer exec -- changelogger",
"build": "pnpm -w exec turbo run turbo:build --filter=$npm_package_name",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"lint": "pnpm lint:php",
"build:feature-config": "php bin/generate-feature-config.php",
"build:zip": "./bin/build-zip.sh",
Expand Down Expand Up @@ -48,8 +49,11 @@
"make:collection": "pnpm exec wc-api-tests make:collection",
"e2e:debug": "pnpm exec wc-e2e test:e2e-debug",
"e2e:dev": "pnpm exec wc-e2e test:e2e-dev",
"test:unit": "./vendor/bin/phpunit -c ./phpunit.xml",
"test:unit:env": "wp-env run --env-cwd='wp-content/plugins/woocommerce' tests-cli vendor/bin/phpunit -c phpunit.xml --verbose",
"test:env:start": "pnpm env:test",
"test:php": "./vendor/bin/phpunit -c ./phpunit.xml",
"test:php:env": "wp-env run --env-cwd='wp-content/plugins/woocommerce' tests-cli vendor/bin/phpunit -c phpunit.xml --verbose",
"test:unit": "pnpm test:php",
"test:unit:env": "pnpm test:php:env",
"makepot": "composer run-script makepot",
"packages:fix:textdomain": "node ./bin/package-update-textdomain.js"
},
Expand Down
3 changes: 2 additions & 1 deletion tools/code-analyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"scripts": {
"lint": "eslint . --ext .ts",
"turbo:test": "jest",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name",
"analyzer": "node -r ts-node/register ./src/commands/analyzer/index.ts"
},
"engines": {
Expand Down
3 changes: 2 additions & 1 deletion tools/monorepo-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"lint": "eslint . --ext .ts",
"postinstall": "pnpm run build",
"turbo:test": "jest",
"test": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name"
"test": "pnpm test:js",
"test:js": "pnpm -w exec turbo run turbo:test --filter=$npm_package_name"
},
"engines": {
"node": "^16.14.1",
Expand Down

0 comments on commit 1c30563

Please sign in to comment.