Skip to content

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

TypeScript

test(cli): the doctor golden's project installs Core's peers itself, so where the checkout lives cannot change the result (#10001)

nynexman446446803c55c5e1
diff --git a/packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json b/packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json
index 20af76fde9..89c6af617f 100644
--- a/packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json
+++ b/packages/cli/test/__golden__/no-icon-set/doctor-installed-set.json
@@ -75,9 +75,8 @@
{
"id": "peer-deps",
"label": "<text>",
- "status": "warn",
- "message": "<text> 0.19.0",
- "fix": "<text>"
+ "status": "pass",
+ "message": "<text>"
},
{
"id": "package-manager",
@@ -126,8 +125,8 @@
}
],
"summary": {
- "pass": 11,
- "warn": 2,
+ "pass": 12,
+ "warn": 1,
"fail": 0,
"info": 5
}
diff --git a/packages/cli/test/experimental-isolation.test.mjs b/packages/cli/test/experimental-isolation.test.mjs
index e1c0779fb7..81144a6518 100644
--- a/packages/cli/test/experimental-isolation.test.mjs
+++ b/packages/cli/test/experimental-isolation.test.mjs
@@ -1322,8 +1322,26 @@ describe('with icon sets installed but no experimental.iconSet, stable output is
expect(readers.sort()).toEqual(Object.keys(ICON_SET_READERS).sort());
});
+ // Doctor looks for Core's peers in the node_modules of a fixed number of
+ // folders above the project, and that search can leave the checkout. In a
+ // checkout nested inside another checkout's folder, it finds the outer
+ // install. So the project installs each peer itself, from Core's own
+ // install, and the result does not depend on where the checkout is.
it('doctor reports nothing about an invalid installed set', async () => {
const cwd = installed('doctor', '{nope');
+ const core = path.join(PROJECTS_ROOT, 'packages', 'core');
+ const {peerDependencies} = JSON.parse(
+ fs.readFileSync(path.join(core, 'package.json'), 'utf8'),
+ );
+ for (const name of Object.keys(peerDependencies)) {
+ const link = path.join(cwd, 'node_modules', ...name.split('/'));
+ fs.mkdirSync(path.dirname(link), {recursive: true});
+ fs.symlinkSync(
+ fs.realpathSync(path.join(core, 'node_modules', ...name.split('/'))),
+ link,
+ 'dir',
+ );
+ }
const res = astryx(['doctor', '--json'], cwd);
expect(res.stdout).not.toMatch(/icon/i);
await expect(withoutComputerChecks(res.stdout)).toMatchFileSnapshot(