Skip to content

Commit 6efefae

Browse files
committed
coverage: mark ignore statements
1 parent 883ac8d commit 6efefae

File tree

12 files changed

+30
-6
lines changed

12 files changed

+30
-6
lines changed

src/__tests__/version-test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ describe('Version', () => {
2525
expect(major).to.be.a('number');
2626
expect(minor).to.be.a('number');
2727
expect(patch).to.be.a('number');
28+
29+
/* istanbul ignore next (Can't be verified on all versions) */
2830
if (preReleaseTag !== null) {
2931
expect(preReleaseTag).to.be.a('string');
3032
}
3133

3234
expect(
3335
`${major}.${minor}.${patch}` +
36+
/* istanbul ignore next (Can't be verified on all versions) */
3437
(preReleaseTag !== null ? '-' + preReleaseTag : ''),
3538
).to.equal(version);
3639
});

src/error/GraphQLError.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ export function GraphQLError( // eslint-disable-line no-redeclare
198198
writable: true,
199199
configurable: true,
200200
});
201-
} else if (Error.captureStackTrace) {
201+
return;
202+
}
203+
204+
/* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
205+
if (Error.captureStackTrace) {
202206
Error.captureStackTrace(this, GraphQLError);
203207
} else {
204208
Object.defineProperty(this, 'stack', {

src/jsutils/__tests__/inspect-test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ describe('inspect', () => {
3636
});
3737

3838
it('function', () => {
39-
expect(inspect(() => invariant(false))).to.equal('[function]');
39+
const unnamedFuncStr = inspect(
40+
/* istanbul ignore next */ () => invariant(false),
41+
);
42+
expect(unnamedFuncStr).to.equal('[function]');
4043

41-
function testFunc() {
44+
/* istanbul ignore next */
45+
function namedFunc() {
4246
invariant(false);
4347
}
44-
expect(inspect(testFunc)).to.equal('[function testFunc]');
48+
expect(inspect(namedFunc)).to.equal('[function namedFunc]');
4549
});
4650

4751
it('array', () => {
@@ -103,6 +107,7 @@ describe('inspect', () => {
103107

104108
it('custom symbol inspect is take precedence', () => {
105109
const object = {
110+
/* istanbul ignore next */
106111
inspect() {
107112
invariant(false);
108113
},

src/jsutils/dedent.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export default function dedent(
2121
for (let i = 0; i < strings.length; ++i) {
2222
str += strings[i];
2323
if (i < values.length) {
24-
str += values[i]; // interpolation
24+
/* istanbul ignore next (ignore else inside Babel generated code) */
25+
const value = values[i];
26+
27+
str += value; // interpolation
2528
}
2629
}
2730

src/jsutils/defineToJSON.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export default function defineToJSON(
1212
): void {
1313
classObject.prototype.toJSON = fn;
1414
classObject.prototype.inspect = fn;
15+
16+
/* istanbul ignore else (See: https://github.com/graphql/graphql-js/issues/2317) */
1517
if (nodejsCustomInspectSymbol) {
1618
classObject.prototype[nodejsCustomInspectSymbol] = fn;
1719
}

src/jsutils/defineToStringTag.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* for example.
1515
*/
1616
export default function defineToStringTag(classObject: Class<mixed>): void {
17+
/* istanbul ignore else (See: https://github.com/graphql/graphql-js/issues/2317) */
1718
if (typeof Symbol === 'function' && Symbol.toStringTag) {
1819
Object.defineProperty(classObject.prototype, Symbol.toStringTag, {
1920
get() {

src/jsutils/devAssert.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
export default function devAssert(condition: mixed, message: string): void {
44
const booleanCondition = Boolean(condition);
5+
/* istanbul ignore else (see transformation done in './resources/inlineInvariant.js') */
56
if (!booleanCondition) {
67
throw new Error(message);
78
}

src/jsutils/instanceOf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ declare function instanceOf(
1212
// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production
1313
// See: https://webpack.js.org/guides/production/
1414
export default process.env.NODE_ENV === 'production'
15-
? // eslint-disable-next-line no-shadow
15+
? /* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
16+
// eslint-disable-next-line no-shadow
1617
function instanceOf(value: mixed, constructor: mixed) {
1718
return value instanceof constructor;
1819
}

src/jsutils/invariant.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
export default function invariant(condition: mixed, message?: string): void {
44
const booleanCondition = Boolean(condition);
5+
/* istanbul ignore else (see transformation done in './resources/inlineInvariant.js') */
56
if (!booleanCondition) {
67
throw new Error(
78
message != null ? message : 'Unexpected invariant triggered.',

src/jsutils/nodejsCustomInspectSymbol.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @flow strict
22

3+
/* istanbul ignore next (See: https://github.com/graphql/graphql-js/issues/2317) */
34
const nodejsCustomInspectSymbol =
45
typeof Symbol === 'function' && typeof Symbol.for === 'function'
56
? Symbol.for('nodejs.util.inspect.custom')

0 commit comments

Comments
 (0)