Skip to content

Commit 9eb9851

Browse files
author
John Haley
committed
Added an ignore file for things that are false-positives for missing tests
1 parent 2cb72ce commit 9eb9851

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

generate/missing-tests-ignore.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"blob": {
3+
"functions": [
4+
"createFrombuffer",
5+
"isBinary",
6+
"lookup",
7+
"rawcontent",
8+
"rawsize"
9+
]
10+
},
11+
"clone": {
12+
"functions": [
13+
"initOptions"
14+
]
15+
},
16+
"commit": {
17+
"functions": [
18+
"parentCount",
19+
"parentId",
20+
"treeId"
21+
]
22+
},
23+
"diff": {
24+
"functions": [
25+
"getDelta",
26+
"numDeltas"
27+
]
28+
},
29+
"object": {
30+
"functions": [
31+
"type"
32+
]
33+
}
34+
}

generate/missing-tests.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const Promise = require("nodegit-promise");
44
const promisify = require("promisify-node");
55
const fse = promisify(require("fs-extra"));
66
const testFilesPath = path.resolve(__dirname, "../test/tests");
7+
const missingFileIgnores = require("./missing-tests-ignore");
78

89
var output = {};
910

@@ -15,17 +16,25 @@ function findMissingTest(idef) {
1516
.then(function(file) {
1617
var fieldsResult = [];
1718
var functionsResult = [];
19+
var fieldIgnores = (missingFileIgnores[idef.filename] || {}).fields;
20+
var functionIgnores = (missingFileIgnores[idef.filename] || {}).functions;
21+
22+
fieldIgnores = fieldIgnores || [];
23+
functionIgnores = functionIgnores || [];
24+
file = file || "";
1825

1926
idef.fields.forEach(function(field) {
20-
if (file.indexOf(field.jsFunctionName) < 0) {
27+
if (file.indexOf(field.jsFunctionName) < 0
28+
&& fieldIgnores.indexOf(field.jsFunctionName < 0)) {
2129
fieldsResult.push(field.jsFunctionName);
2230
}
2331
});
2432

2533
result.fields = fieldsResult;
2634

2735
idef.functions.forEach(function(fn) {
28-
if (file.indexOf(fn.jsFunctionName) < 0) {
36+
if (file.indexOf(fn.jsFunctionName) < 0
37+
&& functionIgnores.indexOf(fn.jsFunctionName) < 0) {
2938
functionsResult.push(fn.jsFunctionName);
3039
}
3140
});
@@ -50,4 +59,6 @@ Promise.all(promises)
5059
.then(function() {
5160
fse.writeFileSync(path.join(__dirname, "missing-tests.json"),
5261
JSON.stringify(output, null, 2));
62+
}, function(fail) {
63+
console.log(fail);
5364
});

0 commit comments

Comments
 (0)