@untestutils/cli 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@untestutils/cli",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "CLI for untestutils: init, convert, ai, doctor, and monorepo commands",
5
5
  "homepage": "https://s00d.github.io/untestutils/",
6
6
  "license": "MIT",
@@ -40,9 +40,9 @@
40
40
  "pathe": "^2.0.3",
41
41
  "tinyglobby": "^0.2.17",
42
42
  "tsx": "^4.23.13",
43
- "@untestutils/ai": "0.5.3",
44
- "@untestutils/perf": "0.5.3",
45
- "@untestutils/core": "0.5.3"
43
+ "@untestutils/ai": "0.5.4",
44
+ "@untestutils/perf": "0.5.4",
45
+ "@untestutils/core": "0.5.4"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^26.6.1",
@@ -35,6 +35,7 @@ export const doctorCommand: CommandDef<typeof doctorArgs> = defineCommand({
35
35
  const cwd = resolve(String(args.cwd));
36
36
  const checks: Check[] = [];
37
37
  const mono = findMonorepoRoot(cwd);
38
+ const inMono = Boolean(mono && (cwd === mono || cwd.startsWith(`${mono}/`)));
38
39
 
39
40
  const major = Number(process.versions.node.split('.')[0]);
40
41
  checks.push({
@@ -45,14 +46,14 @@ export const doctorCommand: CommandDef<typeof doctorArgs> = defineCommand({
45
46
 
46
47
  for (const id of ['untestutils', 'vitest'] as const) {
47
48
  checks.push({
48
- ok: canResolve(id, cwd) || Boolean(mono),
49
+ ok: canResolve(id, cwd) || inMono,
49
50
  label: `package ${id}`,
50
51
  hint: `pnpm add -D ${id}`,
51
52
  });
52
53
  }
53
54
 
54
55
  for (const id of ['@playwright/test', 'playwright-core', 'nuxt'] as const) {
55
- const ok = canResolve(id, cwd) || (Boolean(mono) && id !== 'nuxt');
56
+ const ok = canResolve(id, cwd) || (inMono && id !== 'nuxt');
56
57
  checks.push({
57
58
  ok,
58
59
  optional: true,
@@ -69,7 +70,7 @@ export const doctorCommand: CommandDef<typeof doctorArgs> = defineCommand({
69
70
  'playwright.config.mts',
70
71
  'vitest.unit.config.ts',
71
72
  ];
72
- const hasConfig = Boolean(mono) || configCandidates.some((f) => existsSync(join(cwd, f)));
73
+ const hasConfig = inMono || configCandidates.some((f) => existsSync(join(cwd, f)));
73
74
  checks.push({
74
75
  ok: hasConfig,
75
76
  label: 'vitest/playwright config',
@@ -77,7 +78,7 @@ export const doctorCommand: CommandDef<typeof doctorArgs> = defineCommand({
77
78
  });
78
79
 
79
80
  const hasRecipes =
80
- Boolean(mono) ||
81
+ inMono ||
81
82
  existsSync(join(cwd, 'recipes.ts')) ||
82
83
  existsSync(join(cwd, 'tests/recipes.ts')) ||
83
84
  existsSync(join(cwd, 'e2e/recipes.ts'));
@@ -56,7 +56,16 @@ export const initCommand: CommandDef<typeof initArgs> = defineCommand({
56
56
  const deps = peersForPreset(preset);
57
57
  consola.start(`Installing dependencies: ${deps.join(', ')}`);
58
58
  try {
59
- await addDependency(deps, { cwd, silent: false });
59
+ // Fresh projects often have no lockfile — nypm cannot auto-detect. Prefer
60
+ // detected PM, else pnpm (matches engines/docs), always as -D.
61
+ const { detectPackageManager } = await import('nypm');
62
+ const detected = await detectPackageManager(cwd, { includeParentDirs: false });
63
+ await addDependency(deps, {
64
+ cwd,
65
+ silent: false,
66
+ packageManager: detected?.name ?? 'pnpm',
67
+ dev: true,
68
+ });
60
69
  consola.success('Dependencies installed');
61
70
  } catch (e) {
62
71
  consola.warn(`Could not install automatically: ${e}`);
@@ -7,20 +7,26 @@ export type InitPreset = 'vitest' | 'playwright' | 'nuxt' | 'full';
7
7
 
8
8
  /** Relative template paths under src/templates */
9
9
  const PRESET_FILES: Record<InitPreset, string[]> = {
10
- vitest: ['vitest/vitest.config.ts', 'vitest/recipes.ts', 'vitest/tests/e2e/smoke.test.ts'],
10
+ vitest: [
11
+ 'vitest/vitest.config.ts',
12
+ 'vitest/recipes.ts',
13
+ 'vitest/tests/e2e/smoke.test.ts',
14
+ 'vitest/fixtures/basic/index.html',
15
+ ],
11
16
  playwright: [
12
17
  'playwright/playwright.config.ts',
13
18
  'playwright/recipes.ts',
14
19
  'playwright/tests/e2e/smoke.spec.ts',
20
+ 'vitest/fixtures/basic/index.html',
15
21
  ],
16
22
  nuxt: ['nuxt/vitest.config.ts', 'nuxt/recipes.ts', 'nuxt/tests/e2e/smoke.test.ts'],
17
23
  full: [
18
24
  'vitest/vitest.config.ts',
19
25
  'playwright/playwright.config.ts',
20
- 'nuxt/recipes.ts',
26
+ 'vitest/recipes.ts',
21
27
  'vitest/tests/e2e/smoke.test.ts',
22
28
  'playwright/tests/e2e/smoke.spec.ts',
23
- 'nuxt/tests/e2e/nuxt-smoke.test.ts',
29
+ 'vitest/fixtures/basic/index.html',
24
30
  ],
25
31
  };
26
32
 
@@ -10,6 +10,7 @@ export default defineConfig(
10
10
  workers: 2,
11
11
  fullyParallel: true,
12
12
  testDir: './tests/e2e',
13
+ testMatch: '**/*.spec.ts',
13
14
  use: {
14
15
  headless: true,
15
16
  },
@@ -0,0 +1,10 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>untestutils fixture</title>
6
+ </head>
7
+ <body>
8
+ <h1>ok</h1>
9
+ </body>
10
+ </html>