Skip to content
Merged
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
3 changes: 3 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ const config = createConfig([
// We should enable this instead, but the rule is unreleased.
// See https://github.com/vitest-dev/eslint-plugin-vitest/issues/591
// 'vitest/unbound-method': 'error',
// TODO: Remove these rules once @metamask/eslint-config-vitest is updated to the latest version.
'vitest/no-alias-methods': 'off',
'vitest/prefer-called-exactly-once-with': 'off',
Comment on lines +135 to +136
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume these are new. Are they good? Should we add TODOs to enable them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment that these are temporary and should be removed when @metamask/eslint-config-vitest is updated

},
},

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/coverage-v8": "^4.0.16",
"@vitest/eslint-plugin": "^1.6.5",
"@yarnpkg/types": "^4.0.1",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
Expand All @@ -97,9 +97,9 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4",
"vite": "^7.3.0",
"vite-tsconfig-paths": "^6.0.3",
"vitest": "^4.0.16",
"vitest-fetch-mock": "^0.4.5"
},
"packageManager": "yarn@4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/brow-2-brow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"turbo": "^2.5.6",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vitest": "^3.2.4"
"vitest": "^4.0.16"
},
"eslintConfig": {
"extends": "ipfs",
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -82,16 +82,16 @@
"eslint-plugin-n": "^17.17.0",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-promise": "^7.2.1",
"jsdom": "^26.0.0",
"jsdom": "^27.4.0",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"ses": "^1.14.0",
"turbo": "^2.5.6",
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4"
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ describe('file', () => {
it('should throw an error if lstat throws an error with unknown code', async () => {
const error = makeTestError('UNKNOWN');
mocks.lstat.mockRejectedValue(error);
await expect(isDirectory('test')).rejects.toThrow(error);
await expect(isDirectory('test')).rejects.toThrowError(error);
expect(mocks.lstat).toHaveBeenCalledOnce();
});

it('should throw an error if lstat throws an error with no code', async () => {
const error = makeTestError();
mocks.lstat.mockRejectedValue(error);
await expect(isDirectory('test')).rejects.toThrow(error);
await expect(isDirectory('test')).rejects.toThrowError(error);
expect(mocks.lstat).toHaveBeenCalledOnce();
});
});
Expand All @@ -70,7 +70,7 @@ describe('file', () => {

it('should throw an error if the source is a directory', async () => {
mocks.lstat.mockResolvedValue({ isDirectory: () => true });
await expect(cp('source', 'destination')).rejects.toThrow(
await expect(cp('source', 'destination')).rejects.toThrowError(
/not implemented/u,
);
});
Expand Down Expand Up @@ -98,14 +98,14 @@ describe('file', () => {
it('should throw an error if access throws an error with unknown code', async () => {
const error = makeTestError('UNKNOWN');
mocks.access.mockRejectedValue(error);
await expect(fileExists('source')).rejects.toThrow(error);
await expect(fileExists('source')).rejects.toThrowError(error);
expect(mocks.access).toHaveBeenCalledOnce();
});

it('should throw an error if access throws an error with no code', async () => {
const error = makeTestError();
mocks.access.mockRejectedValue(error);
await expect(fileExists('source')).rejects.toThrow(error);
await expect(fileExists('source')).rejects.toThrowError(error);
expect(mocks.access).toHaveBeenCalledOnce();
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/create-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -76,8 +76,8 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4",
"vite": "^7.3.0",
"vitest": "^4.0.16",
"yargs": "^17.7.2"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-package/src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe('create-package/utils', () => {

await expect(
finalizeAndWriteData(packageData, monorepoFileData),
).rejects.toThrow(/^The package directory already exists:/u);
).rejects.toThrowError(/^The package directory already exists:/u);

expect(fs.mkdir).not.toHaveBeenCalled();
expect(fs.writeFile).not.toHaveBeenCalled();
Expand All @@ -236,7 +236,7 @@ describe('create-package/utils', () => {

await expect(
finalizeAndWriteData(packageData, monorepoFileData),
).rejects.toThrow(/^foo$/u);
).rejects.toThrowError(/^foo$/u);
});
});
});
10 changes: 5 additions & 5 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/eslint-plugin": "^1.3.4",
"@vitejs/plugin-react": "^5.1.2",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -82,7 +82,7 @@
"eslint-plugin-n": "^17.17.0",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-promise": "^7.2.1",
"jsdom": "^26.0.0",
"jsdom": "^27.4.0",
"playwright": "^1.54.2",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
Expand All @@ -91,10 +91,10 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vite": "^7.3.0",
"vite-plugin-checker": "^0.9.1",
"vite-plugin-static-copy": "^2.3.0",
"vitest": "^3.2.4"
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
6 changes: 3 additions & 3 deletions packages/kernel-agents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -95,8 +95,8 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4"
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
6 changes: 3 additions & 3 deletions packages/kernel-browser-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -109,10 +109,10 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vite": "^7.3.0",
"vite-plugin-checker": "^0.9.1",
"vite-plugin-static-copy": "^2.3.0",
"vitest": "^3.2.4"
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,6 @@ describe('PlatformServicesServer', () => {
describe('remote communications', () => {
beforeEach(() => {
// Reset mocks before each test
mockSendRemoteMessage.mockClear();
mockStop.mockClear();
mockCloseConnection.mockClear();
mockRegisterLocationHints.mockClear();
mockReconnectPeer.mockClear();
capturedRemoteMessageHandler = undefined;
capturedRemoteGiveUpHandler = undefined;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ describe('makePanelMessageMiddleware', () => {
let engine: JsonRpcEngineV2;

beforeEach(() => {
mockAssertHasMethod.mockImplementation(() => undefined);

// Set up mocks
mockKernel = {} as Kernel;
mockKernelDatabase = {
Expand Down Expand Up @@ -112,7 +114,7 @@ describe('makePanelMessageMiddleware', () => {
params: { foo: 'bar' },
} as JsonRpcRequest;

await expect(engine.handle(request)).rejects.toThrow(error);
await expect(engine.handle(request)).rejects.toThrowError(error);
expect(mockExecute).toHaveBeenCalledWith('testMethod1', { foo: 'bar' });
});

Expand Down Expand Up @@ -157,7 +159,7 @@ describe('makePanelMessageMiddleware', () => {
throw new Error('The method does not exist / is not available.');
});

await expect(engine.handle(request)).rejects.toThrow(
await expect(engine.handle(request)).rejects.toThrowError(
'The method does not exist / is not available.',
);
expect(mockExecute).not.toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import {

// Mock the logger module
vi.mock('@metamask/logger', () => ({
Logger: vi.fn().mockImplementation(() => ({
error: vi.fn(),
warn: vi.fn(),
})),
Logger: vi.fn().mockImplementation(function () {
return {
error: vi.fn(),
warn: vi.fn(),
};
}),
}));

describe('relay-query-string', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/kernel-errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -82,16 +82,16 @@
"eslint-plugin-n": "^17.17.0",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-promise": "^7.2.1",
"jsdom": "^26.0.0",
"jsdom": "^27.4.0",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"ses": "^1.14.0",
"turbo": "^2.5.6",
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4"
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
6 changes: 3 additions & 3 deletions packages/kernel-language-model-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -96,8 +96,8 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4"
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
6 changes: 3 additions & 3 deletions packages/kernel-platforms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -95,8 +95,8 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4"
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
6 changes: 3 additions & 3 deletions packages/kernel-rpc-methods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -91,8 +91,8 @@
"typedoc": "^0.28.1",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4"
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
6 changes: 3 additions & 3 deletions packages/kernel-shims/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/utils": "^8.29.0",
"@vitest/eslint-plugin": "^1.3.4",
"@vitest/eslint-plugin": "^1.6.5",
"depcheck": "^1.4.7",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
Expand All @@ -77,8 +77,8 @@
"turbo": "^2.5.6",
"typescript": "~5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^7.1.2",
"vitest": "^3.2.4"
"vite": "^7.3.0",
"vitest": "^4.0.16"
},
"engines": {
"node": "^20.11 || >=22"
Expand Down
Loading
Loading