mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-16 06:50:37 +03:00
full coverage
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env node
|
||||
const fs = require('fs');
|
||||
const { execSync } = require('child_process');
|
||||
const { join } = require('path');
|
||||
const { coverageDirectory, tmpCoverageDirectory } = require('@local/config/playwright.coverage');
|
||||
|
||||
const mergeCoverage = async () => {
|
||||
if (fs.existsSync(tmpCoverageDirectory)) {
|
||||
const mergeDestination = join(tmpCoverageDirectory, `merged_${Date.now()}.json`);
|
||||
execSync(`nyc merge ${tmpCoverageDirectory} ${mergeDestination}`);
|
||||
const files = fs.readdirSync(tmpCoverageDirectory);
|
||||
files.forEach((file) => {
|
||||
const filePath = join(tmpCoverageDirectory, file);
|
||||
if (filePath !== mergeDestination) {
|
||||
fs.rmSync(filePath);
|
||||
}
|
||||
});
|
||||
|
||||
execSync(
|
||||
`nyc report --reporter=lcov --reporter=text --reporter=clover --reporter=json --report-dir=${coverageDirectory} --temp-dir=${tmpCoverageDirectory}`,
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
fs.rmSync(tmpCoverageDirectory, { recursive: true });
|
||||
}
|
||||
};
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await mergeCoverage();
|
||||
} catch (e) {
|
||||
console.error(`Playwright coverage couldn't be merged.`, e);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user