diff --git a/.gitignore b/.gitignore index 9a140ae5..c4b09a81 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ node_modules /dist /src/definitions/types/ /vendor +/cov +/cov.lcov +/cov_html diff --git a/deno.jsonc b/deno.jsonc index bde01477..a5dbb985 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -255,6 +255,18 @@ "description": "Run integration tests", "command": "deno test tests -A --ignore=README.md", }, + "test:integration:coverage": { + "description": "Run integration tests with code coverage", + "command": "DENO_COVERAGE_DIR=./cov deno test tests -A --coverage=./cov --ignore=README.md", + }, + "coverage": { + "description": "Generate coverage report from collected data", + "command": "deno coverage ./cov --lcov --output=./cov.lcov", + }, + "coverage:html": { + "description": "Generate HTML coverage report", + "command": "deno coverage ./cov --html", + }, }, "compilerOptions": { "checkJs": true, diff --git a/tests/common/index.ts b/tests/common/index.ts index 36862def..8b58e5ec 100644 --- a/tests/common/index.ts +++ b/tests/common/index.ts @@ -4,7 +4,7 @@ export async function testWeb(evalFn: EvaluateFunction): Promise { const url = "http://localhost:3000/testing/index.html"; await using browser = await launch(); - await using page = await browser.newPage(url); + await using page = await browser.newPage(url, { coverage: true }); return await page.evaluate(evalFn); }