Skip to content

Commit

Permalink
Re-enable integration tests
Browse files Browse the repository at this point in the history
Differential Revision: D63349616
  • Loading branch information
rickhanlonii authored and facebook-github-bot committed Sep 24, 2024
1 parent 0cb32d5 commit b096a97
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const LogBoxData = require('../Data/LogBoxData');
const TestRenderer = require('react-test-renderer');

const installLogBox = () => {
const LogBox = require('../LogBox');
const LogBox = require('../LogBox').default;

LogBox.install();
};

const uninstallLogBox = () => {
const LogBox = require('../LogBox');
const LogBox = require('../LogBox').default;
LogBox.uninstall();
};

Expand All @@ -49,7 +49,7 @@ const cleanLog = logs => {
// TODO(T71117418): Re-enable skipped LogBox integration tests once React component
// stack frames are the same internally and in open source.
// eslint-disable-next-line jest/no-disabled-tests
describe.skip('LogBox', () => {
describe('LogBox', () => {
const {error, warn} = console;
const mockError = jest.fn();
const mockWarn = jest.fn();
Expand All @@ -60,7 +60,6 @@ describe.skip('LogBox', () => {

mockError.mockClear();
mockWarn.mockClear();

(console: any).error = mockError;
(console: any).warn = mockWarn;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`LogBox integrates with React and handles a fragment warning in LogBox: Log added to LogBox 1`] = `
Array [
Object {
"category": "Warning: Invalid prop \`%s\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props.",
"componentStack": Array [
Object {
"collapse": false,
"content": "FragmentWithProp",
"fileName": "<anonymous>",
"location": Object {
"column": -1,
"row": -1,
},
},
],
"componentStackType": "stack",
"level": "warn",
"message": Object {
"content": "Warning: Invalid prop \`invalid\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props.",
"substitutions": Array [
Object {
"length": 7,
"offset": 23,
},
],
},
},
]
`;

exports[`LogBox integrates with React and handles a fragment warning in LogBox: Log passed to console error 1`] = `
Array [
"Warning: Invalid prop \`invalid\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props.
at FragmentWithProp (<anonymous>)",
]
`;
exports[`LogBox integrates with React and handles a fragment warning in LogBox: Log sent from React 1`] = `
Array [
"Invalid prop \`%s\` supplied to \`React.Fragment\`. React.Fragment can only have \`key\` and \`children\` props.%s",
"invalid",
"
at FragmentWithProp (<anonymous>)",
]
`;
exports[`LogBox integrates with React and handles a key error in LogBox: Log added to LogBox 1`] = `
Array [
Object {
"category": "Warning: Each child in a list should have a unique \\"key\\" prop.%s%s See https://react.dev/link/warning-keys for more information.",
"componentStack": Array [
Object {
"collapse": false,
"content": "_classCallCheck",
"fileName": "/path/to/mockComponent.js",
"location": Object {
"column": 17,
"row": 33,
},
},
Object {
"collapse": false,
"content": "DoesNotUseKey",
"fileName": "<anonymous>",
"location": Object {
"column": -1,
"row": -1,
},
},
],
"componentStackType": "stack",
"level": "warn",
"message": Object {
"content": "Warning: Each child in a list should have a unique \\"key\\" prop.
Check the render method of \`DoesNotUseKey\`. See https://react.dev/link/warning-keys for more information.",
"substitutions": Array [
Object {
"length": 45,
"offset": 62,
},
Object {
"length": 0,
"offset": 107,
},
],
},
},
]
`;
exports[`LogBox integrates with React and handles a key error in LogBox: Log passed to console error 1`] = `
Array [
"Warning: Each child in a list should have a unique \\"key\\" prop.
Check the render method of \`DoesNotUseKey\`. See https://react.dev/link/warning-keys for more information.
at _classCallCheck (/path/to/mockComponent.js:33:18)
at DoesNotUseKey (<anonymous>)",
]
`;
exports[`LogBox integrates with React and handles a key error in LogBox: Log sent from React 1`] = `
Array [
"Each child in a list should have a unique \\"key\\" prop.%s%s See https://react.dev/link/warning-keys for more information.%s",
"
Check the render method of \`DoesNotUseKey\`.",
"",
"
at _classCallCheck (/path/to/mockComponent.js:33:18)
at DoesNotUseKey (<anonymous>)",
]
`;

0 comments on commit b096a97

Please sign in to comment.