An open source design system that's fully customizable and agent ready
TypeScript
test(scripts): the touched-components, rtl-coverage and change-scope tests resolve paths from the file URL (carries #10493) (#10683)
Cindy Zhangee8fc869b9ca
diff --git a/.github/scripts/change-scope.test.mjs b/.github/scripts/change-scope.test.mjsindex 7b0d092740..8a314659dc 100644--- a/.github/scripts/change-scope.test.mjs+++ b/.github/scripts/change-scope.test.mjs@@ -5,6 +5,7 @@ import fs from 'node:fs';import {createRequire} from 'node:module';import os from 'node:os';import path from 'node:path';+import {fileURLToPath} from 'node:url';import {describe, expect, it} from 'vitest';const require = createRequire(import.meta.url);@@ -573,7 +574,7 @@ describe('shared infrastructure only the Vitest module graph reaches (spec:AST-0const result = spawnSync('node',[- new URL('./change-scope.cjs', import.meta.url).pathname,+ fileURLToPath(new URL('./change-scope.cjs', import.meta.url)),'--github-output',],{diff --git a/.github/scripts/rtl-audit-coverage.test.mjs b/.github/scripts/rtl-audit-coverage.test.mjsindex b0b4f2f788..8f0b80a246 100644--- a/.github/scripts/rtl-audit-coverage.test.mjs+++ b/.github/scripts/rtl-audit-coverage.test.mjs@@ -5,6 +5,7 @@*/import fs from 'node:fs';+import {fileURLToPath} from 'node:url';import {JSDOM} from 'jsdom';import {describe, expect, it} from 'vitest';import componentPackages from '../../scripts/component-packages.cjs';@@ -722,7 +723,7 @@ describe('documented components outside component directories', () => {it('finds Core Theme-family exports that live in a lowercase directory', () => {const names =componentPackages.documentedComponentsOutsideComponentDirectories(- new URL('../..', import.meta.url).pathname,+ fileURLToPath(new URL('../..', import.meta.url)),componentPackages.componentPackage('core'),);expect(names).toEqual(expect.arrayContaining(['MediaTheme', 'Theme']));diff --git a/.github/scripts/touched-components.test.mjs b/.github/scripts/touched-components.test.mjsindex bd7e00cf04..0ff3994b46 100644--- a/.github/scripts/touched-components.test.mjs+++ b/.github/scripts/touched-components.test.mjs@@ -926,6 +926,7 @@ describe('the audit of changed stories no other audit covers', () => {const os = await import('node:os');const path = await import('node:path');const {execFileSync} = await import('node:child_process');+ const {fileURLToPath} = await import('node:url');const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'touched-stories-'));try {const run = files => {@@ -936,7 +937,7 @@ describe('the audit of changed stories no other audit covers', () => {execFileSync('node',[- new URL('./touched-components.mjs', import.meta.url).pathname,+ fileURLToPath(new URL('./touched-components.mjs', import.meta.url)),'scope','--analysis',path.join(dir, 'analysis.json'),@@ -971,6 +972,7 @@ describe('the audit of changed stories no other audit covers', () => {const os = await import('node:os');const path = await import('node:path');const {execFileSync} = await import('node:child_process');+ const {fileURLToPath} = await import('node:url');const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'touched-contracts-'));try {const owners = [@@ -995,7 +997,7 @@ describe('the audit of changed stories no other audit covers', () => {execFileSync('node',[- new URL('./touched-components.mjs', import.meta.url).pathname,+ fileURLToPath(new URL('./touched-components.mjs', import.meta.url)),'scope','--analysis',path.join(dir, 'analysis.json'),