File tree Expand file tree Collapse file tree 2 files changed +17
-42
lines changed Expand file tree Collapse file tree 2 files changed +17
-42
lines changed Original file line number Diff line number Diff line change @@ -34,3 +34,20 @@ function deprecateQuery<QueryFn extends (...args: any) => any>(
34
34
35
35
return wrapper ;
36
36
}
37
+
38
+ const warned : { [ functionName : string ] : boolean } = { } ;
39
+
40
+ // istambul ignore next: Occasionally used
41
+ export function printDeprecationWarning ( functionName : string ) {
42
+ if ( warned [ functionName ] ) {
43
+ return ;
44
+ }
45
+
46
+ // eslint-disable-next-line no-console
47
+ console . warn ( `
48
+ Deprecation Warning:
49
+ Use of ${ functionName } is not recommended and will be deleted in future versions of @testing-library/react-native.
50
+ ` ) ;
51
+
52
+ warned [ functionName ] = true ;
53
+ }
Original file line number Diff line number Diff line change @@ -9,13 +9,6 @@ export class ErrorWithStack extends Error {
9
9
}
10
10
}
11
11
12
- export const createLibraryNotSupportedError = ( error : unknown ) : Error =>
13
- new Error (
14
- `Currently the only supported library to search by text is "react-native".\n\n${
15
- error instanceof Error ? error . message : ''
16
- } `
17
- ) ;
18
-
19
12
export const prepareErrorMessage = (
20
13
// TS states that error caught in a catch close are of type `unknown`
21
14
// most real cases will be `Error`, but better safe than sorry
@@ -71,38 +64,3 @@ export function copyStackTrace(target: unknown, stackTraceSource: Error) {
71
64
) ;
72
65
}
73
66
}
74
-
75
- const warned : { [ functionName : string ] : boolean } = { } ;
76
-
77
- export function printDeprecationWarning ( functionName : string ) {
78
- if ( warned [ functionName ] ) {
79
- return ;
80
- }
81
-
82
- // eslint-disable-next-line no-console
83
- console . warn ( `
84
- Deprecation Warning:
85
- Use of ${ functionName } is not recommended and will be deleted in future versions of @testing-library/react-native.
86
- ` ) ;
87
-
88
- warned [ functionName ] = true ;
89
- }
90
-
91
- export function throwRemovedFunctionError (
92
- functionName : string ,
93
- docsRef : string
94
- ) {
95
- throw new Error (
96
- `"${ functionName } " has been removed.\n\nPlease consult: https://callstack.github.io/react-native-testing-library/docs/${ docsRef } `
97
- ) ;
98
- }
99
-
100
- export function throwRenamedFunctionError (
101
- functionName : string ,
102
- newFunctionName : string
103
- ) {
104
- throw new ErrorWithStack (
105
- `The "${ functionName } " function has been renamed to "${ newFunctionName } ". Please replace all occurrences.` ,
106
- throwRenamedFunctionError
107
- ) ;
108
- }
You can’t perform that action at this time.
0 commit comments