Skip to content

Commit 0470284

Browse files
committed
fix: redirect test
1 parent 7465e39 commit 0470284

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test-redirects.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
// Test all redirects under `/static/_redirects` are reachable
22

3-
if (process.env.BUILD_TARGET === 'tutorial') {
4-
console.log('Skipping test-redirects because BUILD_TARGET is tutorial');
5-
process.exit(0);
6-
}
3+
const isTutorialBuild = process.env.BUILD_TARGET === 'tutorial';
74

85
import fs from 'node:fs/promises';
96

@@ -19,6 +16,16 @@ for (const line of content.split('\n')) {
1916

2017
const [from, to] = line.split(' ');
2118

19+
if (isTutorialBuild && !to.startsWith('/tutorial')) {
20+
console.log(`Skipping ${from} because it's not a tutorial redirect in the tutorial only build`);
21+
continue;
22+
}
23+
24+
if (!isTutorialBuild && to.startsWith('/tutorial')) {
25+
console.log(`Skipping ${from} because it's a tutorial redirect in the non-tutorial build`);
26+
continue;
27+
}
28+
2229
if (to.includes(':')) {
2330
console.warn(`Ignoring ${to} because it has a placeholder`);
2431
continue;

0 commit comments

Comments
 (0)