make tests a little bit faster
This commit is contained in:
parent
17d0b7d291
commit
235e82a348
2 changed files with 5 additions and 5 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Port of tidalcycles to javascript",
|
"description": "Port of tidalcycles to javascript",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "vitest run --reporter verbose -v --no-isolate",
|
"test": "vitest run --reporter verbose --isolate=false --silent --version",
|
||||||
"bootstrap": "lerna bootstrap",
|
"bootstrap": "lerna bootstrap",
|
||||||
"setup": "npm i && npm run bootstrap && cd repl && npm i && cd ../tutorial && npm i",
|
"setup": "npm i && npm run bootstrap && cd repl && npm i && cd ../tutorial && npm i",
|
||||||
"snapshot": "cd repl && npm run snapshot",
|
"snapshot": "cd repl && npm run snapshot",
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
import { queryCode, testCycles } from '../runtime.mjs';
|
import { queryCode, testCycles } from '../runtime.mjs';
|
||||||
import * as snaps from '../tunes.snapshot.mjs';
|
import * as snaps from '../tunes.snapshot.mjs';
|
||||||
import * as tunes from '../tunes.mjs';
|
import * as tunes from '../tunes.mjs';
|
||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it } from 'vitest';
|
||||||
|
|
||||||
const tuneKeys = Object.keys(tunes);
|
const tuneKeys = Object.keys(tunes);
|
||||||
|
|
||||||
async function testTune(key) {
|
async function testTune(key, expect) {
|
||||||
const haps = await queryCode(tunes[key], testCycles[key] || 1);
|
const haps = await queryCode(tunes[key], testCycles[key] || 1);
|
||||||
expect(haps).toEqual(snaps[key]);
|
expect(haps).toEqual(snaps[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
describe.concurrent('renders tunes', () => {
|
describe.concurrent('renders tunes', () => {
|
||||||
tuneKeys.slice(0, 40).forEach((key) => {
|
tuneKeys.forEach((key) => {
|
||||||
it(`tune: ${key}`, async ({ expect }) => await testTune(key));
|
it(`tune: ${key}`, async ({ expect }) => await testTune(key, expect));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue