@cappa/plugin-storybook 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @cappa/plugin-storybook
2
2
 
3
+ ## 0.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 3a8b89e: Fix skipped stories and report
8
+ - Updated dependencies [3a8b89e]
9
+ - @cappa/core@0.0.18
10
+
3
11
  ## 0.0.17
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cappa/plugin-storybook",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Storybook plugin for Cappa - takes screenshots of Storybook stories",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@swc/core": "^1.13.5",
32
32
  "storybook": "^9.1.5",
33
- "@cappa/core": "0.0.17"
33
+ "@cappa/core": "0.0.18"
34
34
  },
35
35
  "devDependencies": {
36
36
  "playwright-core": "^1.55.0",
@@ -111,9 +111,10 @@ export const cappaPluginStorybook: Plugin<StorybookPluginOptions> = (
111
111
  const results: Array<{
112
112
  storyId: string;
113
113
  storyName: string;
114
- success: boolean;
115
114
  filepath?: string;
115
+ success?: boolean;
116
116
  error?: string;
117
+ skipped?: boolean;
117
118
  }> = [];
118
119
 
119
120
  await screenshotTool.init();
@@ -161,6 +162,12 @@ export const cappaPluginStorybook: Plugin<StorybookPluginOptions> = (
161
162
 
162
163
  if (options.skip) {
163
164
  console.log(`Skipping story ${story.title} - ${story.name}`);
165
+ results.push({
166
+ storyId: story.id,
167
+ storyName: `${story.title} - ${story.name}`,
168
+ skipped: true,
169
+ });
170
+ continue;
164
171
  }
165
172
 
166
173
  await freezeUI(page);
@@ -190,8 +197,8 @@ export const cappaPluginStorybook: Plugin<StorybookPluginOptions> = (
190
197
  results.push({
191
198
  storyId: story.id,
192
199
  storyName: `${story.title} - ${story.name}`,
193
- success: true,
194
200
  filepath: actualFilepath,
201
+ success: true,
195
202
  });
196
203
  } catch (error) {
197
204
  console.error(
@@ -201,22 +208,31 @@ export const cappaPluginStorybook: Plugin<StorybookPluginOptions> = (
201
208
  results.push({
202
209
  storyId: story.id,
203
210
  storyName: `${story.title} - ${story.name}`,
204
- success: false,
205
211
  error: (error as Error)?.message ?? "Unknown error",
206
212
  });
207
213
  }
208
214
  }
209
215
 
210
216
  // Print error report if there are any errors
211
- if (results.some((r) => !r.success)) {
217
+ if (results.some((r) => r.error)) {
212
218
  console.log(
213
219
  `Error report: \n${results
214
- .filter((r) => !r.success)
220
+ .filter((r) => r.error)
215
221
  .map((r) => `${r.storyName}: ${r.error}`)
216
222
  .join("\n")}`,
217
223
  );
218
224
  }
219
225
 
226
+ // Print skipped stories if there are any
227
+ if (results.some((r) => r.skipped)) {
228
+ console.log(
229
+ `Skipped stories: \n${results
230
+ .filter((r) => r.skipped)
231
+ .map((r) => `${r.storyName}`)
232
+ .join("\n")}`,
233
+ );
234
+ }
235
+
220
236
  console.log(
221
237
  `Completed screenshots: ${results.filter((r) => r.success).length}/${results.length} successful`,
222
238
  );