-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathjest.setup.js
46 lines (39 loc) · 1.17 KB
/
jest.setup.js
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
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @format
* @ts-check
*/
const fs = require('fs');
const path = require('path');
const sanitizeFilename = require('sanitize-filename');
const {LogBox} = require('react-native');
const screenshotDir = './errorShots';
fs.mkdirSync(screenshotDir, {recursive: true});
// Register to screenshot on each test failure
// TODO - use a jest reporter to create screenshots
/*
global.jasmine.addReporter({
specDone: async result => {
if (result.status === 'failed') {
const friendlySpecName = sanitizeFilename(
`${result.fullName.replace(/\s/g, '-')}.png`,
);
const filename = path.join(screenshotDir, friendlySpecName);
await global.browser.saveScreenshot(filename);
}
},
});
*/
// Jest ENV does not have SampleTurboModule native module defined
jest.mock(
'react-native-windows/Libraries/TurboModule/samples/NativeSampleTurboModule',
() => jest.fn(),
);
// Jest ENV cannot resolve ..\..\relay.png since only [email protected] exists
jest.mock(
'@react-native-windows/tester/js/examples/AnimatedGratuitousApp/AnExChained',
() => jest.fn(),
);
LogBox.ignoreAllLogs(true);