Skip to content

Commit ff9bc25

Browse files
committed
Move for loop into array function
1 parent 91909e9 commit ff9bc25

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

shared/tasks/browser.mjs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ export async function screenshots() {
2929
// Screenshot components
3030
for (const componentName of componentNames) {
3131
const allExamples = await getExamples(componentName)
32-
const componentExampleNames = Object.keys(allExamples).filter(
33-
(key) => allExamples[key].fixture.screenshot
34-
)
35-
36-
for (const exampleName of componentExampleNames) {
37-
await screenshotComponent(browser, componentName, {
38-
screenshot: allExamples[exampleName].fixture.screenshot,
39-
exampleName
40-
})
32+
33+
for (const exampleName of Object.keys(allExamples)) {
34+
if (allExamples[exampleName].fixture.screenshot) {
35+
await screenshotComponent(browser, componentName, {
36+
screenshot: allExamples[exampleName].fixture.screenshot,
37+
exampleName
38+
})
39+
}
4140
}
4241
}
4342

@@ -51,6 +50,11 @@ export async function screenshots() {
5150
}
5251

5352
/**
53+
* Current screenshot variants include:
54+
*
55+
* - `default` - Default screenshot with JavaScript enabled
56+
* - `no-js` - Screenshot with JavaScript disabled
57+
*
5458
* @overload
5559
* @param {Browser} browser - Puppeteer browser object
5660
* @param {string} componentName - Component name

0 commit comments

Comments
 (0)