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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Dependabot: Bump ws from 8.18.0 to 8.20.1
- Dependabot: Bump fast-uri from 3.0.3 to 3.1.2
- Dependabot: Bump nginx from 1.29.7 to 1.29.8
- Dependabot: Bump msw from 2.12.7 to 2.13.6

## 2026-05-19 - 0.24.2

Expand Down
6 changes: 4 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
preset: 'ts-jest/presets/js-with-ts',
rootDir: '.',
testRegex: '(/__tests__/*.test.js|\\.(test))\\.(jsx|js|tsx|ts)$',
moduleFileExtensions: ['jsx', 'js', 'tsx', 'ts', 'json'],
moduleFileExtensions: ['jsx', 'js', 'mjs', 'tsx', 'ts', 'json'],
collectCoverage: false,
coverageThreshold: {
global: {
Expand Down Expand Up @@ -44,8 +44,10 @@ export default {
},
},
],
'node_modules/rettime/.*\\.mjs$': ['<rootDir>/test/esm-to-cjs.cjs'],
'node_modules/@open-draft/deferred-promise/.*\\.mjs$': ['<rootDir>/test/esm-to-cjs.cjs'],
},
transformIgnorePatterns: ['node_modules/(?!until-async)(?!pretty-bytes/.*)'],
transformIgnorePatterns: ['node_modules/(?!(until-async|pretty-bytes|rettime|@open-draft/deferred-promise)/.*)'],
setupFilesAfterEnv: ['<rootDir>/test/setup.ts'],
globalSetup: './test/global-setup.ts',
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-fixed-jsdom": "^0.0.11",
"msw": "^2.12.7",
"msw": "^2.13.6",
"postcss": "^8.5.10",
"prettier": "^3.8.1",
"prettier-plugin-sort-imports": "^1.8.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,12 @@ const mockNodeStatus = (rows: [][]) => {
};

describe('ClusterHealthManager', () => {
beforeAll(() => {
server.listen();
});

afterEach(() => {
server.resetHandlers();
act(() => {
useClusterHealthStore.setState({ clusterHealth: {} });
});
});

afterAll(() => {
server.close();
});

describe('load', () => {
it('populates the store with load data when nodes are available', async () => {
setup();
Expand Down
8 changes: 0 additions & 8 deletions src/routes/TablesShards/TablesShardsMetrics.test.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import TablesShardsMetrics from './TablesShardsMetrics';
import { render, screen, within } from 'test/testUtils';
import server from 'test/msw';

const setup = () => {
return render(<TablesShardsMetrics />);
};

describe('the TablesShardsMetrics component', () => {
beforeAll(() => {
server.listen();
});

afterAll(() => {
server.close();
});

describe('the statistics panel', () => {
it('displays the cluster health', async () => {
Expand Down
25 changes: 25 additions & 0 deletions test/esm-to-cjs.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

// Minimal ESM-to-CJS transformer for pure-ESM node_modules packages.
// Used specifically for rettime, which msw 2.13.x depends on but ships only as .mjs.
// Handles named imports/exports only — sufficient for rettime's actual surface area.
module.exports = {
process(sourceText) {
let code = sourceText;

// import { X, Y } from './path' → const { X, Y } = require('./path')
code = code.replace(
/^import\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]\s*;?/gm,
(_, namedImports, modulePath) =>
`const {${namedImports}} = require('${modulePath}');`,
);

// export { X, Y } → module.exports = { X, Y }
code = code.replace(
/^export\s+\{([^}]+)\}\s*;?/gm,
(_, namedExports) => `module.exports = {${namedExports}};`,
);

return { code };
},
};
2 changes: 1 addition & 1 deletion test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Object.defineProperty(window, 'localStorage', {
value: mockLocalStorage,
});

beforeAll(() => server.listen());
beforeEach(() => {
server.listen();
useLocation.mockReturnValue({
pathname: '',
});
Expand Down
Loading
Loading