Skip to content

Commit 0d983b8

Browse files
committed
fix(cli): keep coverage enabled for coverage test mode
closes #1360
1 parent 79d7044 commit 0d983b8

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

‎src/index-cli.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,13 @@ Note: Certain tabs will only be shown if applicable to a given dependency`,
741741
Configuration.mainData.disableCoverage = true;
742742
}
743743

744+
if (
745+
Configuration.mainData.coverageTest ||
746+
Configuration.mainData.coverageTestPerFile
747+
) {
748+
Configuration.mainData.disableCoverage = false;
749+
}
750+
744751
if (configFile.customFavicon) {
745752
Configuration.mainData.customFavicon = configFile.customFavicon;
746753
}

‎test/src/cli/cli-coverage.spec.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,36 @@ describe('CLI coverage report', () => {
8989
});
9090
});
9191

92+
describe('coverage test command with minimal mode', () => {
93+
let stdoutString = undefined;
94+
before(function (done) {
95+
tmp.create(distFolder);
96+
let ls = shell('node', [
97+
'./bin/index-cli.js',
98+
'-p',
99+
'./test/fixtures/sample-files/tsconfig.simple.json',
100+
'--coverageTest',
101+
'10',
102+
'--minimal',
103+
'-d',
104+
distFolder
105+
]);
106+
107+
if (ls.stderr.toString() !== '') {
108+
console.error(`shell error: ${ls.stderr.toString()}`);
109+
done('error');
110+
}
111+
stdoutString = ls.stdout.toString();
112+
done();
113+
});
114+
after(() => tmp.clean(distFolder));
115+
116+
it('it should run coverage test without rendering pages', () => {
117+
expect(stdoutString).to.contain('is over threshold');
118+
expect(stdoutString).to.not.contain('compiledPage is not a function');
119+
});
120+
});
121+
92122
describe('coverage test command under', () => {
93123
let stdoutString = undefined;
94124
before(function (done) {

0 commit comments

Comments
 (0)