Skip to content

Commit

Permalink
[test] Fix tests on Node 16 (mui#30819)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak authored and wladimirguerra committed Feb 2, 2022
1 parent 1701e08 commit 1a4d3ef
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/mui-base/src/AutocompleteUnstyled/useAutocomplete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,21 @@ describe('useAutocomplete', () => {
);
};

const node16ErrorMessage =
"Error: Uncaught [TypeError: Cannot read properties of null (reading 'removeAttribute')]";
const olderNodeErrorMessage =
"Error: Uncaught [TypeError: Cannot read property 'removeAttribute' of null]";

const nodeVersion = Number(process.versions.node.split('.')[0]);
const errorMessage = nodeVersion >= 16 ? node16ErrorMessage : olderNodeErrorMessage;

const devErrorMessages = [
"Error: Uncaught [TypeError: Cannot read property 'removeAttribute' of null]",
errorMessage,
'MUI: Unable to find the input element.',
"Error: Uncaught [TypeError: Cannot read property 'removeAttribute' of null]",
errorMessage,
// strict effects runs effects twice
React.version.startsWith('18') && 'MUI: Unable to find the input element.',
React.version.startsWith('18') &&
"Error: Uncaught [TypeError: Cannot read property 'removeAttribute' of null]",
React.version.startsWith('18') && errorMessage,
'The above error occurred in the <ul> component',
React.version.startsWith('16') && 'The above error occurred in the <ul> component',
'The above error occurred in the <Test> component',
Expand Down

0 comments on commit 1a4d3ef

Please sign in to comment.