Skip to content

Commit 8d33d37

Browse files
Michael DragomirMichael Dragomir
Michael Dragomir
authored and
Michael Dragomir
committed
more configurations
1 parent 642875a commit 8d33d37

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

nyc.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
module.exports = {
2+
all: true,
23
include: [
34
'pages/**/*.{js,ts,tsx}',
45
'common/**/*.{js,ts,tsx}',
56
'components/**/*.{js,ts,tsx}',
67
'decorators/**/*.{js,ts,tsx}',
78
],
8-
exclude: ['pages/api/__coverage__.{js,ts}'],
9+
exclude: [
10+
'pages/api/__coverage__.{js,ts}',
11+
'**/*.config.ts',
12+
'**/*.config.js',
13+
'**/*.d.ts',
14+
'**/pages/api/**/*.*',
15+
'__tests__',
16+
'tests',
17+
],
18+
reporter: ['html'],
919
};

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
"test:changes:watch": "yarn test:changes --watch",
3030
"test:watch": "yarn test --watch",
3131
"test:update-snaps": "yarn test -u",
32-
"test:ui": "vitest --ui"
32+
"test:ui": "vitest --ui",
33+
"test-e2e": "playwright test",
34+
"create-report": "nyc report --reporter html --reporter text --reporter json -t coverage --report-dir coverage/summary",
35+
"coverage": "yarn test && yarn test-e2e && yarn create-report"
3336
},
3437
"nyc": {
3538
"extends": "./nyc.config.js",

playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line import/no-extraneous-dependencies
12
import { defineConfig, devices } from '@playwright/test';
23

34
/**

tests/baseFixtures.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import * as fs from 'fs';
22
import * as path from 'path';
3-
import * as crypto from 'crypto';
3+
44
// eslint-disable-next-line import/no-extraneous-dependencies
55
import { test as baseTest } from '@playwright/test';
66

7-
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
8-
9-
export function generateUUID(): string {
10-
return crypto.randomBytes(16).toString('hex');
11-
}
7+
const istanbulCLIOutput = path.join(process.cwd(), 'coverage');
128

139
export const test = baseTest.extend({
1410
context: async ({ context }, use) => {
@@ -21,10 +17,7 @@ export const test = baseTest.extend({
2117
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
2218
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON: string) => {
2319
if (coverageJSON)
24-
fs.writeFileSync(
25-
path.join(istanbulCLIOutput, `playwright_coverage_${generateUUID()}.json`),
26-
coverageJSON,
27-
);
20+
fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage.json`), coverageJSON);
2821
});
2922
await use(context);
3023
// eslint-disable-next-line no-restricted-syntax

0 commit comments

Comments
 (0)