diff --git a/.github/workflows/dev-package-test.yml b/.github/workflows/dev-package-test.yml index 24f4ef1a6..b32473aae 100644 --- a/.github/workflows/dev-package-test.yml +++ b/.github/workflows/dev-package-test.yml @@ -47,7 +47,4 @@ jobs: run: npm install --global pnpm - name: Run Tests - run: yarn test:dev-package:integration --maxWorkers=2 - - - name: Run Tests - run: yarn test:dev-package:format --maxWorkers=2 + run: yarn test:dev-package --maxWorkers=2 diff --git a/.github/workflows/dev-test.yml b/.github/workflows/dev-test.yml index 67abeed7b..7fe1e7a71 100644 --- a/.github/workflows/dev-test.yml +++ b/.github/workflows/dev-test.yml @@ -86,7 +86,7 @@ jobs: # #8073 test - name: Run Tests (PRETTIER_FALLBACK_RESOLVE) - run: yarn c8 yarn test:integration "tests/integration/__tests__/(config|plugin)" + run: yarn test "tests/integration/__tests__/(config|plugin)" env: PRETTIER_FALLBACK_RESOLVE: true diff --git a/.github/workflows/prod-test.yml b/.github/workflows/prod-test.yml index 0dccc4083..c529c1319 100644 --- a/.github/workflows/prod-test.yml +++ b/.github/workflows/prod-test.yml @@ -65,7 +65,7 @@ jobs: path: dist - name: Lint Code - run: yarn test:dist:lint + run: yarn test:dist-lint test: timeout-minutes: 90 @@ -113,33 +113,25 @@ jobs: name: dist path: dist - - name: Run Integration Tests (macOS) + - name: Run Tests (macOS) if: ${{ matrix.os == 'macos-latest' }} - run: yarn test:dist:integration --maxWorkers=4 + run: yarn test:dist --maxWorkers=4 - - name: Run Integration Tests (Linux and Windows) + - name: Run Tests (Linux and Windows) if: ${{ matrix.os != 'macos-latest' }} - run: yarn test:dist:integration --maxWorkers=2 - - - name: Run Format Tests (macOS) - if: ${{ matrix.os == 'macos-latest' }} - run: yarn test:dist:format --maxWorkers=4 - - - name: Run Format Tests (Linux and Windows) - if: ${{ matrix.os != 'macos-latest' }} - run: yarn test:dist:format --maxWorkers=2 + run: yarn test:dist --maxWorkers=2 - name: Run Format Tests (standalone) (macOS) if: ${{ matrix.os == 'macos-latest' }} - run: yarn test:dist:standalone:format --maxWorkers=4 + run: yarn test:dist-standalone --maxWorkers=4 - name: Run Format Tests (standalone) (Linux and Windows) if: ${{ matrix.os != 'macos-latest' }} - run: yarn test:dist:standalone:format --maxWorkers=2 + run: yarn test:dist-standalone --maxWorkers=2 # #8073 test - name: Run Tests (PRETTIER_FALLBACK_RESOLVE) - run: yarn test:dist:integration "tests/integration/__tests__/(config|plugin)" + run: yarn test "tests/integration/__tests__/(config|plugin)" env: NODE_ENV: production PRETTIER_FALLBACK_RESOLVE: true diff --git a/jest-format-test.config.mjs b/jest-format-test.config.mjs index 1fcb84309..f7b95a30c 100644 --- a/jest-format-test.config.mjs +++ b/jest-format-test.config.mjs @@ -1,9 +1,11 @@ import baseConfig from "./jest.config.mjs"; const config = { + ...baseConfig, runner: "./tests/config/jest-light-runner", testRegex: "tests/format/.*/jsfmt\\.spec\\.js$", - ...baseConfig, + setupFiles: ["/tests/config/setup.js"], + projects: [], }; export default config; diff --git a/jest-integration-test.config.mjs b/jest-integration-test.config.mjs index 99106b6bb..85d61c55e 100644 --- a/jest-integration-test.config.mjs +++ b/jest-integration-test.config.mjs @@ -1,8 +1,9 @@ import baseConfig from "./jest.config.mjs"; const config = { - testRegex: "tests/integration/__tests__/.*\\.js$", ...baseConfig, + testRegex: "tests/integration/__tests__/.*\\.js$", + projects: [], }; export default config; diff --git a/jest.config.mjs b/jest.config.mjs index 60e0837a5..64165aecb 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -29,7 +29,10 @@ if (!isProduction) { } const config = { - setupFiles: ["/tests/config/setup.js"], + projects: [ + "/jest-format-test.config.mjs", + "/jest-integration-test.config.mjs", + ], snapshotSerializers: [ "jest-snapshot-serializer-raw", "jest-snapshot-serializer-ansi", diff --git a/package.json b/package.json index 716c61f86..184016b74 100644 --- a/package.json +++ b/package.json @@ -136,14 +136,13 @@ }, "scripts": { "prepublishOnly": "echo \"Error: must publish from dist/\" && exit 1", - "test:integration": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --config=jest-integration-test.config.mjs", - "test:format": "jest --config=jest-format-test.config.mjs", - "test:dev-package:integration": "cross-env INSTALL_PACKAGE=1 yarn test:integration", - "test:dev-package:format": "cross-env INSTALL_PACKAGE=1 yarn test:format", - "test:dist:lint": "eslint --no-eslintrc --no-ignore --no-inline-config --config=./scripts/bundle-eslint-config.js \"dist/!(bin-prettier|index|third-party).js\"", - "test:dist:integration": "cross-env NODE_ENV=production yarn test:integration", - "test:dist:format": "cross-env NODE_ENV=production yarn test:format", - "test:dist:standalone:format": "cross-env TEST_STANDALONE=1 yarn test:dist:format", + "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest", + "test:integration": "yarn test --config=jest-integration-test.config.mjs", + "test:format": "yarn test --config=jest-format-test.config.mjs", + "test:dev-package": "cross-env INSTALL_PACKAGE=1 yarn test", + "test:dist": "cross-env NODE_ENV=production yarn test", + "test:dist-standalone": "cross-env TEST_STANDALONE=1 yarn test:dist", + "test:dist-lint": "eslint --no-eslintrc --no-ignore --no-inline-config --config=./scripts/bundle-eslint-config.js \"dist/!(bin-prettier|index|third-party).js\"", "perf:repeat": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null", "perf:repeat-inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null", "perf:benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",