Skip to content

Commit dd81d8a

Browse files
committed
test(core,ci): fix zod error patterns in assertions
1 parent 9c10784 commit dd81d8a

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

packages/ci/src/lib/cli/persist.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('parsePersistConfig', () => {
114114
await expect(
115115
parsePersistConfig({ persist: { format: ['json', 'html'] } }),
116116
).rejects.toThrow(
117-
/^Invalid persist config - ZodError:.*Invalid enum value. Expected 'json' \| 'md', received 'html'/s,
117+
/^Invalid persist config - ZodError:.*Invalid option: expected one of \\"json\\"\|\\"md\\"/s,
118118
);
119119
});
120120
});

packages/core/src/lib/implementation/execute-plugin.unit.test.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,11 @@ describe('executePlugins', () => {
134134
] satisfies PluginConfig[],
135135
{ progress: false },
136136
),
137-
).rejects.toThrow(`Executing 1 plugin failed.\n\nError: - Plugin ${bold(
138-
title,
139-
)} (${bold(slug)}) produced the following error:
140-
- Audit output is invalid: [
141-
{
142-
"validation": "regex",
143-
"code": "invalid_string",
144-
"message": "The slug has to follow the pattern [0-9a-z] followed by multiple optional groups of -[0-9a-z]. e.g. my-slug",
145-
"path": [
146-
0,
147-
"slug"
148-
]
149-
}
150-
]
151-
`);
137+
).rejects.toThrow(
138+
`Executing 1 plugin failed.\n\nError: - Plugin ${bold(
139+
title,
140+
)} (${bold(slug)}) produced the following error:\n - Audit output is invalid`,
141+
);
152142
});
153143

154144
it('should throw for one failing plugin', async () => {

packages/core/src/lib/implementation/read-rc-file.int.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ describe('readRcByPath', () => {
6969
it('should throw if the configuration is empty', async () => {
7070
await expect(
7171
readRcByPath(path.join(configDirPath, 'code-pushup.empty.config.js')),
72-
).rejects.toThrow(/invalid_type/);
72+
).rejects.toThrow('Invalid input');
7373
});
7474

7575
it('should throw if the configuration is invalid', async () => {
7676
await expect(
7777
readRcByPath(path.join(configDirPath, 'code-pushup.invalid.config.ts')),
78-
).rejects.toThrow(/refs are duplicates/);
78+
).rejects.toThrow('has duplicate references');
7979
});
8080
});

0 commit comments

Comments
 (0)