8000 fix: pin `storybook` version and faster testing (#531) · svelte-add/svelte-add@95f54b9 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit 95f54b9

Browse files
authored
fix: pin storybook version and faster testing (#531)
1 parent c134afa commit 95f54b9

File tree

9 files changed

+36
-38
lines changed

9 files changed

+36
-38
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@svelte-add/adders': patch
3+
---
4+
5+
fix: pinned `storybook` cli version

.changeset/six-parrots-tan.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@svelte-add/testing-library': patch
3+
---
4+
5+
fix: empty test cases are no longer needed

adders/eslint/config/tests.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@ export const tests = defineAdderTests({
55
files: [],
66
options,
77
optionValues: [],
8-
tests: [
9-
{
10-
name: '',
11-
run: async () => {},
12-
},
13-
],
8+
tests: [],
149
});

adders/playwright/config/tests.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@ export const tests = defineAdderTests({
55
files: [],
66
options,
77
optionValues: [],
8-
tests: [
9-
{
10-
name: '',
11-
run: async () => {},
12-
},
13-
],
8+
tests: [],
149
});

adders/prettier/config/tests.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@ export const tests = defineAdderTests({
55
files: [],
66
options,
77
optionValues: [],
8-
tests: [
9-
{
10-
name: '',
11-
run: async () => {},
12-
},
13-
],
8+
tests: [],
149
});

adders/storybook/config/adder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ export const adder = defineAdderConfig({
2323

2424
options,
2525
integrationType: 'external',
26-
command: 'storybook@next init --skip-install --no-dev',
26+
command: 'storybook@8.3.0-alpha.3 init --skip-install --no-dev',
2727
});

adders/storybook/config/tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const tests = defineAdderTests({
88
optionValues: [],
99
get command() {
1010
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
11-
return `storybook -p ${port++}`;
11+
return `storybook -p ${port++} --ci`;
1212
},
1313
files: [],
1414
tests: [

adders/vitest/config/tests.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@ export const tests = defineAdderTests({
55
files: [],
66
options,
77
optionValues: [],
8-
tests: [
9-
{
10-
name: '',
11-
run: async () => {},
12-
},
13-
],
8+
tests: [],
149
});

packages/testing-library/utils/test-cases.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ export async function executeAdderTests(
9090
options: OptionValues<Record<string, Question>>,
9191
testOptions: TestOptions,
9292
) {
93-
const { url, devServer } = await startDevServer(workingDirectory, adder.tests?.command ?? 'dev');
93+
if (!adder.tests) return;
94+
95+
const cmd = adder.tests.command ?? 'dev';
96+
const { url, devServer } = await startDevServer(workingDirectory, cmd);
9497
const page = await openPage(url);
9598

9699
try {
@@ -122,18 +125,23 @@ export async function runTestCases(testCases: Map<string, TestCase[]>, testOptio
122125
const tests: { testCase: TestCase; cwd: string }[] = [];
123126

124127
console.log('executing adders');
125-
for (const values of testCases.values()) {
126-
for (const testCase of values) {
127-
const cwd = await setupAdder(
128-
testCase.template,
129-
testCase.adder,
130-
testCase.options,
131-
testOptions,
132-
);
128+
const setups = Array.from(testCases.values()).flatMap((values) =>
129+
values.map((testCase) => {
130+
const task = async () => {
131+
if (testCase.adder.tests?.tests.length === 0) return;
132+
const cwd = await setupAdder(
133+
testCase.template,
134+
testCase.adder,
135+
testCase.options,
136+
testOptions,
137+
);
138+
tests.push({ testCase, cwd });
139+
};
140+
return task();
141+
}),
142+
);
133143

134-
tests.push({ testCase, cwd });
135-
}
136-
}
144+
await Promise.all(setups);
137145

138146
console.log('installing dependencies');
139147
await installDependencies(testOptions.outputDirectory);

0 commit comments

Comments
 (0)
0