Skip to content

Commit 322af13

Browse files
authored
test(snap): consolidate overlapping migration snap tests (#704)
Merge migration-other-hook-tool-with-lint-staged into migration-other-hook-tool (now covers both simple-git-hooks config and lint-staged config/scripts in a single test). Merge migration-no-hooks-with-lint-staged-config into migration-no-hooks-with-husky (now covers husky deps, lint-staged config, check-staged script, and prepare script preservation). Net reduction of 2 snap tests to offset the 2 additions from the lint-staged-pre-commit-hook branch.
1 parent 7016e34 commit 322af13

12 files changed

Lines changed: 34 additions & 132 deletions

File tree

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
{
22
"name": "migration-no-hooks-with-husky",
33
"scripts": {
4-
"prepare": "husky"
4+
"prepare": "husky",
5+
"check-staged": "lint-staged"
56
},
67
"devDependencies": {
78
"husky": "^9.1.7",
89
"lint-staged": "^16.2.6",
910
"vite": "^7.0.0"
11+
},
12+
"lint-staged": {
13+
"*.ts": "eslint --fix"
1014
}
1115
}

packages/cli/snap-tests-global/migration-no-hooks-with-husky/snap.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
> git init
2-
> vp migrate --no-hooks --no-interactive # migration with --no-hooks should keep husky/lint-staged
2+
> vp migrate --no-hooks --no-interactive # --no-hooks should keep husky/lint-staged and preserve config
33
VITE+ - The Unified Toolchain for the Web
44

55

@@ -13,18 +13,22 @@ Wrote agent instructions to AGENTS.md
1313
✔ Migration completed!
1414

1515

16-
> cat package.json # check prepare script reverted to husky and husky/lint-staged kept in devDependencies
16+
> cat package.json # prepare script, lint-staged config, check-staged script, and deps should all be preserved
1717
{
1818
"name": "migration-no-hooks-with-husky",
1919
"scripts": {
20-
"prepare": "husky"
20+
"prepare": "husky",
21+
"check-staged": "lint-staged"
2122
},
2223
"devDependencies": {
2324
"husky": "^9.1.7",
2425
"lint-staged": "^16.2.6",
2526
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
2627
"vite-plus": "latest"
2728
},
29+
"lint-staged": {
30+
"*.ts": "eslint --fix"
31+
},
2832
"pnpm": {
2933
"overrides": {
3034
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"commands": [
33
{ "command": "git init", "ignoreOutput": true },
4-
"vp migrate --no-hooks --no-interactive # migration with --no-hooks should keep husky/lint-staged",
5-
"cat package.json # check prepare script reverted to husky and husky/lint-staged kept in devDependencies",
4+
"vp migrate --no-hooks --no-interactive # --no-hooks should keep husky/lint-staged and preserve config",
5+
"cat package.json # prepare script, lint-staged config, check-staged script, and deps should all be preserved",
66
"test -d .husky && echo '.husky directory exists' || echo 'No .husky directory' # verify no .husky directory"
77
]
88
}

packages/cli/snap-tests-global/migration-no-hooks-with-lint-staged-config/package.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/cli/snap-tests-global/migration-no-hooks-with-lint-staged-config/snap.txt

Lines changed: 0 additions & 39 deletions
This file was deleted.

packages/cli/snap-tests-global/migration-no-hooks-with-lint-staged-config/steps.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/cli/snap-tests-global/migration-other-hook-tool-with-lint-staged/package.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/cli/snap-tests-global/migration-other-hook-tool-with-lint-staged/snap.txt

Lines changed: 0 additions & 39 deletions
This file was deleted.

packages/cli/snap-tests-global/migration-other-hook-tool-with-lint-staged/steps.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
{
2-
"name": "migration-other-hook-tool",
2+
"name": "migration-other-hook-tool-with-lint-staged",
3+
"scripts": {
4+
"check-staged": "lint-staged"
5+
},
36
"devDependencies": {
7+
"lint-staged": "^16.2.6",
48
"simple-git-hooks": "^2.11.1",
59
"vite": "^7.0.0"
610
},
711
"simple-git-hooks": {
812
"pre-commit": "npx lint-staged"
13+
},
14+
"lint-staged": {
15+
"*.ts": "eslint --fix"
916
}
1017
}

0 commit comments

Comments
 (0)