Skip to content

Commit 69ef3b5

Browse files
committed
fix(dev-server): fix error logging when build aborted
1 parent a987928 commit 69ef3b5

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

src/compiler/build/build-finish.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,19 @@ export async function buildFinish(config: d.Config, compilerCtx: d.CompilerCtx,
5656
compilerCtx.hasSuccessfulBuild = true;
5757
}
5858

59-
if (!aborted || (aborted && !compilerCtx.hasSuccessfulBuild)) {
60-
// print out the time it took to build
61-
// and add the duration to the build results
62-
if (!buildCtx.hasPrintedResults) {
63-
buildCtx.timeSpan.finish(`${buildText} ${buildStatus}${watchText}`, statusColor, true, true);
64-
buildCtx.hasPrintedResults = true;
65-
66-
// write the build stats
67-
await generateBuildStats(config, compilerCtx, buildCtx, buildCtx.buildResults);
68-
}
59+
// print out the time it took to build
60+
// and add the duration to the build results
61+
if (!buildCtx.hasPrintedResults) {
62+
buildCtx.timeSpan.finish(`${buildText} ${buildStatus}${watchText}`, statusColor, true, true);
63+
buildCtx.hasPrintedResults = true;
6964

70-
// emit a buildFinish event for anyone who cares
71-
compilerCtx.events.emit('buildFinish', buildCtx.buildResults);
65+
// write the build stats
66+
await generateBuildStats(config, compilerCtx, buildCtx, buildCtx.buildResults);
7267
}
7368

69+
// emit a buildFinish event for anyone who cares
70+
compilerCtx.events.emit('buildFinish', buildCtx.buildResults);
71+
7472
// write all of our logs to disk if config'd to do so
7573
// do this even if there are errors or not the active build
7674
config.logger.writeLogs(buildCtx.isRebuild);

test/sys/node/node-sys.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ describe('test/sys/node', () => {
1414
});
1515

1616

17+
it('parse error', () => {
18+
const input = {
19+
css: `
20+
div
21+
flex: 1;
22+
}
23+
`
24+
};
25+
return sys.optimizeCss(input).then(output => {
26+
expect(output.diagnostics).toHaveLength(1);
27+
});
28+
});
29+
1730
it('autoprefixCss', () => {
1831
const input = {
1932
css: `

0 commit comments

Comments
 (0)