Improve logging of provider unit tests

This commit is contained in:
mrjvs
2024-01-17 18:54:42 +01:00
parent 616c8a1e1b
commit 03a628ea34
2 changed files with 102 additions and 97 deletions

View File

@@ -38,7 +38,7 @@
"cli": "ts-node ./src/dev-cli/index.ts",
"test": "vitest run",
"test:watch": "vitest",
"test:providers": "cross-env MW_TEST_PROVIDERS=true vitest run",
"test:providers": "cross-env MW_TEST_PROVIDERS=true vitest run --reporter verbose",
"test:integration": "node ./tests/cjs && node ./tests/esm && node ./tests/browser",
"test:coverage": "vitest run --coverage",
"lint": "eslint --ext .ts,.js src/",

View File

@@ -53,6 +53,7 @@ export function testSource(ops: TestSourceOptions) {
if (ops.testSuite.length === 0) throw new Error("Test suite must have at least one test");
describe(`source:${ops.source.id}`, () => {
ops.testSuite.forEach((test, i) => {
describe(`test ${i}`, () => {
async function runTest(providers: ProviderControls) {
let hasNotFound = false;
let hasError = false;
@@ -109,6 +110,8 @@ export function testSource(ops: TestSourceOptions) {
await runTest(providers);
})
}
})
})
})
}
@@ -117,6 +120,7 @@ export function testEmbed(ops: TestEmbedOptions) {
if (ops.testUrls.length === 0) throw new Error("Test urls must have at least one url");
describe(`embed:${ops.embed.id}`, () => {
ops.testUrls.forEach((test, i) => {
describe(`test ${i}`, () => {
async function runTest(providers: ProviderControls) {
let hasError = false;
let streamCount = 0;
@@ -165,6 +169,7 @@ export function testEmbed(ops: TestEmbedOptions) {
await runTest(providers);
})
}
});
})
})
}