diff --git a/packages/snaps-cli/src/commands/build/implementation.test.ts b/packages/snaps-cli/src/commands/build/implementation.test.ts index 5aea7df409..bb619cec71 100644 --- a/packages/snaps-cli/src/commands/build/implementation.test.ts +++ b/packages/snaps-cli/src/commands/build/implementation.test.ts @@ -9,6 +9,7 @@ import { import normalFs from 'fs'; import { dirname, resolve } from 'path'; import type { Configuration } from 'webpack'; +import type webpackModule from 'webpack'; import { getMockConfig } from '../../test-utils'; import { getCompiler } from '../../webpack'; @@ -36,8 +37,10 @@ jest.mock('../../webpack', () => ({ .requireActual('../../webpack') .getCompiler(...args); - compiler.inputFileSystem = normalFs; - compiler.outputFileSystem = normalFs; + compiler.inputFileSystem = + normalFs as unknown as webpackModule.InputFileSystem; + compiler.outputFileSystem = + normalFs as unknown as webpackModule.OutputFileSystem; return compiler; }), @@ -48,11 +51,14 @@ jest.mock('../../webpack/utils', () => ({ getDefaultLoader: jest.fn< ReturnType, Parameters - >(async (config) => { + >(async (config): ReturnType => { if (config.legacy) { return { loader: BROWSERIFY_LOADER_PATH, - options: config.legacy, + options: { + ...config.legacy, + fn: jest.fn(), + }, }; } diff --git a/packages/snaps-cli/src/commands/watch/implementation.test.ts b/packages/snaps-cli/src/commands/watch/implementation.test.ts index 0a879aa786..db4aac4567 100644 --- a/packages/snaps-cli/src/commands/watch/implementation.test.ts +++ b/packages/snaps-cli/src/commands/watch/implementation.test.ts @@ -4,6 +4,7 @@ import { getSnapManifest, } from '@metamask/snaps-utils/test-utils'; import normalFs from 'fs'; +import type webpackModule from 'webpack'; import { getMockConfig } from '../../test-utils'; import { getCompiler } from '../../webpack'; @@ -24,8 +25,10 @@ jest.mock('../../webpack', () => ({ .requireActual('../../webpack') .getCompiler(...args); - compiler.inputFileSystem = normalFs; - compiler.outputFileSystem = normalFs; + compiler.inputFileSystem = + normalFs as unknown as webpackModule.InputFileSystem; + compiler.outputFileSystem = + normalFs as unknown as webpackModule.OutputFileSystem; return compiler; }), @@ -57,6 +60,7 @@ describe('watch', () => { // @ts-expect-error - Partial mock. mock.mockImplementationOnce(() => ({ watch: watchMock, + watching: {}, })); await watch( diff --git a/packages/snaps-utils/src/platform-version.ts b/packages/snaps-utils/src/platform-version.ts index 140c18bea3..680cda9127 100644 --- a/packages/snaps-utils/src/platform-version.ts +++ b/packages/snaps-utils/src/platform-version.ts @@ -1,4 +1,5 @@ import packageJson from '@metamask/snaps-sdk/package.json'; +import type { SemVerVersion } from '@metamask/utils'; /** * Get the current supported platform version. @@ -9,6 +10,6 @@ import packageJson from '@metamask/snaps-sdk/package.json'; * * @returns The platform version. */ -export function getPlatformVersion() { - return packageJson.version; +export function getPlatformVersion(): SemVerVersion { + return packageJson.version as SemVerVersion; }