-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(crashlytics): deprecation warning for v8 API ahead of future ma…
…jor release (#8107)
- Loading branch information
1 parent
addcd07
commit 5e5072d
Showing
6 changed files
with
279 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,46 @@ | ||
// @ts-nocheck | ||
import { expect, jest } from '@jest/globals'; | ||
import { createMessage } from './index'; | ||
|
||
export const checkV9Deprecation = (modularFunction: () => void, nonModularFunction: () => void) => { | ||
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {}); | ||
consoleWarnSpy.mockRestore(); | ||
modularFunction(); | ||
expect(consoleWarnSpy).not.toHaveBeenCalled(); | ||
consoleWarnSpy.mockClear(); | ||
const consoleWarnSpy2 = jest.spyOn(console, 'warn').mockImplementation(() => {}); | ||
nonModularFunction(); | ||
expect(consoleWarnSpy).toHaveBeenCalledTimes(1); | ||
consoleWarnSpy.mockRestore(); | ||
|
||
expect(consoleWarnSpy2).toHaveBeenCalledTimes(1); | ||
consoleWarnSpy2.mockClear(); | ||
}; | ||
|
||
export type CheckV9DeprecationFunction = ( | ||
modularFunction: () => void, | ||
nonModularFunction: () => void, | ||
methodName: string, | ||
uniqueMessage: string = '', | ||
) => void; | ||
|
||
export const createCheckV9Deprecation = (moduleName: string): CheckV9DeprecationFunction => { | ||
return ( | ||
modularFunction: () => void, | ||
nonModularFunction: () => void, | ||
methodName: string, | ||
uniqueMessage = '', | ||
) => { | ||
const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {}); | ||
consoleWarnSpy.mockReset(); | ||
modularFunction(); | ||
expect(consoleWarnSpy).not.toHaveBeenCalled(); | ||
consoleWarnSpy.mockReset(); | ||
const consoleWarnSpy2 = jest.spyOn(console, 'warn').mockImplementation(warnMessage => { | ||
const message = createMessage(moduleName, methodName, uniqueMessage); | ||
expect(message).toMatch(warnMessage); | ||
}); | ||
nonModularFunction(); | ||
|
||
expect(consoleWarnSpy2).toHaveBeenCalledTimes(1); | ||
consoleWarnSpy2.mockReset(); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.