Skip to content

Commit e1d0005

Browse files
committed
test(cli): replace mock implementation with spy
1 parent 9a3c1bc commit e1d0005

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

packages/plugin-eslint/src/lib/eslint-plugin.unit.test.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
import { pluginConfigSchema } from '@code-pushup/models';
22
import { eslintPlugin } from './eslint-plugin.js';
3-
4-
vi.mock('./meta/index.js', () => ({
5-
listAuditsAndGroups: vi.fn().mockResolvedValue({
6-
audits: [
7-
{ slug: 'type-safety', title: 'Type Safety' },
8-
{ slug: 'no-empty', title: 'Disallow empty block statements' },
9-
],
10-
groups: [],
11-
}),
12-
}));
3+
import * as metaModule from './meta/index.js';
134

145
describe('eslintPlugin', () => {
6+
const listAuditsAndGroupsSpy = vi.spyOn(metaModule, 'listAuditsAndGroups');
7+
8+
beforeAll(() => {
9+
listAuditsAndGroupsSpy.mockResolvedValue({
10+
audits: [
11+
{ slug: 'type-safety', title: 'Type Safety' },
12+
{ slug: 'no-empty', title: 'Disallow empty block statements' },
13+
],
14+
groups: [],
15+
});
16+
});
17+
1518
it('should pass scoreTargets to PluginConfig when provided', async () => {
1619
const pluginConfig = await eslintPlugin(
1720
{

0 commit comments

Comments
 (0)