Skip to content

Commit

Permalink
fix: don't overwrite error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Feb 6, 2019
1 parent ec94f68 commit d8d0cfa
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/best-runtime/src/utils/validate.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
export function validateState(benchmarkState) {
const { rootDescribeBlock, currentDescribeBlock } = benchmarkState;
const {
rootDescribeBlock,
currentDescribeBlock,
benchmarkDefinitionError
} = benchmarkState;

if (benchmarkDefinitionError) {
return; // Nothing to do; there is already an error
}

if (rootDescribeBlock !== currentDescribeBlock) {
benchmarkState.benchmarkDefinitionError = 'Benchmark parsing error';
benchmarkState.benchmarkDefinitionError = new Error('Benchmark parsing error');
}

if (rootDescribeBlock.children === 0) {
benchmarkState.benchmarkDefinitionError = 'No benchmarks to run';
benchmarkState.benchmarkDefinitionError = new Error('No benchmarks to run');
}
}

0 comments on commit d8d0cfa

Please sign in to comment.