Skip to content

Update flow-bin to the latest version 🚀 #183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 8 additions & 7 deletions src/__tests__/debug.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
}
Expand All @@ -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');

Expand All @@ -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');

Expand All @@ -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();
});
6 changes: 4 additions & 2 deletions src/__tests__/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?';

Expand Down Expand Up @@ -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(
Expand All @@ -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"'
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down