-
Notifications
You must be signed in to change notification settings - Fork 19
/
cypress.config.ts
65 lines (60 loc) · 1.61 KB
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { install } from './src';
import { defineConfig } from 'cypress';
import { promisify } from 'util';
import { access, constants, unlink, readFile } from 'fs';
import { tmpdir } from 'os';
export default defineConfig({
projectId: 'ir8zwo',
video: false,
fixturesFolder: false,
screenshotOnRunFailure: false,
trashAssetsBeforeRuns: true,
e2e: {
baseUrl: 'http://localhost:8080',
supportFile: 'cypress/support/e2e.ts',
specPattern: 'cypress/e2e/**/*.cy.ts',
setupNodeEvents(
on: Cypress.PluginEvents,
_: Cypress.PluginConfigOptions
): void {
install(on);
on('task', {
/* eslint-disable @typescript-eslint/naming-convention */
async 'fs:match'({
path,
regexp
}: {
path: string;
regexp: RegExp;
}): Promise<boolean> {
try {
const result = await promisify(readFile)(path, 'utf-8');
return new RegExp(regexp).test(result);
} catch {
return false;
}
},
async 'fs:exists'(path: string): Promise<boolean> {
try {
await promisify(access)(path, constants.F_OK);
return true;
} catch {
return false;
}
},
async 'fs:remove'(path: string): Promise<null> {
try {
await promisify(unlink)(path);
} catch {
// noop
}
return null;
},
'fs:tmpdir'(): string {
return tmpdir();
}
/* eslint-enable @typescript-eslint/naming-convention */
});
}
}
});