diff --git a/.github/workflows/tests-e2e.yml b/.github/workflows/tests-e2e.yml index 06c703a756..f5de0a51e3 100644 --- a/.github/workflows/tests-e2e.yml +++ b/.github/workflows/tests-e2e.yml @@ -9,6 +9,7 @@ on: - package.json - yarn.lock - jest.config.mjs + - jest/** - packages/** - tsconfig.*.json pull_request: @@ -19,6 +20,7 @@ on: - package.json - yarn.lock - jest.config.mjs + - jest/** - packages/** - tsconfig.*.json - admin/verdaccio.yaml diff --git a/.github/workflows/tests-windows.yml b/.github/workflows/tests-windows.yml index c1feb517e8..b967c22d15 100644 --- a/.github/workflows/tests-windows.yml +++ b/.github/workflows/tests-windows.yml @@ -9,6 +9,7 @@ on: - package.json - yarn.lock - jest.config.mjs + - jest/** - packages/** - tsconfig.*.json - .github/workflows/tests-windows.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9a71d589f8..63783b6278 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,6 +9,7 @@ on: - package.json - yarn.lock - jest.config.mjs + - jest/** - packages/** - tsconfig.*.json - .github/workflows/tests.yml diff --git a/jest/snapshotPathNormalizer.ts b/jest/snapshotPathNormalizer.ts index b8a5ec33ab..378344c108 100644 --- a/jest/snapshotPathNormalizer.ts +++ b/jest/snapshotPathNormalizer.ts @@ -10,7 +10,6 @@ import os from 'os'; import path from 'path'; -import fs from 'fs'; import _ from 'lodash'; import {escapePath} from '@docusaurus/utils'; import {version} from '@docusaurus/core/package.json'; @@ -65,29 +64,20 @@ function normalizePaths(value: T): T { } const cwd = process.cwd(); - const cwdReal = getRealPath(cwd); const tempDir = os.tmpdir(); - const tempDirReal = getRealPath(tempDir); const homeDir = os.homedir(); - const homeDirReal = getRealPath(homeDir); const homeRelativeToTemp = path.relative(tempDir, homeDir); - const homeRelativeToTempReal = path.relative(tempDirReal, homeDir); - const homeRealRelativeToTempReal = path.relative(tempDirReal, homeDirReal); - const homeRealRelativeToTemp = path.relative(tempDir, homeDirReal); const runner: ((val: string) => string)[] = [ (val) => (val.includes('keepAnsi') ? val : stripAnsi(val)), // Replace process.cwd with - (val) => val.split(cwdReal).join(''), (val) => val.split(cwd).join(''), // Replace temp directory with - (val) => val.split(tempDirReal).join(''), (val) => val.split(tempDir).join(''), // Replace home directory with - (val) => val.split(homeDirReal).join(''), (val) => val.split(homeDir).join(''), // Handle HOME_DIR nested inside TEMP_DIR @@ -95,18 +85,6 @@ function normalizePaths(value: T): T { val .split(`${path.sep + homeRelativeToTemp}`) .join(''), - (val) => - val - .split(`${path.sep + homeRelativeToTempReal}`) - .join(''), - (val) => - val - .split(`${path.sep + homeRealRelativeToTempReal}`) - .join(''), - (val) => - val - .split(`${path.sep + homeRealRelativeToTemp}`) - .join(''), // Replace the Docusaurus version with a stub (val) => val.split(version).join(''), @@ -136,13 +114,3 @@ function normalizePaths(value: T): T { function shouldUpdate(value: unknown) { return typeof value === 'string' && normalizePaths(value) !== value; } - -function getRealPath(pathname: string) { - try { - // eslint-disable-next-line no-restricted-properties - const realPath = fs.realpathSync(pathname); - return realPath; - } catch (err) { - return pathname; - } -}