Skip to content

Commit 195373c

Browse files
committed
Update test and fix type errors
1 parent 8b3e9f6 commit 195373c

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

packages/snaps-cli/src/commands/build/implementation.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import normalFs from 'fs';
1010
import { dirname, resolve } from 'path';
1111
import type { Configuration } from 'webpack';
12+
import type webpackModule from 'webpack';
1213

1314
import { getMockConfig } from '../../test-utils';
1415
import { getCompiler } from '../../webpack';
@@ -36,8 +37,10 @@ jest.mock('../../webpack', () => ({
3637
.requireActual<typeof webpack>('../../webpack')
3738
.getCompiler(...args);
3839

39-
compiler.inputFileSystem = normalFs;
40-
compiler.outputFileSystem = normalFs;
40+
compiler.inputFileSystem =
41+
normalFs as unknown as webpackModule.InputFileSystem;
42+
compiler.outputFileSystem =
43+
normalFs as unknown as webpackModule.OutputFileSystem;
4144

4245
return compiler;
4346
}),
@@ -48,11 +51,14 @@ jest.mock('../../webpack/utils', () => ({
4851
getDefaultLoader: jest.fn<
4952
ReturnType<typeof utils.getDefaultLoader>,
5053
Parameters<typeof utils.getDefaultLoader>
51-
>(async (config) => {
54+
>(async (config): ReturnType<typeof utils.getDefaultLoader> => {
5255
if (config.legacy) {
5356
return {
5457
loader: BROWSERIFY_LOADER_PATH,
55-
options: config.legacy,
58+
options: {
59+
...config.legacy,
60+
fn: jest.fn(),
61+
},
5662
};
5763
}
5864

packages/snaps-cli/src/commands/watch/implementation.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
getSnapManifest,
55
} from '@metamask/snaps-utils/test-utils';
66
import normalFs from 'fs';
7+
import type webpackModule from 'webpack';
78

89
import { getMockConfig } from '../../test-utils';
910
import { getCompiler } from '../../webpack';
@@ -24,8 +25,10 @@ jest.mock('../../webpack', () => ({
2425
.requireActual<typeof webpack>('../../webpack')
2526
.getCompiler(...args);
2627

27-
compiler.inputFileSystem = normalFs;
28-
compiler.outputFileSystem = normalFs;
28+
compiler.inputFileSystem =
29+
normalFs as unknown as webpackModule.InputFileSystem;
30+
compiler.outputFileSystem =
31+
normalFs as unknown as webpackModule.OutputFileSystem;
2932

3033
return compiler;
3134
}),
@@ -57,6 +60,7 @@ describe('watch', () => {
5760
// @ts-expect-error - Partial mock.
5861
mock.mockImplementationOnce(() => ({
5962
watch: watchMock,
63+
watching: {},
6064
}));
6165

6266
await watch(

packages/snaps-utils/src/platform-version.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import packageJson from '@metamask/snaps-sdk/package.json';
2+
import type { SemVerVersion } from '@metamask/utils';
23

34
/**
45
* Get the current supported platform version.
@@ -9,6 +10,6 @@ import packageJson from '@metamask/snaps-sdk/package.json';
910
*
1011
* @returns The platform version.
1112
*/
12-
export function getPlatformVersion() {
13-
return packageJson.version;
13+
export function getPlatformVersion(): SemVerVersion {
14+
return packageJson.version as SemVerVersion;
1415
}

0 commit comments

Comments
 (0)