Skip to content

Commit 8c62e5c

Browse files
committed
chore(deps-dev): upgrading vitest to resolve some npm audit issues
1 parent 4d42ceb commit 8c62e5c

File tree

8 files changed

+3292
-2392
lines changed

8 files changed

+3292
-2392
lines changed

__tests__/cli.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { exec } from 'child_process';
22
import path from 'path';
33

4-
import { describe, it, expect } from 'vitest';
4+
import { describe, it, expect, expectTypeOf } from 'vitest';
55

66
import cli from '../src/cli';
77

@@ -19,8 +19,9 @@ function runCommand(cmd, cwd) {
1919
}
2020

2121
describe('CLI', () => {
22+
// eslint-disable-next-line @vitest/expect-expect
2223
it('is a function', () => {
23-
expect(typeof cli).toBe('function');
24+
expectTypeOf(cli).toBeFunction();
2425
});
2526

2627
it('should exit process with non-zero code on a failure', () => {

__tests__/extractor.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs';
22
import path from 'path';
33

4-
import { describe, it, expect } from 'vitest';
4+
import { describe, it, expect, expectTypeOf } from 'vitest';
55

66
import Extractor from '../src/extractor';
77

@@ -71,8 +71,8 @@ describe('Extractor', () => {
7171
expect(endpoint.method).toBe('get');
7272
expect(endpoint.route).toBe('/pets');
7373
expect(endpoint.description).toContain('Returns all');
74-
expect(typeof endpoint.responses).toBe('object');
75-
expect(typeof endpoint.responses['200']).toBe('object');
74+
expectTypeOf(endpoint.responses).toBeObject();
75+
expectTypeOf(endpoint.responses['200']).toBeObject();
7676
});
7777

7878
it('extracts markdown tables from endpoint comment strings', () => {
@@ -118,8 +118,8 @@ describe('Extractor', () => {
118118
expect(endpoint.route).toBe('/pets');
119119
expect(endpoint.summary).toBe('Get pets');
120120
expect(endpoint.description).toContain('Returns all');
121-
expect(typeof endpoint.responses).toBe('object');
122-
expect(typeof endpoint.responses['200']).toBe('object');
121+
expectTypeOf(endpoint.responses).toBeObject();
122+
expectTypeOf(endpoint.responses['200']).toBeObject();
123123
});
124124

125125
it('extracts endpoints from code strings', () => {
@@ -130,7 +130,7 @@ describe('Extractor', () => {
130130

131131
endpoints.forEach(endpoint => {
132132
expect(endpoint.route).toContain('pet');
133-
expect(typeof endpoint.method).toBe('string');
133+
expectTypeOf(endpoint.method).toBeString();
134134
expect(Object.keys(endpoint.responses)).toHaveLength(2);
135135
});
136136
});
@@ -157,8 +157,8 @@ describe('Extractor', () => {
157157

158158
expect(schema.name).toBe('Pet');
159159
expect(Array.isArray(schema.required)).toBe(true);
160-
expect(typeof schema.properties).toBe('object');
161-
expect(typeof schema.properties.id).toBe('object');
160+
expectTypeOf(schema.properties).toBeObject();
161+
expectTypeOf(schema.properties.id).toBeObject();
162162
});
163163

164164
it('returns only endpoints', () => {

__tests__/index.test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'vitest';
1+
import { describe, it, expect, expectTypeOf } from 'vitest';
22

33
import swaggerInline from '../src';
44

@@ -9,11 +9,12 @@ describe('Swagger Inline', () => {
99
}).toThrow('No files specified.');
1010
});
1111

12+
// eslint-disable-next-line @vitest/expect-expect
1213
it('returns a promise', () => {
1314
const returned = swaggerInline('*.js', { base: `${__dirname}/__fixtures__/project` });
1415

15-
expect(typeof returned.then).toBe('function');
16-
expect(typeof returned.catch).toBe('function');
16+
expectTypeOf(returned.then).toBeFunction();
17+
expectTypeOf(returned.catch).toBeFunction();
1718
});
1819

1920
it('throws an error if no base was supplied', () => {
@@ -22,10 +23,11 @@ describe('Swagger Inline', () => {
2223
}).toThrow('No base specification provided!');
2324
});
2425

26+
// eslint-disable-next-line @vitest/expect-expect
2527
it('resolves to a string', () => {
2628
return swaggerInline(`${__dirname}/__fixtures__/project/*.js`, { base: `${__dirname}/__fixtures__/project` }).then(
2729
res => {
28-
expect(typeof res).toBe('string');
30+
expectTypeOf(res).toBeString();
2931
},
3032
);
3133
});

__tests__/loader.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from 'fs';
22

33
import jsYaml from 'js-yaml';
4-
import { describe, it, expect } from 'vitest';
4+
import { describe, it, expect, expectTypeOf } from 'vitest';
55

66
import Loader from '../src/loader';
77

@@ -19,7 +19,7 @@ describe('Loader', () => {
1919
return Loader.resolvePaths(inputPaths).then(filepaths => {
2020
expect(filepaths.length).toBeGreaterThan(1);
2121
filepaths.forEach(filepath => {
22-
expect(typeof filepath).toBe('string');
22+
expectTypeOf(filepath).toBeString();
2323
});
2424
});
2525
});
@@ -28,7 +28,7 @@ describe('Loader', () => {
2828
return Loader.resolvePaths(`${__dirname}/*.js`).then(filepaths => {
2929
expect(filepaths.length).toBeGreaterThan(1);
3030
filepaths.forEach(filepath => {
31-
expect(typeof filepath).toBe('string');
31+
expectTypeOf(filepath).toBeString();
3232
});
3333
});
3434
});

__tests__/options.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect } from 'vitest';
1+
import { describe, it, expect, expectTypeOf } from 'vitest';
22

33
import Options from '../src/options';
44

@@ -29,10 +29,11 @@ describe('Options', () => {
2929
});
3030

3131
describe('#getLogger', () => {
32+
// eslint-disable-next-line @vitest/expect-expect
3233
it('has a logger', () => {
3334
process.env.NODE_ENV = 'production';
3435
const options = new Options();
35-
expect(typeof options.getLogger()).toBe('function');
36+
expectTypeOf(options.getLogger()).toBeFunction();
3637
process.env.NODE_ENV = 'test';
3738
});
3839
});

0 commit comments

Comments
 (0)