Skip to content

Commit 007b825

Browse files
committed
Don't test all new combinations
We already had 24 combinations before. Testing each with and without seems overkill compared to the increase in test duration.
1 parent c52fde9 commit 007b825

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/integration/create-next-app/templates/matrix.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,30 @@ describe.each(['app', 'pages'] as const)(
3333
// eslint: ['--eslint', '--no-linter'],
3434
eslint: ['--eslint'],
3535

36-
srcDir: ['--src-dir', '--no-src-dir'],
36+
// Trading test perf for robustness:
37+
// srcDir and reactCompiler don't interact so we're testing them together
38+
// instead of all permutations.
39+
srcDirAndCompiler: [
40+
'--src-dir --react-compiler',
41+
'--no-src-dir --no-react-compiler',
42+
],
3743
tailwind: ['--tailwind', '--no-tailwind'],
3844

3945
// shouldn't affect if the app builds or not
4046
// packageManager: ['--use-npm', '--use-pnpm', '--use-yarn', '--use-bun'],
41-
42-
reactCompiler: ['--react-compiler', '--no-react-compiler'],
4347
}
4448

45-
const getPermutations = <T>(items: T[][]): T[][] => {
49+
const getCombinations = (items: string[][]): string[][] => {
4650
if (!items.length) return [[]]
4751
const [first, ...rest] = items
48-
const children = getPermutations(rest)
52+
const children = getCombinations(rest)
4953
return first.flatMap((value) =>
50-
children.map((child) => [value, ...child])
54+
children.map((child) => [...value.split(' '), ...child])
5155
)
5256
}
5357

54-
const flagPermutations = getPermutations(Object.values(allFlagValues))
55-
const testCases = flagPermutations.map((flags) => ({
58+
const flagCombinations = getCombinations(Object.values(allFlagValues))
59+
const testCases = flagCombinations.map((flags) => ({
5660
name: flags.join(' '),
5761
flags,
5862
}))

0 commit comments

Comments
 (0)