Skip to content

Commit 5d7f7ea

Browse files
committed
test: autofix vitest/prefer-strict-boolean-matchers
1 parent 0436c86 commit 5d7f7ea

File tree

10 files changed

+22
-24
lines changed

10 files changed

+22
-24
lines changed

e2e/ci-e2e/tests/basic.e2e.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('CI - standalone mode', () => {
6060
path.join(repo.baseDir, '.code-pushup/.ci/.current/report.json'),
6161
'utf8',
6262
);
63-
await expect(jsonPromise).resolves.toBeTruthy();
63+
await expect(jsonPromise).resolves.toBe(true);
6464
const report = JSON.parse(await jsonPromise) as Report;
6565
expect(report).toEqual(
6666
expect.objectContaining({
@@ -137,7 +137,7 @@ describe('CI - standalone mode', () => {
137137
path.join(repo.baseDir, '.code-pushup/.ci/.comparison/report-diff.md'),
138138
'utf8',
139139
);
140-
await expect(mdPromise).resolves.toBeTruthy();
140+
await expect(mdPromise).resolves.toBe(true);
141141
const md = await mdPromise;
142142
await expect(
143143
md.replace(/[\da-f]{40}/g, '`<commit-sha>`'),

e2e/ci-e2e/tests/npm-workspaces.e2e.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ describe('CI - monorepo mode (npm workspaces)', () => {
175175
path.join(repo.baseDir, '.code-pushup/.ci/.comparison/report-diff.md'),
176176
'utf8',
177177
);
178-
await expect(mdPromise).resolves.toBeTruthy();
178+
await expect(mdPromise).resolves.toBe(true);
179179
const md = await mdPromise;
180180
await expect(
181181
md.replace(/[\da-f]{40}/g, '`<commit-sha>`'),

e2e/ci-e2e/tests/nx-monorepo.e2e.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ describe('CI - monorepo mode (Nx)', () => {
208208
path.join(repo.baseDir, '.code-pushup/.ci/.comparison/report-diff.md'),
209209
'utf8',
210210
);
211-
await expect(mdPromise).resolves.toBeTruthy();
211+
await expect(mdPromise).resolves.toBe(true);
212212
const md = await mdPromise;
213213
await expect(
214214
md.replace(/[\da-f]{40}/g, '`<commit-sha>`'),

packages/cli/src/lib/implementation/core-config.middleware.integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('coreConfigMiddleware', () => {
5454
tsconfig: path.join(configDirPath, 'tsconfig.json'),
5555
...CLI_DEFAULTS,
5656
}),
57-
).resolves.toBeTruthy();
57+
).resolves.toBe(true);
5858
});
5959

6060
it('should throw if --tsconfig is missing but needed to resolve import', async () => {

packages/core/src/lib/compare.unit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('compareReportFiles', () => {
4747
const reportsDiffPromise = readJsonFile(
4848
path.join(MEMFS_VOLUME, 'report-diff.json'),
4949
);
50-
await expect(reportsDiffPromise).resolves.toBeTruthy();
50+
await expect(reportsDiffPromise).resolves.toBe(true);
5151

5252
const reportsDiff = await reportsDiffPromise;
5353
expect(() => reportsDiffSchema.parse(reportsDiff)).not.toThrow();
@@ -65,10 +65,10 @@ describe('compareReportFiles', () => {
6565

6666
await expect(
6767
fileExists(path.join(MEMFS_VOLUME, 'report-diff.json')),
68-
).resolves.toBeTruthy();
68+
).resolves.toBe(true);
6969
await expect(
7070
fileExists(path.join(MEMFS_VOLUME, 'report-diff.md')),
71-
).resolves.toBeTruthy();
71+
).resolves.toBe(true);
7272
});
7373

7474
it('should include portal link (fetched using upload config) in Markdown file', async () => {

packages/plugin-lighthouse/src/lib/utils.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('validateAudits', () => {
5757
],
5858
['a'],
5959
),
60-
).toBeTruthy();
60+
).toBe(true);
6161
});
6262

6363
it('should throw if given audits do not exist', () => {
@@ -92,7 +92,7 @@ describe('validateOnlyCategories', () => {
9292
],
9393
'coverage',
9494
),
95-
).toBeTruthy();
95+
).toBe(true);
9696
});
9797

9898
it('should throw if given onlyCategories do not exist', () => {

packages/utils/src/lib/file-system.unit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ describe('ensureDirectoryExists', () => {
2222
const dir = path.join(MEMFS_VOLUME, 'sub', 'dir');
2323

2424
await ensureDirectoryExists(dir);
25-
await expect(
26-
stat(dir).then(stats => stats.isDirectory()),
27-
).resolves.toBeTruthy();
25+
await expect(stat(dir).then(stats => stats.isDirectory())).resolves.toBe(
26+
true,
27+
);
2828
});
2929
});
3030

packages/utils/src/lib/semver.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('isSemver', () => {
1919
['1.2.3-alpha-4'],
2020
['11.22.33+alpha.4'],
2121
])('should return true for a valid semver string: %s', versionString => {
22-
expect(isSemver(versionString)).toBeTruthy();
22+
expect(isSemver(versionString)).toBe(true);
2323
});
2424

2525
it.each([
@@ -28,7 +28,7 @@ describe('isSemver', () => {
2828
['package-1.2.3-alpha.0'], // (wrong as no @ for prefix)
2929
['package-11.22.33-alpha.0'], //(wrong package separator)
3030
])('should return false for a invalid semver string: s%', versionString => {
31-
expect(isSemver(versionString)).toBeFalsy();
31+
expect(isSemver(versionString)).toBe(false);
3232
});
3333
});
3434

testing/test-setup/src/vitest.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/consistent-type-definitions */
21
import type { CustomMarkdownTableMatchers } from './lib/extend/markdown-table.matcher.js';
32
import type {
43
CustomAsymmetricPathMatchers,
@@ -11,7 +10,6 @@ declare module 'vitest' {
1110
extends CustomPathMatchers,
1211
CustomUiLoggerMatchers,
1312
CustomMarkdownTableMatchers {}
14-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
13+
1514
interface AsymmetricMatchersContaining extends CustomAsymmetricPathMatchers {}
1615
}
17-
/* eslint-enable @typescript-eslint/consistent-type-definitions */

testing/test-utils/src/lib/utils/file-system.unit.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ describe('ensureDirectoryExists', () => {
3939
const dir = path.join(MEMFS_VOLUME, 'sub', 'dir');
4040

4141
await ensureDirectoryExists(dir);
42-
await expect(
43-
stat(dir).then(stats => stats.isDirectory()),
44-
).resolves.toBeTruthy();
42+
await expect(stat(dir).then(stats => stats.isDirectory())).resolves.toBe(
43+
true,
44+
);
4545
});
4646

4747
it('should pass if folder exists', async () => {
@@ -55,8 +55,8 @@ describe('ensureDirectoryExists', () => {
5555
const dir = path.join(MEMFS_VOLUME, 'sub');
5656

5757
await ensureDirectoryExists(dir);
58-
await expect(
59-
stat(dir).then(stats => stats.isDirectory()),
60-
).resolves.toBeTruthy();
58+
await expect(stat(dir).then(stats => stats.isDirectory())).resolves.toBe(
59+
true,
60+
);
6161
});
6262
});

0 commit comments

Comments
 (0)