make tests a little bit faster

This commit is contained in:
Felix Roos 2022-08-09 23:28:36 +02:00
parent 17d0b7d291
commit 235e82a348
2 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@
"private": true,
"description": "Port of tidalcycles to javascript",
"scripts": {
"test": "vitest run --reporter verbose -v --no-isolate",
"test": "vitest run --reporter verbose --isolate=false --silent --version",
"bootstrap": "lerna bootstrap",
"setup": "npm i && npm run bootstrap && cd repl && npm i && cd ../tutorial && npm i",
"snapshot": "cd repl && npm run snapshot",

View File

@ -1,17 +1,17 @@
import { queryCode, testCycles } from '../runtime.mjs';
import * as snaps from '../tunes.snapshot.mjs';
import * as tunes from '../tunes.mjs';
import { describe, it, expect } from 'vitest';
import { describe, it } from 'vitest';
const tuneKeys = Object.keys(tunes);
async function testTune(key) {
async function testTune(key, expect) {
const haps = await queryCode(tunes[key], testCycles[key] || 1);
expect(haps).toEqual(snaps[key]);
}
describe.concurrent('renders tunes', () => {
tuneKeys.slice(0, 40).forEach((key) => {
it(`tune: ${key}`, async ({ expect }) => await testTune(key));
tuneKeys.forEach((key) => {
it(`tune: ${key}`, async ({ expect }) => await testTune(key, expect));
});
});