Skip to content

Commit

Permalink
coverage: Fixed coverage bug introduced in graphql#2067
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Aug 1, 2019
1 parent d130a60 commit 31083c7
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions resources/inline-invariant.js
Expand Up @@ -46,12 +46,11 @@ module.exports = function inlineInvariant(context) {
} else {
path.replaceWith(invariantTemplate({ cond, args }));
}
path.addComment('leading', ' istanbul ignore next ');
} else if (calleeName === 'devAssert') {
const [cond, args] = node.arguments;
path.replaceWith(assertTemplate({ cond, args }));
}

path.addComment('leading', ' istanbul ignore next ');
},
},
};
Expand All @@ -60,14 +59,11 @@ module.exports = function inlineInvariant(context) {
const parentStatement = path.getStatementParent();
const previousStatement =
parentStatement.container[parentStatement.key - 1];
if (previousStatement.type === 'IfStatement') {
let lastIf = previousStatement;
while (lastIf.alternate && lastIf.alternate.type === 'IfStatement') {
lastIf = lastIf.alternate;
}
if (lastIf.alternate == null) {
t.addComment(lastIf, 'leading', ' istanbul ignore else ');
}
if (
previousStatement.type === 'IfStatement' &&
previousStatement.alternate == null
) {
t.addComment(previousStatement, 'leading', ' istanbul ignore else ');
}
}
};

0 comments on commit 31083c7

Please sign in to comment.