test all in source examples

This commit is contained in:
Felix Roos
2022-11-03 14:47:27 +01:00
parent 1a6743dba9
commit e9544f8f92
6 changed files with 3224 additions and 3 deletions
+15
View File
@@ -0,0 +1,15 @@
import { queryCode } from '../../repl/src/runtime.mjs';
import { describe, it } from 'vitest';
import doc from '../../doc.json';
describe('runs examples', () => {
const { docs } = doc;
docs.forEach(async (doc) => {
doc.examples?.forEach((example, i) => {
it(`example "${doc.name}" example index ${i}`, async ({ expect }) => {
const haps = await queryCode(example, 4);
expect(haps).toMatchSnapshot();
});
});
});
});