Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(cli): doctor-integration, validate-integration and check-failures fixtures check their own files (#9496)

Christopher Chedeauc7a5c239ee20
diff --git a/packages/cli/api/integration/validate-integration.test.mjs b/packages/cli/api/integration/validate-integration.test.mjs
index 3620b4f8c0..9434840f95 100644
--- a/packages/cli/api/integration/validate-integration.test.mjs
+++ b/packages/cli/api/integration/validate-integration.test.mjs
@@ -662,6 +662,14 @@ describe('integration diagnostics are read-only', () => {
it('leaves local and installed packages byte-for-byte unchanged', async () => {
const pkgDir = path.join(tmpDir, 'pkg');
+ // A TypeScript config scoped to the fixture's own files, beside the
+ // packages: with none, the local package gets the repository's root
+ // config, as `tsc` reads it, and the props comparison compiles every file
+ // in the repository. The installed copy, under `node_modules`, reads none.
+ fs.writeFileSync(
+ path.join(tmpDir, 'tsconfig.json'),
+ `${JSON.stringify({extends: '../tsconfig.json', include: ['**/*']})}\n`,
+ );
writeDiagnosedPackage(pkgDir);
const consumer = path.join(tmpDir, 'consumer');
fs.mkdirSync(consumer, {recursive: true});
diff --git a/packages/cli/clients/cli/commands/doctor-integration.test.mjs b/packages/cli/clients/cli/commands/doctor-integration.test.mjs
index 3d3c3f2258..d41962d99c 100644
--- a/packages/cli/clients/cli/commands/doctor-integration.test.mjs
+++ b/packages/cli/clients/cli/commands/doctor-integration.test.mjs
@@ -116,6 +116,14 @@ beforeEach(() => {
tmpDir = fs.mkdtempSync(
path.join(previousCwd, '.astryx-doctor-integration-'),
);
+ // The fixture's own TypeScript config, scoped to its own files: a package
+ // with none in a folder inside the repository gets the repository's root
+ // config, as `tsc` reads it, and the props comparison compiles every file
+ // in the repository.
+ fs.writeFileSync(
+ path.join(tmpDir, 'tsconfig.json'),
+ `${JSON.stringify({extends: '../tsconfig.json', include: ['**/*']})}\n`,
+ );
logCalls = [];
vi.spyOn(console, 'log').mockImplementation((...args) => {
logCalls.push(args.join(' '));
diff --git a/packages/cli/test/integration-check-failures.test.mjs b/packages/cli/test/integration-check-failures.test.mjs
index bbd5ee980a..362b1237ee 100644
--- a/packages/cli/test/integration-check-failures.test.mjs
+++ b/packages/cli/test/integration-check-failures.test.mjs
@@ -168,6 +168,13 @@ beforeAll(async () => {
fs.mkdirSync(path.dirname(path.join(pkg, rel)), {recursive: true});
fs.writeFileSync(path.join(pkg, rel), text);
};
+ // Its own TypeScript config, scoped to its own files: with none, it gets
+ // the repository's root config, as `tsc` reads it, and the components check
+ // compiles every file in the repository.
+ write(
+ 'tsconfig.json',
+ `${JSON.stringify({extends: '../tsconfig.json', include: ['**/*']})}\n`,
+ );
write(
'package.json',
JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),