Skip to content

Instantly share code, notes, and snippets.

@coreyfarrell
Created August 13, 2018 19:55
Show Gist options
  • Save coreyfarrell/1a98d9a4d2cbf46854f2c9936dab0c77 to your computer and use it in GitHub Desktop.
Save coreyfarrell/1a98d9a4d2cbf46854f2c9936dab0c77 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
// Output of `nyc instrument --compact false test.js` with some minor whitespace tweaks for readability.
'use strict';
var cov_1t9w05ivrg = function () {
var path = "index.js",
hash = "1d887032f57e5b850e147fc91c3f2b4382c506bd",
Function = function () {}.constructor,
global = new Function('return this')(),
gcv = "__coverage__",
coverageData = {
path: "index.js",
statementMap: {
"0": {start: {line: 7, column: 2}, end: {line: 10, column: 3}}
},
fnMap: {
"0": {
name: "test",
decl: {start: {line: 4, column: 9}, end: {line: 4, column: 13}},
loc: {start: {line: 4, column: 23}, end: {line: 13, column: 1}},
line: 4
}
},
branchMap: {
"0": {
loc: {start: {line: 7, column: 2}, end: {line: 10, column: 3}},
type: "if",
locations: [
{start: {line: 7, column: 2}, end: {line: 10, column: 3}},
{start: {line: 7, column: 2}, end: {line: 10, column: 3}}
],
line: 7
},
"1": {
loc: {start: {line: 7, column: 6}, end: {line: 7, column: 77}},
type: "binary-expr",
locations: [
{start: {line: 7, column: 6}, end: {line: 7, column: 21}},
{start: {line: 7, column: 26}, end: {line: 7, column: 43}},
{start: {line: 7, column: 47}, end: {line: 7, column: 76}}
],
line: 7
}
},
s: {"0": 0},
f: {"0": 0},
b: {
"0": [0, 0],
"1": [0, 0, 0]
},
_coverageSchema: "d34fc3e6b8297bcde183f5492bcb8fcb36775295"
},
coverage = global[gcv] || (global[gcv] = {});
if (coverage[path] && coverage[path].hash === hash) {
return coverage[path];
}
coverageData.hash = hash;
return coverage[path] = coverageData;
}();
function test(options) {
cov_1t9w05ivrg.f[0]++;
/* istanbul ignore next */
const keys = Object.keys(options);
cov_1t9w05ivrg.s[0]++;
if ((cov_1t9w05ivrg.b[1][0]++, keys.length > 1) || (cov_1t9w05ivrg.b[1][1]++, keys.length === 1) && (cov_1t9w05ivrg.b[1][2]++, keys[0] !== 'something valid')) {
cov_1t9w05ivrg.b[0][0]++;
/* istanbul ignore next */
return false;
} else {
cov_1t9w05ivrg.b[0][1]++;
}
/* istanbul ignore next */
return true;
}
#!/usr/bin/env node
'use strict';
function test(options) {
/* istanbul ignore next */
const keys = Object.keys(options);
if (keys.length > 1 || (keys.length === 1 && keys[0] !== 'something valid')) {
/* istanbul ignore next */
return false;
}
/* istanbul ignore next */
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment