Skip to content

Commit 3082015

Browse files
committed
test: adjust tests
1 parent a5dafd2 commit 3082015

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

examples/plugins/src/file-size/src/file-size.plugin.int.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ describe('create', () => {
6666
await expect(
6767
executePlugin(pluginConfig, {
6868
persist: { outputDir: '.code-pushup' },
69+
cache: { read: false, write: false },
6970
}),
7071
).resolves.toMatchObject({
7172
description:
@@ -85,6 +86,7 @@ describe('create', () => {
8586
});
8687
const { audits: auditOutputs } = await executePlugin(pluginConfig, {
8788
persist: { outputDir: '.code-pushup' },
89+
cache: { read: false, write: false },
8890
});
8991

9092
expect(auditOutputs).toHaveLength(1);
@@ -99,6 +101,7 @@ describe('create', () => {
99101
});
100102
const { audits: auditOutputs } = await executePlugin(pluginConfig, {
101103
persist: { outputDir: '.code-pushup' },
104+
cache: { read: false, write: false },
102105
});
103106

104107
expect(auditOutputs).toHaveLength(1);

examples/plugins/src/package-json/src/package-json.plugin.int.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('create-package-json', () => {
4949
const pluginConfig = create(baseOptions);
5050
const pluginOutput = await executePlugin(pluginConfig, {
5151
persist: { outputDir: '.code-pushup' },
52+
cache: { read: false, write: false },
5253
});
5354

5455
expect(() => pluginReportSchema.parse(pluginOutput)).not.toThrow();
@@ -72,6 +73,7 @@ describe('create-package-json', () => {
7273
});
7374
const { audits: auditOutputs } = await executePlugin(pluginConfig, {
7475
persist: { outputDir: '.code-pushup' },
76+
cache: { read: false, write: false },
7577
});
7678

7779
expect(auditOutputs[0]?.value).toBe(1);
@@ -91,6 +93,7 @@ describe('create-package-json', () => {
9193
});
9294
const { audits: auditOutputs } = await executePlugin(pluginConfig, {
9395
persist: { outputDir: '.code-pushup' },
96+
cache: { read: false, write: false },
9497
});
9598

9699
expect(auditOutputs[1]?.slug).toBe('package-type');
@@ -112,6 +115,7 @@ describe('create-package-json', () => {
112115
});
113116
const { audits: auditOutputs } = await executePlugin(pluginConfig, {
114117
persist: { outputDir: '.code-pushup' },
118+
cache: { read: false, write: false },
115119
});
116120

117121
expect(auditOutputs).toHaveLength(audits.length);
@@ -135,6 +139,7 @@ describe('create-package-json', () => {
135139
});
136140
const { audits: auditOutputs } = await executePlugin(pluginConfig, {
137141
persist: { outputDir: '.code-pushup' },
142+
cache: { read: false, write: false },
138143
});
139144

140145
expect(auditOutputs).toHaveLength(audits.length);
@@ -158,6 +163,7 @@ describe('create-package-json', () => {
158163
});
159164
const { audits: auditOutputs } = await executePlugin(pluginConfig, {
160165
persist: { outputDir: '.code-pushup' },
166+
cache: { read: false, write: false },
161167
});
162168

163169
expect(auditOutputs).toHaveLength(audits.length);

packages/core/src/lib/implementation/runner.int.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { writeFile } from 'node:fs/promises';
22
import path from 'node:path';
33
import { cleanTestFolder } from '@code-pushup/test-utils';
44
import { ensureDirectoryExists } from '@code-pushup/utils';
5-
import { readRunnerResults, writeRunnerResults } from './runner.js';
5+
import {
6+
getAuditOutputsPath,
7+
readRunnerResults,
8+
writeRunnerResults,
9+
} from './runner.js';
610

711
describe('readRunnerResults', () => {
812
const outputDir = path.join(
@@ -19,7 +23,7 @@ describe('readRunnerResults', () => {
1923
beforeEach(async () => {
2024
await ensureDirectoryExists(cacheDir);
2125
await writeFile(
22-
path.join(cacheDir, 'audit-outputs.json'),
26+
getAuditOutputsPath(pluginSlug, outputDir),
2327
JSON.stringify([
2428
{
2529
slug: 'node-version',
@@ -73,7 +77,7 @@ describe('writeRunnerResults', () => {
7377
beforeEach(async () => {
7478
await ensureDirectoryExists(cacheDir);
7579
await writeFile(
76-
path.join(cacheDir, 'audit-outputs.json'),
80+
getAuditOutputsPath(pluginSlug, outputDir),
7781
JSON.stringify([
7882
{
7983
slug: 'node-version',

packages/core/src/lib/implementation/runner.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('getAuditOutputsPath', () => {
2020
it('should read runner results from a file', async () => {
2121
expect(
2222
osAgnosticPath(getAuditOutputsPath('plugin-with-cache', 'output')),
23-
).toBe(osAgnosticPath('output/plugin-with-cache/audit-outputs.json'));
23+
).toBe(osAgnosticPath('output/plugin-with-cache/runner-output.json'));
2424
});
2525
});
2626

0 commit comments

Comments
 (0)