Skip to content

Commit cb505e3

Browse files
Bump the jest group across 1 directory with 4 updates (#23678)
* Bump the jest group across 1 directory with 4 updates Bumps the jest group with 4 updates in the /graylog2-web-interface/packages/jest-preset-graylog directory: [@jest/types](https://github.com/jestjs/jest/tree/HEAD/packages/jest-types), [babel-jest](https://github.com/jestjs/jest/tree/HEAD/packages/babel-jest), [jest](https://github.com/jestjs/jest/tree/HEAD/packages/jest) and [jest-environment-jsdom](https://github.com/jestjs/jest/tree/HEAD/packages/jest-environment-jsdom). Updates `@jest/types` from 29.6.3 to 30.0.5 - [Release notes](https://github.com/jestjs/jest/releases) - [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jestjs/jest/commits/v30.0.5/packages/jest-types) Updates `babel-jest` from 29.7.0 to 30.1.2 - [Release notes](https://github.com/jestjs/jest/releases) - [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jestjs/jest/commits/v30.1.2/packages/babel-jest) Updates `jest` from 29.7.0 to 30.1.3 - [Release notes](https://github.com/jestjs/jest/releases) - [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jestjs/jest/commits/v30.1.3/packages/jest) Updates `jest-environment-jsdom` from 29.7.0 to 30.1.2 - [Release notes](https://github.com/jestjs/jest/releases) - [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/jestjs/jest/commits/v30.1.2/packages/jest-environment-jsdom) --- updated-dependencies: - dependency-name: "@jest/types" dependency-version: 30.0.5 dependency-type: direct:production update-type: version-update:semver-major dependency-group: jest - dependency-name: babel-jest dependency-version: 30.1.2 dependency-type: direct:production update-type: version-update:semver-major dependency-group: jest - dependency-name: jest dependency-version: 30.1.3 dependency-type: direct:production update-type: version-update:semver-major dependency-group: jest - dependency-name: jest-environment-jsdom dependency-version: 30.1.2 dependency-type: direct:production update-type: version-update:semver-major dependency-group: jest ... Signed-off-by: dependabot[bot] <[email protected]> * Updating babel packages. * Jest changed snapshot format. * Adjusting tests to reflect jsdom changes. * Adding license header. * Removing obsolete file. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dennis Oelkers <[email protected]>
1 parent 0adc5db commit cb505e3

File tree

20 files changed

+1247
-1422
lines changed

20 files changed

+1247
-1422
lines changed

graylog2-web-interface/packages/babel-preset-graylog/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"author": "Graylog, Inc. <[email protected]>",
99
"license": "SSPL-1.0",
1010
"dependencies": {
11-
"@babel/core": "^7.18.2",
11+
"@babel/core": "^7.28.4",
1212
"@babel/plugin-syntax-dynamic-import": "7.8.3",
1313
"@babel/plugin-transform-runtime": "7.28.3",
1414
"@babel/preset-env": "7.28.3",
1515
"@babel/preset-react": "7.27.1",
1616
"@babel/preset-typescript": "7.27.1",
17-
"babel-plugin-styled-components": "^2.0.7"
17+
"babel-plugin-styled-components": "^2.1.4"
1818
}
1919
}

graylog2-web-interface/packages/jest-preset-graylog/lib/setup-files/console-warnings-fail-tests.test.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,45 @@ describe('console-warnings-fail-tests', () => {
3939

4040
describe('console.error', () => {
4141
it('throws error if used', () => {
42-
expect(() => { console.error('hello there!'); }).toThrowError(new Error('hello there!'));
42+
expect(() => {
43+
console.error('hello there!');
44+
}).toThrow(new Error('hello there!'));
4345
});
4446

4547
it('does not throw error if containing react deprecation notice', () => {
4648
expect(() => {
47-
console.error('Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.');
49+
console.error(
50+
'Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.',
51+
);
4852
}).not.toThrow();
4953
});
5054

5155
it('does not throw error if called without arguments', () => {
52-
expect(() => { console.error(); }).not.toThrow();
56+
expect(() => {
57+
console.error();
58+
}).not.toThrow();
5359
});
5460
});
5561

5662
describe('console.warn', () => {
5763
it('throws error if used', () => {
58-
expect(() => { console.warn('hello there!'); }).toThrowError(new Error('hello there!'));
64+
expect(() => {
65+
console.warn('hello there!');
66+
}).toThrow(new Error('hello there!'));
5967
});
6068

6169
it('does not throw error if containing react deprecation notice', () => {
6270
expect(() => {
63-
console.warn('Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.');
71+
console.warn(
72+
'Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.',
73+
);
6474
}).not.toThrow();
6575
});
6676

6777
it('does not throw error if called without arguments', () => {
68-
expect(() => { console.warn(); }).not.toThrow();
78+
expect(() => {
79+
console.warn();
80+
}).not.toThrow();
6981
});
7082
});
7183
});

graylog2-web-interface/packages/jest-preset-graylog/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
"author": "Graylog, Inc. <[email protected]>",
1212
"license": "SSPL-1.0",
1313
"dependencies": {
14-
"@jest/types": "29.6.3",
14+
"@jest/types": "30.0.5",
1515
"@testing-library/dom": "9.3.4",
1616
"@testing-library/jest-dom": "6.8.0",
1717
"@testing-library/react": "14.3.0",
1818
"@testing-library/user-event": "^13.5.0",
19-
"@types/jest": "29.5.14",
20-
"babel-jest": "29.7.0",
19+
"@types/jest": "30.0.0",
20+
"babel-jest": "30.1.2",
2121
"identity-obj-proxy": "^3.0.0",
22-
"jest": "29.7.0",
22+
"jest": "30.1.3",
2323
"jest-canvas-mock": "^2.3.1",
24-
"jest-environment-jsdom": "29.7.0",
24+
"jest-environment-jsdom": "30.1.2",
2525
"jest-styled-components": "7.2.0",
2626
"react-select-event": "5.5.1",
2727
"resize-observer-polyfill": "^1.5.1"

graylog2-web-interface/src/generator/__tests__/__snapshots__/parse.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`parse parses an api properly 1`] = `
44
{

graylog2-web-interface/src/logic/permissions/__snapshots__/EntityShareState.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`EntityShareState should import from json 1`] = `
44
{

graylog2-web-interface/src/logic/telemetry/useSendTelemetry.test.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,9 @@ const DummyTelemetryContext = ({ children = undefined }: React.PropsWithChildren
3232
);
3333

3434
describe('useSendTelemetry', () => {
35-
const setLocation = (pathname: string) =>
36-
Object.defineProperty(window, 'location', {
37-
value: {
38-
pathname,
39-
},
40-
writable: true,
41-
});
42-
43-
const oldLocation = window.location.pathname;
44-
45-
afterEach(() => {
46-
window.location.pathname = oldLocation;
47-
});
35+
const setLocation = (pathname: string) => {
36+
window.history.pushState({}, '', pathname);
37+
};
4838

4939
it('should return `sendTelemetry` that retrieves current route', () => {
5040
setLocation('/welcome');

graylog2-web-interface/src/preflight/App.test.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,12 @@ jest.mock('util/UserNotification', () => ({
5959
}));
6060

6161
describe('App', () => {
62-
let windowLocation;
63-
6462
useWindowConfirmMock();
6563

66-
beforeAll(() => {
67-
Object.defineProperty(window, 'location', {
68-
configurable: true,
69-
value: { reload: jest.fn() },
70-
});
71-
});
72-
7364
beforeEach(() => {
7465
asMock(fetch).mockReturnValue(Promise.resolve());
7566
});
7667

77-
afterAll(() => {
78-
Object.defineProperty(window, 'location', { configurable: true, value: windowLocation });
79-
});
80-
8168
it('should render', async () => {
8269
renderPreflight(<App />);
8370

graylog2-web-interface/src/preflight/components/WaitingForStartup.test.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,26 @@ import { renderPreflight, screen, waitFor } from 'wrappedTestingLibrary';
1919

2020
import useServerAvailability from 'preflight/hooks/useServerAvailability';
2121
import { asMock } from 'helpers/mocking';
22+
import reloadPage from 'preflight/components/reloadPage';
2223

2324
import WaitingForStartup from './WaitingForStartup';
2425

2526
jest.mock('preflight/hooks/useServerAvailability', () => jest.fn());
27+
jest.mock('./reloadPage');
2628

2729
describe('WaitingForStartup', () => {
28-
let windowLocation;
29-
30-
beforeAll(() => {
31-
Object.defineProperty(window, 'location', {
32-
configurable: true,
33-
value: { reload: jest.fn() },
34-
});
35-
});
36-
3730
beforeEach(() => {
3831
asMock(useServerAvailability).mockReturnValue({
3932
data: false,
4033
});
4134
});
4235

43-
afterAll(() => {
44-
Object.defineProperty(window, 'location', { configurable: true, value: windowLocation });
45-
});
46-
4736
it('should not reload page while server is starting', async () => {
4837
renderPreflight(<WaitingForStartup />);
4938

5039
await screen.findByText(/The Graylog server is currently starting./);
5140

52-
expect(window.location.reload).not.toHaveBeenCalled();
41+
expect(reloadPage).not.toHaveBeenCalled();
5342
});
5443

5544
it('should reload page after server started', async () => {
@@ -60,6 +49,6 @@ describe('WaitingForStartup', () => {
6049
renderPreflight(<WaitingForStartup />);
6150

6251
await screen.findByText(/The Graylog server is currently starting./);
63-
await waitFor(() => expect(window.location.reload).toHaveBeenCalledTimes(1));
52+
await waitFor(() => expect(reloadPage).toHaveBeenCalledTimes(1));
6453
});
6554
});

graylog2-web-interface/src/preflight/components/WaitingForStartup.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { Space } from '@mantine/core';
2323
import Spinner from 'components/common/Spinner';
2424
import { Section } from 'preflight/components/common';
2525
import useServerAvailability from 'preflight/hooks/useServerAvailability';
26+
import reloadPage from 'preflight/components/reloadPage';
2627

2728
const P = styled.p`
2829
max-width: 700px;
@@ -33,7 +34,7 @@ const WaitingForStartup = () => {
3334

3435
useEffect(() => {
3536
if (serverIsAvailable) {
36-
window.location.reload();
37+
reloadPage();
3738
}
3839
}, [serverIsAvailable]);
3940

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (C) 2020 Graylog, Inc.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the Server Side Public License, version 1,
6+
* as published by MongoDB, Inc.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* Server Side Public License for more details.
12+
*
13+
* You should have received a copy of the Server Side Public License
14+
* along with this program. If not, see
15+
* <http://www.mongodb.com/licensing/server-side-public-license>.
16+
*/
17+
const reloadPage = () => window.location.reload();
18+
19+
export default reloadPage;

0 commit comments

Comments
 (0)