Skip to content

Commit 96b2b78

Browse files
committed
fix type errors in gatsby tests
1 parent 4422238 commit 96b2b78

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/gatsby/test/gatsby-browser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
/* eslint-disable @typescript-eslint/no-explicit-any */
33

4-
const { onClientEntry } = require('../gatsby-browser');
4+
import { onClientEntry } from '../gatsby-browser';
55

66
(global as any).__SENTRY_RELEASE__ = '683f3a6ab819d47d23abfca9a914c81f0524d35b';
77
(global as any).__SENTRY_DSN__ = 'https://[email protected]/0';
@@ -153,7 +153,7 @@ describe('onClientEntry', () => {
153153

154154
// Run this last to check for any test side effects
155155
it('does not run if plugin params are undefined', () => {
156-
onClientEntry();
156+
onClientEntry(undefined, undefined);
157157
expect(sentryInit).toHaveBeenCalledTimes(0);
158158
expect(tracingAddExtensionMethods).toHaveBeenCalledTimes(0);
159159
});

packages/gatsby/test/gatsby-node.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
/* eslint-disable @typescript-eslint/no-explicit-any */
3-
const { onCreateWebpackConfig } = require('../gatsby-node');
3+
import { onCreateWebpackConfig } from '../gatsby-node';
44

55
describe('onCreateWebpackConfig', () => {
66
it('sets a webpack config', () => {
@@ -12,7 +12,9 @@ describe('onCreateWebpackConfig', () => {
1212
setWebpackConfig: jest.fn(),
1313
};
1414

15-
onCreateWebpackConfig({ plugins, actions });
15+
const getConfig = jest.fn();
16+
17+
onCreateWebpackConfig({ plugins, actions, getConfig });
1618

1719
expect(plugins.define).toHaveBeenCalledTimes(1);
1820
expect(plugins.define).toHaveBeenLastCalledWith({

packages/gatsby/test/setEnvVars.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
22
process.env.SENTRY_RELEASE = '14abbb1678a2eb59d1a171ea33d630dd6c6eee70';
3+
4+
// This file needs to have an import or an export to count as a module, which is necessary when using
5+
// the `isolatedModules` tsconfig option.
6+
export const _ = '';

0 commit comments

Comments
 (0)