Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Mar 29, 2024
1 parent f32bbb6 commit d2dadd9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Behat/JsCoverageContextTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function saveJsCoverage(): void
throw new Error('"window.__coverage__" is not defined');
}
const transformCoverageFx = function (istanbulCoverage) {
const transformCoverageFx = function (istanbulCoverage, seenPaths) {
const res = {};
Object.entries(istanbulCoverage).forEach(([path, data]) => {
const resSingle = {};
Expand All @@ -74,7 +74,7 @@ protected function saveJsCoverage(): void
if (window.__coverage_beforeunload__ !== true) {
window.addEventListener('beforeunload', () => {
const navigateCoverages = JSON.parse(window.sessionStorage.getItem('__coverage_navigate__') ?? '[]');
navigateCoverages.push(transformCoverageFx(window.__coverage__));
navigateCoverages.push(transformCoverageFx(window.__coverage__, new Set()));
window.sessionStorage.setItem('__coverage_navigate__', JSON.stringify(navigateCoverages));
});
window.__coverage_beforeunload__ = true;
Expand All @@ -84,7 +84,7 @@ protected function saveJsCoverage(): void
const res = [];
for (const coverage of [windowCoverage, ...navigateCoverages]) {
res.push(transformCoverageFx(coverage));
res.push(transformCoverageFx(coverage, seenPaths));
}
return res;
Expand Down

0 comments on commit d2dadd9

Please sign in to comment.