Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"precheck:links": "npm run build",
"seq": "bash -c 'for cmd in \"$@\"; do npm run $cmd || exit 1; done' - ",
"serve": "npm run docus:serve",
"test:coverage": "c8 --reporter=text --reporter=lcov --reporter=json-summary --exclude 'docusaurus.config.ts' --exclude 'lib/testHelpers/**' --check-coverage --lines 100 --statements 100 --branches 100 --functions 100 npm run test:unit",
"test:coverage": "c8 --reporter=text --reporter=lcov --reporter=json-summary --exclude 'lib/testHelpers/**' --check-coverage --lines 100 --statements 100 --branches 100 --functions 100 npm run test:unit",
"report:coverage-summary": "node scripts/coverage-summary.mjs",
"test:e2e": "node --test 'e2e/**/*.test.mjs'",
"test:unit": "node --experimental-strip-types --experimental-test-module-mocks --test 'lib/**/*.test.mts' 'scripts/**/*.test.mjs'",
Expand Down
18 changes: 18 additions & 0 deletions scripts/coverage-thresholds.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,21 @@ test('test:coverage enforces 100% coverage thresholds', async () => {
);
}
});

// docusaurus.config.ts is fully exercised by
// lib/docusaurusConfigPreprocessor.test.mts and
// lib/docusaurusConfigBuildContext.test.mts (both import the real file via
// testHelpers/resolveExtensionlessTs.mjs), so excluding it from the c8 gate
// is a stale blind spot: new untested code added to that file would pass
// `npm run test:coverage` silently instead of failing it.
test('test:coverage does not exclude docusaurus.config.ts from the gate', async () => {
const packageJsonPath = path.resolve('package.json');
const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
const script = packageJson.scripts['test:coverage'];

assert.ok(script, 'test:coverage script must exist in package.json');
assert.ok(
!script.includes('docusaurus.config.ts'),
'test:coverage should not --exclude docusaurus.config.ts; it is unit-tested and should be gated',
);
});
Loading