Skip to content

Commit

Permalink
Hack around a bit to avoid eslint-disable
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Dec 31, 2018
1 parent bddf4dc commit 794d28e
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/convertMarkdownToMocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,9 @@ function compileCodeBlocksToAst(codeBlocks, fileName) {
});

if (codeBlock.flags.freshExpect) {
/* eslint-disable */
Array.prototype.push.apply(cursor, parseFunctionBody(function f() {
Array.prototype.push.apply(cursor, parseFunctionBody(function f(expect) {
expect = unexpected.clone();
}));
/* eslint-enable */
}
var tryCatch = makeTryCatchConstruct(previousExampleNumber, topLevelStatements);

Expand All @@ -213,24 +211,20 @@ function compileCodeBlocksToAst(codeBlocks, fileName) {
if (i === codeBlocks.length - 1) {
var check;
if (typeof codeBlock.output === 'string') {
/* eslint-disable */
check = parseFunctionBody(function f() {
check = parseFunctionBody(function f(err, expect) {
if (err) {
expect(err, 'to have message', 'expectedErrorMessage');
} else {
throw new Error('expected example 1 to fail');
}
});
/* eslint-enable */
check[0].consequent.body[0].expression.arguments[2].value = codeBlock.output;
} else {
/* eslint-disable */
check = parseFunctionBody(function f() {
check = parseFunctionBody(function f(err, expect) {
if (err) {
expect.fail(err);
}
});
/* eslint-enable */
}
Array.prototype.push.apply(cursor, check);
}
Expand Down

0 comments on commit 794d28e

Please sign in to comment.