Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/vendor/*.sln

/generate/idefs.json
/generate/missing-tests.json
/binding.gyp

*.log
34 changes: 34 additions & 0 deletions 34 generate/missing-tests-ignore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"blob": {
"functions": [
"createFrombuffer",
"isBinary",
"lookup",
"rawcontent",
"rawsize"
]
},
"clone": {
"functions": [
"initOptions"
]
},
"commit": {
"functions": [
"parentCount",
"parentId",
"treeId"
]
},
"diff": {
"functions": [
"getDelta",
"numDeltas"
]
},
"object": {
"functions": [
"type"
]
}
}
64 changes: 64 additions & 0 deletions 64 generate/missing-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const path = require("path");
const idefs = require("./idefs");
const Promise = require("nodegit-promise");
const promisify = require("promisify-node");
const fse = promisify(require("fs-extra"));
const testFilesPath = path.resolve(__dirname, "../test/tests");
const missingFileIgnores = require("./missing-tests-ignore");

var output = {};

function findMissingTest(idef) {
var testFilePath = path.join(testFilesPath, idef.filename + ".js");
var result = {};

return fse.readFile(testFilePath, "utf8")
.then(function(file) {
var fieldsResult = [];
var functionsResult = [];
var fieldIgnores = (missingFileIgnores[idef.filename] || {}).fields;
var functionIgnores = (missingFileIgnores[idef.filename] || {}).functions;

fieldIgnores = fieldIgnores || [];
functionIgnores = functionIgnores || [];
file = file || "";

idef.fields.forEach(function(field) {
if (file.indexOf(field.jsFunctionName) < 0
&& fieldIgnores.indexOf(field.jsFunctionName < 0)) {
fieldsResult.push(field.jsFunctionName);
}
});

result.fields = fieldsResult;

idef.functions.forEach(function(fn) {
if (file.indexOf(fn.jsFunctionName) < 0
&& functionIgnores.indexOf(fn.jsFunctionName) < 0) {
functionsResult.push(fn.jsFunctionName);
}
});

result.functions = functionsResult;
},
function() {
result.testFileMissing = false;
result.testFilePath = testFilePath;
}).then(function() {
output[idef.filename] = result;
});
};

var promises = [];

idefs.forEach(function(idef) {
promises.push(findMissingTest(idef));
});

Promise.all(promises)
.then(function() {
fse.writeFileSync(path.join(__dirname, "missing-tests.json"),
JSON.stringify(output, null, 2));
}, function(fail) {
console.log(fail);
});
1 change: 0 additions & 1 deletion 1 generate/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ libgit2.types.forEach(function(type) {
// libgit2's docs aren't complete so we'll add in what they're missing here
Array.prototype.push.apply(libgit2.types, supplement.new.types);


var output = [];
var groupNames = [];
var dependencyLookup = {};
Expand Down
2 changes: 2 additions & 0 deletions 2 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"nan": "~1.3.0",
"node-gyp": "~1.0.2",
"node-pre-gyp": "~0.5.27",
"nodegit-promise": "~1.0.0",
"promise": "~6.0.0",
"promisify-node": "~0.1.2",
"q": "~1.0.1",
Expand All @@ -91,6 +92,7 @@
"cov": "istanbul cover node_modules/mocha/bin/_mocha -- test/runner test/tests --report=lcov",
"mocha": "mocha test/runner test/tests",
"test": "npm run lint && npm run cov",
"missing-tests": "node generate/missing-tests",
"publish": "node-pre-gyp package && node-pre-gyp publish",
"generate": "node generate/setup && node generate",
"install": "npm run generate && node install",
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.