Skip to content

Commit 953b964

Browse files
build(deps-dev): Bump @vitest/eslint-plugin in the vitest group (#509)
Bumps the vitest group with 1 update: [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest). Updates `@vitest/eslint-plugin` from 1.5.0 to 1.5.1 - [Release notes](https://github.com/vitest-dev/eslint-plugin-vitest/releases) - [Commits](vitest-dev/eslint-plugin-vitest@v1.5.0...v1.5.1) --- updated-dependencies: - dependency-name: "@vitest/eslint-plugin" dependency-version: 1.5.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: vitest ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 9eb8cfd commit 953b964

File tree

6 files changed

+226
-193
lines changed

6 files changed

+226
-193
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@typescript-eslint/eslint-plugin": "^8.47.0",
3636
"@typescript-eslint/parser": "^8.30.1",
3737
"@vitest/coverage-v8": "^3.2.2",
38-
"@vitest/eslint-plugin": "^1.4.4",
38+
"@vitest/eslint-plugin": "^1.5.1",
3939
"autoprefixer": "^10.4.21",
4040
"concurrently": "^9.1.2",
4141
"cronstrue": "^3.3.0",

packages/extension/src/manager/contexts-manager.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ test('deleteObject handler throws a non-Status in ApiException', async () => {
14831483
{},
14841484
),
14851485
);
1486-
await expect(() => manager.deleteObject('Resource4', 'resource-name', 'other-ns')).rejects.toThrow(
1486+
await expect(() => manager.deleteObject('Resource4', 'resource-name', 'other-ns')).rejects.toThrowError(
14871487
/Message: Bad Request/,
14881488
);
14891489
expect(window.showInformationMessage).toHaveBeenCalled();
@@ -1502,7 +1502,7 @@ test('deleteObject handler throws a non-ApiException', async () => {
15021502
vi.mocked(window.showInformationMessage).mockImplementation(async (): Promise<string> => 'Yes');
15031503
const error = new Error('an error');
15041504
resource4DeleteObjectMock.mockRejectedValue(error);
1505-
await expect(() => manager.deleteObject('Resource4', 'resource-name', 'other-ns')).rejects.toThrow(error);
1505+
await expect(() => manager.deleteObject('Resource4', 'resource-name', 'other-ns')).rejects.toThrowError(error);
15061506
expect(window.showInformationMessage).toHaveBeenCalled();
15071507
expect(resource4DeleteObjectMock).toHaveBeenCalledWith(expect.anything(), 'resource-name', 'other-ns');
15081508
expect(manager.handleStatus).not.toHaveBeenCalled();

packages/extension/src/port-forward/port-forward-connection.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ describe('PortForwardConnectionService', () => {
215215
});
216216

217217
test('should throw an error for unsupported workload kind', async () => {
218-
await expect(service.getWorkloadResource('UNSUPPORTED_KIND' as never, 'test', 'default')).rejects.toThrow(
218+
await expect(service.getWorkloadResource('UNSUPPORTED_KIND' as never, 'test', 'default')).rejects.toThrowError(
219219
`Workload kind 'UNSUPPORTED_KIND' currently not supported.`,
220220
);
221221
});
@@ -436,7 +436,7 @@ describe('PortForwardConnectionService', () => {
436436
});
437437

438438
test('should throw an error for unsupported workload kind', async () => {
439-
await expect(service.getWorkloadResource('UNSUPPORTED_KIND' as never, 'test', 'default')).rejects.toThrow(
439+
await expect(service.getWorkloadResource('UNSUPPORTED_KIND' as never, 'test', 'default')).rejects.toThrowError(
440440
`Workload kind 'UNSUPPORTED_KIND' currently not supported.`,
441441
);
442442
});
@@ -534,7 +534,7 @@ describe('PortForwardConnectionService', () => {
534534
const invalidResource = { kind: 'InvalidKind' };
535535
const forward = { localPort: 3000, remotePort: 80 };
536536

537-
await expect(service.getForwardingSetup(invalidResource as never, forward)).rejects.toThrow(
537+
await expect(service.getForwardingSetup(invalidResource as never, forward)).rejects.toThrowError(
538538
'Found invalid resource type.',
539539
);
540540
});
@@ -623,7 +623,7 @@ describe('PortForwardConnectionService', () => {
623623

624624
vi.spyOn(service, 'performForward').mockRejectedValueOnce(new Error('Failed to forward port'));
625625

626-
await expect(service.startForward(forwardConfig)).rejects.toThrow('Failed to forward port');
626+
await expect(service.startForward(forwardConfig)).rejects.toThrowError('Failed to forward port');
627627

628628
expect(service.performForward).toHaveBeenCalledTimes(1);
629629
});

packages/extension/src/port-forward/port-forward-storage.spec.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ describe('PreferenceFolderBasedStorage', () => {
7070
const storage = new PreferenceFolderBasedStorage(baseDirectory);
7171
storage['initialized'] = true;
7272

73-
await expect(storage.initStorage()).rejects.toThrow('Storage has already been initialized.');
73+
await expect(storage.initStorage()).rejects.toThrowError('Storage has already been initialized.');
7474
});
7575

7676
test('should return storage path if initialized', () => {
@@ -83,7 +83,7 @@ describe('PreferenceFolderBasedStorage', () => {
8383

8484
test('should throw error if storage is not initialized when getting path', () => {
8585
const storage = new PreferenceFolderBasedStorage(baseDirectory);
86-
expect(() => storage.getStoragePath()).toThrow('Storage has not been initialized yet.');
86+
expect(() => storage.getStoragePath()).toThrowError('Storage has not been initialized yet.');
8787
});
8888

8989
test('should return true if storage is initialized', () => {
@@ -102,7 +102,7 @@ describe('PreferenceFolderBasedStorage', () => {
102102
const mkdirMock = vi.spyOn(fs, 'mkdir').mockResolvedValue(undefined);
103103
const accessMock = vi.spyOn(fs, 'access').mockRejectedValue(new Error('EACCES'));
104104

105-
await expect(storage.initStorage()).rejects.toThrow('EACCES');
105+
await expect(storage.initStorage()).rejects.toThrowError('EACCES');
106106
expect(mkdirMock).toHaveBeenCalledWith(baseDirectory, { recursive: true });
107107
expect(accessMock).toHaveBeenCalledWith(`${baseDirectory}${path.sep}port-forwards.json`);
108108
});
@@ -111,7 +111,7 @@ describe('PreferenceFolderBasedStorage', () => {
111111
const storage = new PreferenceFolderBasedStorage(baseDirectory);
112112
const mkdirMock = vi.spyOn(fs, 'mkdir').mockRejectedValue(new Error('EACCES'));
113113

114-
await expect(storage.initStorage()).rejects.toThrow('EACCES');
114+
await expect(storage.initStorage()).rejects.toThrowError('EACCES');
115115
expect(mkdirMock).toHaveBeenCalledWith(baseDirectory, { recursive: true });
116116
});
117117
});
@@ -194,13 +194,15 @@ describe('FileBasedConfigStorage', () => {
194194
const storage = new TestFileBasedConfigStorage(mockFileStorage, 'test-key');
195195
storage['configs'] = [sampleConfig];
196196

197-
expect(() => storage._createForward(sampleConfig)).toThrow('Found existed forward configuration with the same id.');
197+
expect(() => storage._createForward(sampleConfig)).toThrowError(
198+
'Found existed forward configuration with the same id.',
199+
);
198200
});
199201

200202
test('should throw an error if deleting a non-existing forward configuration', () => {
201203
const storage = new TestFileBasedConfigStorage(mockFileStorage, 'test-key');
202204

203-
expect(() => storage._deleteForward(sampleConfig)).toThrow(
205+
expect(() => storage._deleteForward(sampleConfig)).toThrowError(
204206
`Forward configuration with id ${sampleConfig.id} not found.`,
205207
);
206208
});
@@ -209,7 +211,7 @@ describe('FileBasedConfigStorage', () => {
209211
const storage = new TestFileBasedConfigStorage(mockFileStorage, 'test-key');
210212
const newConfig = { ...sampleConfig, displayName: 'new-display-name' };
211213

212-
expect(() => storage._updateForward(sampleConfig, newConfig)).toThrow(
214+
expect(() => storage._updateForward(sampleConfig, newConfig)).toThrowError(
213215
`Forward configuration with id ${sampleConfig.id} not found.`,
214216
);
215217
});
@@ -291,13 +293,15 @@ describe('MemoryBasedConfigStorage', () => {
291293
const storage = new MemoryBasedStorage();
292294
storage['configs'] = [sampleConfig];
293295

294-
expect(() => storage.createForward(sampleConfig)).toThrow('Found existed forward configuration with the same id.');
296+
expect(() => storage.createForward(sampleConfig)).toThrowError(
297+
'Found existed forward configuration with the same id.',
298+
);
295299
});
296300

297301
test('should throw an error if deleting a non-existing forward configuration', () => {
298302
const storage = new MemoryBasedStorage();
299303

300-
expect(() => storage.deleteForward(sampleConfig)).toThrow(
304+
expect(() => storage.deleteForward(sampleConfig)).toThrowError(
301305
`Forward configuration with id ${sampleConfig.id} not found.`,
302306
);
303307
});
@@ -306,7 +310,7 @@ describe('MemoryBasedConfigStorage', () => {
306310
const storage = new MemoryBasedStorage();
307311
const newConfig: ForwardConfig = { ...sampleConfig, namespace: 'new-ns' };
308312

309-
expect(() => storage.updateForward(sampleConfig, newConfig)).toThrow(
313+
expect(() => storage.updateForward(sampleConfig, newConfig)).toThrowError(
310314
`Forward configuration with id ${sampleConfig.id} not found.`,
311315
);
312316
});

packages/extension/src/port-forward/port-forward-validation.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('ForwardConfigRequirements', () => {
4242
const requirements = new ForwardConfigRequirements(portChecker);
4343
const invalidConfig = { ...validConfig, name: '' };
4444

45-
await expect(requirements.checkRuntimeRequirements(invalidConfig)).rejects.toThrow(
45+
await expect(requirements.checkRuntimeRequirements(invalidConfig)).rejects.toThrowError(
4646
'Found empty resource (Pod, Deployment or Service) name.',
4747
);
4848
});
@@ -52,14 +52,14 @@ describe('ForwardConfigRequirements', () => {
5252
const requirements = new ForwardConfigRequirements(portChecker);
5353
const invalidConfig = { ...validConfig, namespace: '' };
5454

55-
await expect(requirements.checkRuntimeRequirements(invalidConfig)).rejects.toThrow('Found empty namespace.');
55+
await expect(requirements.checkRuntimeRequirements(invalidConfig)).rejects.toThrowError('Found empty namespace.');
5656
});
5757

5858
test('should fail if port is not available', async () => {
5959
const portChecker = vi.fn().mockRejectedValue(new Error('Port is already in use.'));
6060
const requirements = new ForwardConfigRequirements(portChecker);
6161

62-
await expect(requirements.checkRuntimeRequirements(validConfig)).rejects.toThrow();
62+
await expect(requirements.checkRuntimeRequirements(validConfig)).rejects.toThrowError();
6363
});
6464

6565
test('should propagate port check failures', async () => {
@@ -70,6 +70,8 @@ describe('ForwardConfigRequirements', () => {
7070
forward: { localPort: 8080, remotePort: 80 },
7171
};
7272

73-
await expect(requirements.checkRuntimeRequirements(multiPortConfig)).rejects.toThrow('Port 8081 is not available');
73+
await expect(requirements.checkRuntimeRequirements(multiPortConfig)).rejects.toThrowError(
74+
'Port 8081 is not available',
75+
);
7476
});
7577
});

0 commit comments

Comments
 (0)