mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
Update flow-bin to the latest version 🚀 (#183)
* chore(package): update flow-bin to version 0.99.0 * chore(package): update lockfile yarn.lock * Fix flow
This commit is contained in:
committed by
Michał Pierzchała
parent
9227012e45
commit
2c181b844e
+1
-1
@@ -26,7 +26,7 @@
|
||||
"conventional-changelog-cli": "^2.0.11",
|
||||
"dedent": "^0.7.0",
|
||||
"eslint": "^5.15.2",
|
||||
"flow-bin": "^0.98.0",
|
||||
"flow-bin": "^0.99.0",
|
||||
"flow-copy-source": "^2.0.6",
|
||||
"jest": "^24.7.1",
|
||||
"metro-react-native-babel-preset": "^0.52.0",
|
||||
|
||||
@@ -6,6 +6,8 @@ import stripAnsi from 'strip-ansi';
|
||||
import { debug, render, fireEvent, flushMicrotasksQueue } from '..';
|
||||
import debugShallow from '../helpers/debugShallow';
|
||||
|
||||
type ConsoleLogMock = JestMockFn<Array<string>, void>;
|
||||
|
||||
function TextComponent({ text }) {
|
||||
return <Text>{text}</Text>;
|
||||
}
|
||||
@@ -30,17 +32,16 @@ class Button extends React.Component<*, *> {
|
||||
}
|
||||
|
||||
test('debug', () => {
|
||||
// $FlowFixMe
|
||||
console.log = jest.fn();
|
||||
jest.spyOn(console, 'log').mockImplementation(x => x);
|
||||
const component = <Button onPress={jest.fn} text="Press me" />;
|
||||
debug(component);
|
||||
|
||||
const output = console.log.mock.calls[0][0];
|
||||
const output = (console.log: ConsoleLogMock).mock.calls[0][0];
|
||||
|
||||
expect(stripAnsi(output)).not.toEqual(output);
|
||||
expect(stripAnsi(output)).toMatchSnapshot();
|
||||
|
||||
console.log.mockReset();
|
||||
(console.log: ConsoleLogMock).mockReset();
|
||||
|
||||
debug(component, 'test message');
|
||||
|
||||
@@ -57,12 +58,12 @@ test('debug.deep', () => {
|
||||
const component = <Button onPress={jest.fn} text="Press me" />;
|
||||
debug.deep(component);
|
||||
|
||||
const output = console.log.mock.calls[0][0];
|
||||
const output = (console.log: ConsoleLogMock).mock.calls[0][0];
|
||||
|
||||
expect(stripAnsi(output)).not.toEqual(output);
|
||||
expect(stripAnsi(output)).toMatchSnapshot();
|
||||
|
||||
console.log.mockReset();
|
||||
(console.log: ConsoleLogMock).mockReset();
|
||||
|
||||
debug.deep(component, 'test message');
|
||||
|
||||
@@ -81,7 +82,7 @@ test('debug.deep async test', async () => {
|
||||
|
||||
debug.deep(toJSON());
|
||||
|
||||
const output = console.log.mock.calls[0][0];
|
||||
const output = (console.log: ConsoleLogMock).mock.calls[0][0];
|
||||
|
||||
expect(stripAnsi(output)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@@ -11,6 +11,8 @@ import {
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import { render, fireEvent } from '..';
|
||||
|
||||
type ConsoleLogMock = JestMockFn<Array<string>, void>;
|
||||
|
||||
const PLACEHOLDER_FRESHNESS = 'Add custom freshness';
|
||||
const PLACEHOLDER_CHEF = 'Who inspected freshness?';
|
||||
|
||||
@@ -269,7 +271,7 @@ test('debug', () => {
|
||||
debug.shallow('my other custom message');
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const mockCalls = console.log.mock.calls;
|
||||
const mockCalls = (console.log: ConsoleLogMock).mock.calls;
|
||||
|
||||
expect(stripAnsi(mockCalls[0][0])).toMatchSnapshot();
|
||||
expect(stripAnsi(mockCalls[1][0] + mockCalls[1][1])).toMatchSnapshot(
|
||||
@@ -291,7 +293,7 @@ test('debug changing component', () => {
|
||||
debug();
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
const mockCalls = console.log.mock.calls;
|
||||
const mockCalls = (console.log: ConsoleLogMock).mock.calls;
|
||||
|
||||
expect(stripAnsi(mockCalls[4][0])).toMatchSnapshot(
|
||||
'bananaFresh button message should now be "fresh"'
|
||||
|
||||
@@ -3250,10 +3250,10 @@ flatted@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916"
|
||||
integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==
|
||||
|
||||
flow-bin@^0.98.0:
|
||||
version "0.98.0"
|
||||
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.98.0.tgz#3361a03682326a83a5f0a864749f4f7f0d826bce"
|
||||
integrity sha512-vuiYjBVt82eYF+dEk9Zqa8hTSDvbhl/czxzFRLZm9/XHbJnYNMTwFoNFYAQT9IQ6ACNBIbwSTIfxroieuKja7g==
|
||||
flow-bin@^0.99.0:
|
||||
version "0.99.0"
|
||||
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.99.0.tgz#df035be2493825ddce0b2f26d1273747465b538c"
|
||||
integrity sha512-PjTzcOwte2mq+aP+HFCQZw/AojltOnOdtZC9iPzkWJJdPH7nYSKkZhC4dFgP24BuXsJH6yZBZ48gEKsX04UegQ==
|
||||
|
||||
flow-copy-source@^2.0.6:
|
||||
version "2.0.6"
|
||||
|
||||
Reference in New Issue
Block a user