[
https://issues.apache.org/jira/browse/AMBARI-26261?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17904818#comment-17904818
]
Nikita Pande commented on AMBARI-26261:
---------------------------------------
List of files which are affected are attached with ticket.
Issue found is that in the App.tsx , HashRouter is being used whereas in the
test files as listed in screenshot, Router is been used.
1 eg:
{code:java}
After replacing Router with BrowserRouter, build succeeds:
{code}
eg following succeeds
{code:java}
it("renders correct number of items", async () => { render(
<AppContent.Providervalue={mockContext}> <BrowserRouter> <VersionsList/>
</BrowserRouter> </AppContent.Provider> );{code}
whereas previous code fails to build with the error listed in the Jira ticket
{code:java}
it("renders correct number of items", async () => {
render(
<AppContent.Provider value={mockContext}>
<Router history={createMemoryHistory()}>
<StackVersionsList />
</Router>
</AppContent.Provider>
);
{code}
[~skumar34] please check if the test files compiles and the test runs
successfully with HashRouter/BrowserRouter and make the necessary changes.
> Ambari Admin React Build Fix
> ----------------------------
>
> Key: AMBARI-26261
> URL: https://issues.apache.org/jira/browse/AMBARI-26261
> Project: Ambari
> Issue Type: Bug
> Environment: NAME="Ubuntu"
> VERSION="20.04.6 LTS (Focal Fossa)"
> ID=ubuntu
> ID_LIKE=debian
> PRETTY_NAME="Ubuntu 20.04.6 LTS"
> node -v
> v20.17.0
> npm -v
> 10.8.2
> Reporter: Nikita Pande
> Priority: Major
> Attachments: Screenshot 2024-12-11 at 8.19.27 PM.png
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Fix 'npm run build ' errors in ambari-admin reactjs code
> {code:java}
> src/tests/AddGroup.test.tsx:71:17 - error TS2769: No overload matches this
> call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward71 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/AddUser.test.tsx:70:17 - error TS2769: No
> overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward70 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/DeregisterRemoteCluster.test.tsx:38:15 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward38 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/EditGroup.test.tsx:69:17 - error TS2769: No
> overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward69 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/EditRemoteCluster.test.tsx:44:15 - error
> TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward44 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/EditRemoteCluster.test.tsx:102:17 - error
> TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward102 <Router
> history={history}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/EditUser.test.tsx:69:17 - error TS2769: No
> overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward69 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/ListUsersGroups.test.tsx:69:19 - error
> TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward69 <Router
> history={createMemoryHistory()}>
> ~~~~~~~
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/RegisterRemoteCluster.test.tsx:37:15 - error
> TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward37 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/RegisterRemoteCluster.test.tsx:74:17 - error
> TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward74 <Router
> history={history}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/RemoteClusters.test.tsx:40:15 - error TS2769:
> No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward40 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/RemoteClusters.test.tsx:92:17 - error TS2769:
> No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward92 <Router
> history={history}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:25:29 -
> error TS2307: Cannot find module '../../__mocks__/mockClusterInfo' or its
> corresponding type declarations.25 import mockClusterInfo from
> "../../__mocks__/mockClusterInfo";
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~src/tests/StackVersions/VersionsList.test.tsx:28:31
> - error TS2307: Cannot find module
> '../../screens/ClusterManagement/StackVersions/List' or its corresponding
> type declarations.28 import StackVersionsList from
> "../../screens/ClusterManagement/StackVersions/List";
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~src/tests/StackVersions/VersionsList.test.tsx:46:17
> - error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward46 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:76:17 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward76 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:88:17 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward88 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:103:17 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward103 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:118:17 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward118 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:139:17 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward139 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:152:17 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward152 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'src/tests/StackVersions/VersionsList.test.tsx:170:17 -
> error TS2769: No overload matches this call.
> Overload 1 of 2, '(props: RouterProps): Router', gave the following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward
> Overload 2 of 2, '(props: RouterProps, context: any): Router', gave the
> following error.
> Type 'MemoryHistory' is missing the following properties from type
> 'History<unknown>': length, goBack, goForward170 <Router
> history={createMemoryHistory()}>
> ~~~~~~~ node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> node_modules/@types/react-router/index.d.ts:107:5
> 107 history: H.History;
> ~~~~~~~
> The expected type comes from property 'history' which is declared here on
> type 'IntrinsicAttributes & IntrinsicClassAttributes<Router> &
> Readonly<RouterProps>'
> Found 22 errors.{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]