-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
index.js
73 lines (68 loc) · 1.9 KB
/
index.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
// flowlint ambiguous-object-type:error
'use strict';
const {
disallowConsoleErrors,
expectConsoleError,
expectConsoleErrorsMany,
expectConsoleErrorWillFire,
} = require('./consoleError');
const describeWithFeatureFlags = require('./describeWithFeatureFlags');
const {
FIXTURE_TAG,
generateTestsFromFixtures,
} = require('./generateTestsFromFixtures');
const Matchers = require('./Matchers');
const printAST = require('./printAST');
const simpleClone = require('./simpleClone');
const {
disallowWarnings,
expectToWarn,
expectToWarnMany,
expectWarningWillFire,
} = require('./warnings');
const {createMockEnvironment, unwrapContainer} = require('relay-test-utils');
// Apparently, in node v16 (because now they are using V8 V9.something)
// the content of the TypeError has changed, and now some of our tests
// stated to fail.
// This is a temporary work-around to make test pass, but we need to
// figure out a cleaner way of testing this.
function cannotReadPropertyOfUndefined__DEPRECATED(
propertyName: string,
): string {
if (process.version.match(/^v16\.(.+)$/)) {
return `Cannot read properties of undefined (reading '${propertyName}')`;
} else {
return `Cannot read property '${propertyName}' of undefined`;
}
}
/**
* The public interface to Relay Test Utils.
*/
module.exports = {
cannotReadPropertyOfUndefined__DEPRECATED,
createMockEnvironment,
describeWithFeatureFlags,
disallowConsoleErrors,
disallowWarnings,
expectConsoleError,
expectConsoleErrorsMany,
expectConsoleErrorWillFire,
expectToWarn,
expectToWarnMany,
expectWarningWillFire,
FIXTURE_TAG,
generateTestsFromFixtures,
matchers: Matchers,
printAST,
simpleClone,
unwrapContainer,
};