Skip to content

Commit 3f2f662

Browse files
committed
fix: apply prettier
1 parent a6a9ceb commit 3f2f662

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

test/helpers/playwright-test.js

+25-15
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"use strict";
22

3-
const fs= require('fs');
4-
const path= require('path');
5-
const crypto= require('crypto');
3+
const fs = require("fs");
4+
const path = require("path");
5+
const crypto = require("crypto");
66
const { test } = require("@playwright/test");
77

8-
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
8+
const istanbulCLIOutput = path.join(process.cwd(), ".nyc_output");
99

1010
function generateUUID() {
11-
return crypto.randomBytes(16).toString('hex');
11+
return crypto.randomBytes(16).toString("hex");
1212
}
1313

1414
const customTest = test.extend({
@@ -29,22 +29,32 @@ const customTest = test.extend({
2929
context: async ({ context }, use) => {
3030
await context.addInitScript(() =>
3131
// eslint-disable-next-line no-undef
32-
window.addEventListener('beforeunload', () =>
32+
window.addEventListener("beforeunload", () =>
3333
// eslint-disable-next-line no-undef
34-
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
35-
),
36-
)
34+
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__)),
35+
),
36+
);
3737
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
38-
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON) => {
39-
if (coverageJSON)
40-
{fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`), coverageJSON);}
38+
await context.exposeFunction("collectIstanbulCoverage", (coverageJSON) => {
39+
if (coverageJSON) {
40+
fs.writeFileSync(
41+
path.join(
42+
istanbulCLIOutput,
43+
`playwright_coverage_${generateUUID()}.json`,
44+
),
45+
coverageJSON,
46+
);
47+
}
4148
});
4249
await use(context);
4350
for (const page of context.pages()) {
44-
// eslint-disable-next-line no-await-in-loop,no-undef
45-
await page.evaluate(() => window.collectIstanbulCoverage(JSON.stringify(window.__coverage__)))
51+
// eslint-disable-next-line no-await-in-loop
52+
await page.evaluate(() =>
53+
// eslint-disable-next-line no-undef
54+
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__)),
55+
);
4656
}
47-
}
57+
},
4858
});
4959

5060
module.exports = { test: customTest };

0 commit comments

Comments
 (0)