Skip to content
Open
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
11 changes: 6 additions & 5 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^15.0.7",
"@vitejs/plugin-react": "^4.7.0",
"@vitest/coverage-istanbul": "^3.2.4",
"@vitest/coverage-istanbul": "^4.1.2",
"glob": "^13.0.6",
"immutability-helper": "^3.1.1",
"js-yaml": "^4.1.1",
Expand All @@ -63,7 +63,7 @@
"uuid": "^13.0.0",
"vite": "^7.3.1",
"vite-plugin-checker": "^0.12.0",
"vitest": "^3.2.4",
"vitest": "^4.1.2",
"zod": "^4.3.6"
},
"devDependencies": {
Expand Down Expand Up @@ -120,7 +120,7 @@
"jest-environment-jsdom": "^30.3.0",
"jest-fixed-jsdom": "^0.0.11",
"jest-image-snapshot": "^6.5.2",
"jsdom": "^26.1.0",
"jsdom": "^29.0.1",
"msw": "^2.12.14",
"msw-storybook-addon": "^2.0.6",
"prettier": "^2.8.8",
Expand Down Expand Up @@ -179,8 +179,9 @@
"@splunk/dashboard-types/ajv": "^8.18.0",
"table/ajv": "^8.18.0",
"@rushstack/node-core-library/ajv": "^8.18.0",
"diff": "^5.2.2",
"crypto-js": "^4.2.0"
"diff": "^8.0.4",
"crypto-js": "^4.2.0",
"vitest/vite": "^7.3.1"
},
"engines": {
"node": "22.22.0",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/table/tests/CustomTableCell.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ test('Error as custom cell file is undefined', async () => {
await waitFor(() => {
expect(mockConsoleError).toHaveBeenCalledWith(
expect.stringContaining(
"[Custom Cell] Error loading custom control Error: Cannot find module '/custom/CustomInputCell.js' imported from"
"[Custom Cell] Error loading custom control Error: Cannot find module '/custom/CustomInputCell.js'"
)
);
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions ui/src/pages/Input/tests/InputPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ it('click on menu item inside group should add input query to URL', async () =>
expect(mockNavigateFn).not.toHaveBeenCalled();

await userEvent.click(screen.getByRole('menuitem', { name: 'Billing' }));
await userEvent.click(
screen.getByRole('menuitem', { name: 'Billing (Cost and Usage Report) (Recommended)' })
);
const submenuItem = await screen.findByRole('menuitem', {
name: /Billing \(Cost and Usage Report\).*\(Recommended\)/,
});
await userEvent.click(submenuItem);

expect(mockNavigateFn).toHaveBeenCalledWith({
search: `service=aws_billing_cur&action=create&input=aws_billing_menu`,
Expand Down
4 changes: 3 additions & 1 deletion ui/src/util/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ export async function fetchWithErrorHandling<TData>(
}
return await response.json();
} catch (error) {
const isAborted = error instanceof DOMException && error.name === 'AbortError';
const isAborted =
(error instanceof DOMException || error instanceof Error) &&
error.name === 'AbortError';
if (handleError && !isAborted) {
const errorMsg = parseErrorMsg(error);
generateToast(errorMsg, 'error');
Expand Down
11 changes: 5 additions & 6 deletions ui/test.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,20 @@ afterAll(() => server.close());
* Failing tests if there is some console error during tests
*/

// Capture the real console.error once, before any spies are installed,
// to avoid infinite recursion when vitest 4 reuses spy references.
// eslint-disable-next-line no-console
const originalConsoleError = console.error;

// eslint-disable-next-line import/no-mutable-exports
export let consoleError: MockInstance<{
(...data: unknown[]): void;
(message?: unknown, ...optionalParams: unknown[]): void;
}>;

beforeEach(() => {
// eslint-disable-next-line no-console
const originalConsoleError = console.error;
consoleError = vi.spyOn(console, 'error');
consoleError.mockImplementation((...args: Parameters<typeof console.error>) => {
originalConsoleError(...args);
// todo: will be resolved in the future
// throw new Error(
// 'Console error was called. Call consoleError.mockImplementation(() => {}) if this is expected.'
// );
});
});
2 changes: 1 addition & 1 deletion ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ const vitestTestConfig: VitestUserConfigInterface = {
watch: false,
globals: true,
environment: 'jsdom',
testTimeout: 15000,
setupFiles: 'test.setup.ts',
server: {
deps: {
inline: ['jspdf'],
},
},
coverage: {
all: true,
provider: 'istanbul',
reporter: ['text'],
thresholds: {
Expand Down
Loading
Loading