Skip to content

Commit 55cfed2

Browse files
committed
Move for loop into array method
1 parent 91909e9 commit 55cfed2

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

shared/tasks/browser.mjs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +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-
})
41-
}
32+
Object.keys(allExamples).forEach(async (example) => {
33+
if (allExamples[example].fixture.screenshot) {
34+
await screenshotComponent(browser, componentName, {
35+
screenshot: allExamples[example].fixture.screenshot,
36+
example
37+
})
38+
}
39+
})
4240
}
4341

4442
// Screenshot specific example pages
@@ -51,6 +49,11 @@ export async function screenshots() {
5149
}
5250

5351
/**
52+
* Current screenshot variants include:
53+
*
54+
* - `default` - Default screenshot with JavaScript enabled
55+
* - `no-js` - Screenshot with JavaScript disabled
56+
*
5457
* @overload
5558
* @param {Browser} browser - Puppeteer browser object
5659
* @param {string} componentName - Component name

0 commit comments

Comments
 (0)