Skip to content

Commit e40e85f

Browse files
committed
test(snapshots): migrate lint-*/oxlint-* cases to the PTY snapshot suite (#2131)
Migrates the 6 lint cases (ignore patterns, unmatched pattern, vite config rules, vite-plus import rules, nuxt variant, type-aware) from `packages/cli/snap-tests` to the PTY snapshot suite, and removes the legacy dirs. Part of #2116. `oxlint-typeaware` needed hand conversion: its `echo //comment >> types.ts` appends became `vpt write-file` with the full appended content, and its legacy `ignoredPlatforms: [""]` (matches nothing) was translated verbatim to `skip-platforms = [""]`, which the new runner's platform parser rejects; dropped. The recorded snapshot proves the type-aware distinction: non-type-aware lint shows `cache hit` after the types.ts change, type-aware shows `cache miss: 'types.ts' modified`. Adds a redaction rule masking oxlint's `with N rules` count, which grows on every bundled oxlint upgrade (the legacy suite masked it the same way).
1 parent 9d3e77b commit e40e85f

49 files changed

Lines changed: 239 additions & 110 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/cli/snap-tests/lint-ignore-patterns/package.json renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/lint_ignore_patterns/package.json

File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[[case]]
2+
name = "lint_ignore_patterns"
3+
vp = "local"
4+
steps = [
5+
{ argv = ["vp", "lint", "src/"], comment = "Test that lint ignorePatterns works - ignored files should not be linted", continue-on-failure = true },
6+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# lint_ignore_patterns
2+
3+
## `vp lint src/`
4+
5+
Test that lint ignorePatterns works - ignored files should not be linted
6+
7+
```
8+
Found 0 warnings and 0 errors.
9+
Finished in <duration> on 1 file with <n> rules using <n> threads.
10+
```

packages/cli/snap-tests/lint-ignore-patterns/src/ignored/has-error.js renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/lint_ignore_patterns/src/ignored/has-error.js

File renamed without changes.

packages/cli/snap-tests/lint-ignore-patterns/src/valid.js renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/lint_ignore_patterns/src/valid.js

File renamed without changes.

packages/cli/snap-tests/lint-ignore-patterns/vite.config.ts renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/lint_ignore_patterns/vite.config.ts

File renamed without changes.

packages/cli/snap-tests/lint-unmatched-pattern/package.json renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/lint_unmatched_pattern/package.json

File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[[case]]
2+
name = "lint_unmatched_pattern"
3+
vp = "local"
4+
steps = [
5+
{ argv = ["vp", "lint", "package.json"], comment = "non-lintable file, should exit non-zero", continue-on-failure = true },
6+
]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# lint_unmatched_pattern
2+
3+
## `vp lint package.json`
4+
5+
non-lintable file, should exit non-zero
6+
7+
**Exit code:** 1
8+
9+
```
10+
No files found to lint. Please check your paths and ignore patterns.
11+
Finished in <duration> on 0 files with <n> rules using <n> threads.
12+
```

packages/cli/snap-tests/lint-vite-config-rules/package.json renamed to crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/lint_vite_config_rules/package.json

File renamed without changes.

0 commit comments

Comments
 (0)