diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ecd10807..4d0d28fd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -59,7 +59,7 @@ jobs: - name: Build test app run: npm run build:test - name: Run standalone tests - run: npm run test:standalone tests/format tests/integration tests/unit/prettier-version + run: npm run test:standalone test_linux: name: Test on Linux with Node ${{ matrix.node }} diff --git a/jest.config.js b/jest.config.js index dd7f0f5f..de1dc5c4 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,11 +1,13 @@ const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE); -const testMatch = [ - '/tests/format/**/jsfmt.spec.js', - '/tests/unit/**/*.test.js' -]; +const testMatch = ['/tests/format/**/jsfmt.spec.js']; if (TEST_STANDALONE) { - testMatch.push('/tests/integration/**/*.test.js'); + testMatch.push( + '/tests/integration/**/*.test.js', + '/tests/unit/prettier-version/**/*.test.js' + ); +} else { + testMatch.push('/tests/unit/**/*.test.js'); } export default { diff --git a/package.json b/package.json index 4cd82d38..7d6639d1 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "prettier": "prettier './*.{ts,js,cjs,json,md,yml}' '{src,tests}/**/*.{ts,js,cjs}'", "test": "NODE_OPTIONS=\"--loader=ts-node/esm --loader=esmock\" jest", "test:all": "cross-env FULL_TEST=1 NODE_OPTIONS=\"--loader=ts-node/esm --loader=esmock\" c8 jest", - "test:standalone": "cross-env NODE_OPTIONS=\"--loader=ts-node/esm\" TEST_STANDALONE=1 FULL_TEST=1 jest" + "test:standalone": "cross-env TEST_STANDALONE=1 FULL_TEST=1 jest" }, "files": [ "src", diff --git a/tests/config/get-prettier.js b/tests/config/get-prettier.js index 5d72040c..6a744629 100644 --- a/tests/config/get-prettier.js +++ b/tests/config/get-prettier.js @@ -1,7 +1,7 @@ function getPrettierInternal() { const entry = process.env.TEST_STANDALONE ? new URL("./require-standalone.cjs", import.meta.url) - : new URL("./require-prettier.cjs", import.meta.url); + : "prettier"; return import(entry).then((module) => module.default); } diff --git a/tests/config/require-prettier.cjs b/tests/config/require-prettier.cjs deleted file mode 100644 index f0fa1e6d..00000000 --- a/tests/config/require-prettier.cjs +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -const prettier = require("prettier"); - -module.exports = prettier;