Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_all_skipped"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check", "--no-fmt", "--no-lint"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[1]> vp check --no-fmt --no-lint
# check_all_skipped

## `vp check --no-fmt --no-lint`

**Exit code:** 1

```
error: No checks enabled

Enable `lint.options.typeCheck` in vite.config.ts for type-check only, drop a `--no-fmt`/`--no-lint` flag, or re-enable `check.fmt`/`check.lint` in vite.config.ts.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[case]]
name = "check_cache_disabled"
vp = "local"
steps = [
{ argv = ["vp", "run", "check"], comment = "vp check should have cache disabled without run.cache", continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# check_cache_disabled

## `vp run check`

vp check should have cache disabled without run.cache

```
$ vp check ⊘ cache disabled
pass: All 2 files are correctly formatted (<duration>, <n> threads)
pass: Found no warnings or lint errors in 1 file (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[case]]
name = "check_cache_enabled"
vp = "local"
skip-platforms = ["windows"]
steps = [
{ argv = ["vp", "run", "check"], comment = "first run should be cache miss", continue-on-failure = true },
{ argv = ["vp", "run", "check"], comment = "second run should be cache hit", continue-on-failure = true },
{ argv = ["vpt", "write-file", "src/foo.js", "export const foo = 1;\n"], continue-on-failure = true },
{ argv = ["vp", "run", "check"], comment = "third run should be cache miss after new file added", continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# check_cache_enabled

## `vp run check`

first run should be cache miss

```
$ vp check
pass: All 3 files are correctly formatted (<duration>, <n> threads)
pass: Found no warnings or lint errors in 2 files (<duration>, <n> threads)
```

## `vp run check`

second run should be cache hit

```
$ vp check ◉ cache hit, replaying
pass: All 3 files are correctly formatted (<duration>, <n> threads)
pass: Found no warnings or lint errors in 2 files (<duration>, <n> threads)

---
vp run: cache hit, <duration> saved.
```

## `vpt write-file src/foo.js 'export const foo = 1;
'`

```
```

## `vp run check`

third run should be cache miss after new file added

```
$ vp check ○ cache miss: 'foo.js' added in 'src', executing
pass: All 4 files are correctly formatted (<duration>, <n> threads)
pass: Found no warnings or lint errors in 3 files (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_config_flag_precedence"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check", "--no-fmt"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# check_config_flag_precedence

## `vp check --no-fmt`

```
pass: Found no warnings or lint errors in 2 files (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_config_no_fmt"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# check_config_no_fmt

## `vp check`

```
note: Format skipped (check.fmt: false in vite.config.ts)
pass: Found no warnings or lint errors in 2 files (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_config_no_lint"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# check_config_no_lint

## `vp check`

```
note: Lint skipped (check.lint: false in vite.config.ts)
pass: All 3 files are correctly formatted (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_fail_fast"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# check_fail_fast

## `vp check`

**Exit code:** 1

```
error: Formatting issues found
src/index.js (<duration>)

Found formatting issues in 1 file (<duration>, <n> threads). Run `vp check --fix` to fix them.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[case]]
name = "check_fix"
vp = "local"
steps = [
{ argv = ["vp", "check", "--fix"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# check_fix

## `vp check --fix`

```
pass: Formatting completed for checked files (<duration>)
pass: Found no warnings or lint errors in 1 file (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[case]]
name = "check_fix_lint_error_not_swallowed"
vp = "local"
steps = [
{ argv = ["vp", "check", "--fix", "src/index.js"], comment = "real lint error with --fix and paths (suppress_unmatched active), error must not be swallowed", continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
[1]> vp check --fix src/index.js # real lint error with --fix and paths (suppress_unmatched active), error must not be swallowed
# check_fix_lint_error_not_swallowed

## `vp check --fix src/index.js`

real lint error with --fix and paths (suppress_unmatched active), error must not be swallowed

**Exit code:** 1

```
error: Lint issues found
× eslint(no-eval): eval can be harmful.
╭─[src/index.js:2:3]
Expand All @@ -9,5 +17,6 @@ error: Lint issues found
╰────
help: Avoid eval(). For JSON parsing use JSON.parse(); for dynamic property access use bracket notation (obj[key]); for other cases refactor to avoid evaluating strings as code.

Found 1 error and 0 warnings in 1 file (<variable>ms, <variable> threads)
pass: Formatting completed for checked files (<variable>ms)
Found 1 error and 0 warnings in 1 file (<duration>, <n> threads)
pass: Formatting completed for checked files (<duration>)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[[case]]
name = "check_fix_lint_warn"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check", "--fix"], continue-on-failure = true },
{ argv = ["vp", "check"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
> vp check --fix
# check_fix_lint_warn

## `vp check --fix`

```
warn: Lint warnings found
⚠ eslint(no-console): Unexpected console statement.
╭─[src/index.js:2:3]
Expand All @@ -9,11 +13,14 @@ warn: Lint warnings found
╰────
help: Delete this console statement.

Found 0 errors and 1 warning in 2 files (<variable>ms, <variable> threads)
pass: Formatting completed for checked files (<variable>ms)
Found 0 errors and 1 warning in 2 files (<duration>, <n> threads)
pass: Formatting completed for checked files (<duration>)
```

## `vp check`

> vp check
pass: All 4 files are correctly formatted (<variable>ms, <variable> threads)
```
pass: All 3 files are correctly formatted (<duration>, <n> threads)
warn: Lint warnings found
⚠ eslint(no-console): Unexpected console statement.
╭─[src/index.js:2:3]
Expand All @@ -24,4 +31,5 @@ warn: Lint warnings found
╰────
help: Delete this console statement.

Found 0 errors and 1 warning in 2 files (<variable>ms, <variable> threads)
Found 0 errors and 1 warning in 2 files (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[[case]]
name = "check_fix_missing_stderr"
vp = "local"
skip-platforms = ["windows"]
steps = [
{ argv = ["vp", "check", "--fix"], continue-on-failure = true },
{ argv = ["vp", "check"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
[1]> vp check --fix
# check_fix_missing_stderr

## `vp check --fix`

**Exit code:** 1

```
error: Formatting could not complete
Failed to load configuration file.
<cwd>/vite.config.ts
<workspace>/vite.config.ts
Error: The `fmt` field in the default export must be an object.
Ensure the file has a valid default export of a JSON-serializable configuration object.

Formatting failed during fix
```

## `vp check`

**Exit code:** 1

[1]> vp check
```
error: Formatting could not start
Failed to load configuration file.
<cwd>/vite.config.ts
<workspace>/vite.config.ts
Error: The `fmt` field in the default export must be an object.
Ensure the file has a valid default export of a JSON-serializable configuration object.

Formatting failed before analysis started
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[[case]]
name = "check_fix_no_error_unmatched"
vp = "local"
steps = [
{ argv = ["vp", "check", "--fix", "src/ignored/index.js"], comment = "all files excluded by ignorePatterns, should pass in --fix mode", continue-on-failure = true },
{ argv = ["vp", "check", "--fix", "package.json"], comment = "non-lintable file, should pass in --fix mode", continue-on-failure = true },
{ argv = ["vp", "check", "--no-error-on-unmatched-pattern", "src/ignored/index.js"], comment = "explicit flag without --fix, should also pass", continue-on-failure = true },
{ argv = ["vp", "check", "--fix", "--no-error-on-unmatched-pattern", "src/ignored/index.js"], comment = "both flags set, should pass", continue-on-failure = true },
{ argv = ["vp", "check", "src/ignored/index.js"], comment = "without --fix or explicit flag, should exit non-zero", continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# check_fix_no_error_unmatched

## `vp check --fix src/ignored/index.js`

all files excluded by ignorePatterns, should pass in --fix mode

```
pass: Formatting completed for checked files (<duration>)
```

## `vp check --fix package.json`

non-lintable file, should pass in --fix mode

```
pass: Formatting completed for checked files (<duration>)
```

## `vp check --no-error-on-unmatched-pattern src/ignored/index.js`

explicit flag without --fix, should also pass

```
```

## `vp check --fix --no-error-on-unmatched-pattern src/ignored/index.js`

both flags set, should pass

```
pass: Formatting completed for checked files (<duration>)
```

## `vp check src/ignored/index.js`

without --fix or explicit flag, should exit non-zero

**Exit code:** 2

```
error: Formatting could not start
Checking formatting...

Expected at least one target file. All matched files may have been excluded by ignore rules.

Formatting failed before analysis started
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_fix_no_fmt_no_lint_typecheck"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check", "--fix", "--no-fmt", "--no-lint"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# check_fix_no_fmt_no_lint_typecheck

## `vp check --fix --no-fmt --no-lint`

```
pass: Found no type errors in 2 files (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_fix_no_lint_typecheck"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check", "--fix", "--no-lint"], continue-on-failure = true },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# check_fix_no_lint_typecheck

## `vp check --fix --no-lint`

```
pass: Formatting completed for checked files (<duration>)
pass: Found no type errors in 2 files (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[case]]
name = "check_fix_no_lint_typecheck_fail"
vp = "local"
env = { VITE_DISABLE_AUTO_INSTALL = "1" }
steps = [
{ argv = ["vp", "check", "--fix", "--no-lint"], continue-on-failure = true },
]
Loading
Loading