Skip to content

Commit 43c58ca

Browse files
committed
test(snap): cover bare vp lint / vp fmt --check at the workspace root
Adds claim 2c/2d to probe deeper cwds where lint and fmt diverge (lint stays on oxlint defaults from pkg-a/src, fmt walks up to pkg-a's vite.config.ts), and replaces the targeted per-package lint commands in claim 3 with the bare `vp lint --threads=1` / `vp fmt --check` invocations a user would actually run. `--threads=1` keeps the multi-error output order stable across snapshot runs.
1 parent 234da41 commit 43c58ca

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed

packages/cli/snap-tests/docs-nested-config/snap.txt

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,36 @@ src/index.js (<variable>ms)
4141
Format issues found in above 1 files. Run without `--check` to fix.
4242
Finished in <variable>ms on 1 files using <variable> threads.
4343

44-
> # Claim 3: from the workspace root the root config applies to every file,
45-
> # including files in pkg-a that have their own vite.config.ts (not merged,
46-
> # and not resolved per-file). Running against each package separately keeps
47-
> # the snap output stable regardless of oxlint's parallel scheduling.
48-
[1]> vp lint packages/pkg-a/src
44+
> # Claim 2c: `vp lint` does not walk up even when an ancestor config exists.
45+
> # From pkg-a/src (pkg-a has a vite.config.ts one level up) oxlint defaults still apply,
46+
> # proving lint resolution does not traverse parent directories.
47+
> cd packages/pkg-a/src && vp lint
4948

50-
× eslint(no-debugger): `debugger` statement is not allowed
51-
╭─[packages/pkg-a/src/index.js:2:3]
49+
eslint(no-debugger): `debugger` statement is not allowed
50+
╭─[index.js:2:3]
5251
1 │ function pkgA() {
5352
2 │ debugger;
5453
· ─────────
5554
3 │ return "hello from pkg-a";
5655
╰────
5756
help: Remove the debugger statement
5857

59-
Found 0 warnings and 1 error.
58+
Found 1 warning and 0 errors.
6059
Finished in <variable>ms on 1 file with <variable> rules using <variable> threads.
6160

62-
[1]> vp lint packages/pkg-b/src
61+
> # Claim 2d: `vp fmt` walks up several levels when needed.
62+
> # From pkg-a/src (no config) fmt finds pkg-a/vite.config.ts -> singleQuote:false -> passes.
63+
> cd packages/pkg-a/src && vp fmt --check .
64+
Checking formatting...
65+
All matched files use the correct format.
66+
Finished in <variable>ms on 1 files using <variable> threads.
67+
68+
> # Claim 3: running `vp lint` / `vp fmt --check` directly at the workspace root
69+
> # applies the root config to every file, including files in pkg-a that have
70+
> # their own vite.config.ts (configs are not merged and not resolved per-file).
71+
> # `--threads=1` is only used to keep oxlint's multi-error output order stable
72+
> # across snapshot runs; it does not affect resolution.
73+
[1]> vp lint --threads=1
6374

6475
× eslint(no-debugger): `debugger` statement is not allowed
6576
╭─[packages/pkg-b/src/index.js:2:3]
@@ -70,16 +81,25 @@ Finished in <variable>ms on 1 file with <variable> rules using <variable> thread
7081
╰────
7182
help: Remove the debugger statement
7283

73-
Found 0 warnings and 1 error.
74-
Finished in <variable>ms on 1 file with <variable> rules using <variable> threads.
84+
× eslint(no-debugger): `debugger` statement is not allowed
85+
╭─[packages/pkg-a/src/index.js:2:3]
86+
1 │ function pkgA() {
87+
2 │ debugger;
88+
· ─────────
89+
3 │ return "hello from pkg-a";
90+
╰────
91+
help: Remove the debugger statement
92+
93+
Found 0 warnings and 2 errors.
94+
Finished in <variable>ms on 5 files with <variable> rules using <variable> threads.
7595

76-
[1]> vp fmt --check packages
96+
[1]> vp fmt --check
7797
Checking formatting...
7898
packages/pkg-a/src/index.js (<variable>ms)
7999
packages/pkg-b/src/index.js (<variable>ms)
80100

81101
Format issues found in above 2 files. Run without `--check` to fix.
82-
Finished in <variable>ms on 5 files using <variable> threads.
102+
Finished in <variable>ms on 10 files using <variable> threads.
83103

84104
> # Claim 4: `-c <path>` bypasses cwd-based resolution. The permissive config applies
85105
> # to every targeted file, so both debugger statements and double-quoted strings pass.

packages/cli/snap-tests/docs-nested-config/steps.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@
1818
"# Claim 2b: `vp fmt` DOES walk up. From pkg-b (no local config) it reaches the root,",
1919
"# which sets singleQuote:true -> double-quoted strings fail (exit 1).",
2020
"cd packages/pkg-b && vp fmt --check src",
21-
"# Claim 3: from the workspace root the root config applies to every file,",
22-
"# including files in pkg-a that have their own vite.config.ts (not merged,",
23-
"# and not resolved per-file). Running against each package separately keeps",
24-
"# the snap output stable regardless of oxlint's parallel scheduling.",
25-
"vp lint packages/pkg-a/src",
26-
"vp lint packages/pkg-b/src",
27-
"vp fmt --check packages",
21+
"# Claim 2c: `vp lint` does not walk up even when an ancestor config exists.",
22+
"# From pkg-a/src (pkg-a has a vite.config.ts one level up) oxlint defaults still apply,",
23+
"# proving lint resolution does not traverse parent directories.",
24+
"cd packages/pkg-a/src && vp lint",
25+
"# Claim 2d: `vp fmt` walks up several levels when needed.",
26+
"# From pkg-a/src (no config) fmt finds pkg-a/vite.config.ts -> singleQuote:false -> passes.",
27+
"cd packages/pkg-a/src && vp fmt --check .",
28+
"# Claim 3: running `vp lint` / `vp fmt --check` directly at the workspace root",
29+
"# applies the root config to every file, including files in pkg-a that have",
30+
"# their own vite.config.ts (configs are not merged and not resolved per-file).",
31+
"# `--threads=1` is only used to keep oxlint's multi-error output order stable",
32+
"# across snapshot runs; it does not affect resolution.",
33+
"vp lint --threads=1",
34+
"vp fmt --check",
2835
"# Claim 4: `-c <path>` bypasses cwd-based resolution. The permissive config applies",
2936
"# to every targeted file, so both debugger statements and double-quoted strings pass.",
3037
"vp lint -c vite.config.permissive.ts",

0 commit comments

Comments
 (0)