Skip to content

Commit

Permalink
fix(dev-server): fix error logging when build aborted
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed May 17, 2019
1 parent a987928 commit 69ef3b5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/compiler/build/build-finish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,19 @@ export async function buildFinish(config: d.Config, compilerCtx: d.CompilerCtx,
compilerCtx.hasSuccessfulBuild = true;
}

if (!aborted || (aborted && !compilerCtx.hasSuccessfulBuild)) {
// print out the time it took to build
// and add the duration to the build results
if (!buildCtx.hasPrintedResults) {
buildCtx.timeSpan.finish(`${buildText} ${buildStatus}${watchText}`, statusColor, true, true);
buildCtx.hasPrintedResults = true;

// write the build stats
await generateBuildStats(config, compilerCtx, buildCtx, buildCtx.buildResults);
}
// print out the time it took to build
// and add the duration to the build results
if (!buildCtx.hasPrintedResults) {
buildCtx.timeSpan.finish(`${buildText} ${buildStatus}${watchText}`, statusColor, true, true);
buildCtx.hasPrintedResults = true;

// emit a buildFinish event for anyone who cares
compilerCtx.events.emit('buildFinish', buildCtx.buildResults);
// write the build stats
await generateBuildStats(config, compilerCtx, buildCtx, buildCtx.buildResults);
}

// emit a buildFinish event for anyone who cares
compilerCtx.events.emit('buildFinish', buildCtx.buildResults);

// write all of our logs to disk if config'd to do so
// do this even if there are errors or not the active build
config.logger.writeLogs(buildCtx.isRebuild);
Expand Down
13 changes: 13 additions & 0 deletions test/sys/node/node-sys.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ describe('test/sys/node', () => {
});


it('parse error', () => {
const input = {
css: `
div
flex: 1;
}
`
};
return sys.optimizeCss(input).then(output => {
expect(output.diagnostics).toHaveLength(1);
});
});

it('autoprefixCss', () => {
const input = {
css: `
Expand Down

0 comments on commit 69ef3b5

Please sign in to comment.