Skip to content

Commit 5be24e3

Browse files
committed
test: add vp build cache snap tests
Add snap tests to verify vp build caching works correctly: - vp-build-cache: single package build cache hit - vp-build-cache-monorepo: monorepo with two packages, both hit cache
1 parent cb1359d commit 5be24e3

13 files changed

Lines changed: 111 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "build-cache-monorepo",
3+
"private": true,
4+
"workspaces": [
5+
"packages/*"
6+
],
7+
"packageManager": "pnpm@10.32.1"
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!doctype html>
2+
<html>
3+
<body>
4+
<script type="module">
5+
console.log('app');
6+
</script>
7+
</body>
8+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "app",
3+
"private": true,
4+
"scripts": {
5+
"build": "vp build"
6+
}
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!doctype html>
2+
<html>
3+
<body>
4+
<script type="module">
5+
console.log('web');
6+
</script>
7+
</body>
8+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "web",
3+
"private": true,
4+
"scripts": {
5+
"build": "vp build"
6+
}
7+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
> vp run app#build # should build the app
2+
> ls packages/app/dist # should have the build output
3+
assets
4+
index.html
5+
6+
> vp run app#build 2>&1 | grep 'cache hit' # should hit cache
7+
~/packages/app$ vp build ◉ cache hit, replaying
8+
vp run: cache hit, <variable>ms saved.
9+
10+
> vp run web#build # should build the web
11+
> ls packages/web/dist # should have the build output
12+
assets
13+
index.html
14+
15+
> vp run web#build 2>&1 | grep 'cache hit' # should hit cache
16+
~/packages/web$ vp build ◉ cache hit, replaying
17+
vp run: cache hit, <variable>ms saved.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"commands": [
4+
{
5+
"command": "vp run app#build # should build the app",
6+
"ignoreOutput": true
7+
},
8+
"ls packages/app/dist # should have the build output",
9+
"vp run app#build 2>&1 | grep 'cache hit' # should hit cache",
10+
{
11+
"command": "vp run web#build # should build the web",
12+
"ignoreOutput": true
13+
},
14+
"ls packages/web/dist # should have the build output",
15+
"vp run web#build 2>&1 | grep 'cache hit' # should hit cache"
16+
]
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
run: {
3+
cache: true,
4+
},
5+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!doctype html>
2+
<html>
3+
<body>
4+
<script type="module">
5+
console.log('hello');
6+
</script>
7+
</body>
8+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "build-cache-test",
3+
"private": true,
4+
"scripts": {
5+
"build": "vp build"
6+
}
7+
}

0 commit comments

Comments
 (0)