Skip to content

Commit

Permalink
fix: supporting project.assets.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
eavichay authored and Anton Drukh committed Nov 30, 2017
1 parent 4436561 commit 27aa087
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/detect.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var DETECTABLE_PACKAGE_MANAGERS = {
'Gopkg.lock': 'golang',
'vendor.json': 'golang',
'project.json': 'nuget',
'project.assets.json': 'nuget',
'packages.config': 'nuget',
'.csproj': 'nuget',
'composer.json': 'composer',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"snyk-gradle-plugin": "1.2.0",
"snyk-module": "1.8.1",
"snyk-mvn-plugin": "1.1.0",
"snyk-nuget-plugin": "1.3.2",
"snyk-nuget-plugin": "1.3.3",
"snyk-php-plugin": "1.1.2",
"snyk-policy": "1.7.1",
"snyk-python-plugin": "1.4.0",
Expand Down
31 changes: 31 additions & 0 deletions test/acceptance/cli.acceptance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,37 @@ test('`test nuget-app --file=custom-manifest.json`', function (t) {
});
});

test('`test nuget-app --file=project.assets.json`', function (t) {
chdirWorkspaces();
var plugin = {
inspect: function () {
return Promise.resolve({package: {}});
},
};
sinon.spy(plugin, 'inspect');

sinon.stub(plugins, 'loadPlugin');
t.teardown(plugins.loadPlugin.restore);
plugins.loadPlugin
.withArgs('nuget')
.returns(plugin);

return cli.test('nuget-app', {
file: 'project.assets.json',
})
.then(function () {
var req = server.popRequest();
t.equal(req.method, 'POST', 'makes POST request');
t.match(req.url, '/vuln/nuget', 'posts to correct url');
t.same(plugin.inspect.getCall(0).args,
['nuget-app', 'project.assets.json', {
args: null,
file: 'project.assets.json',
packageManager: 'nuget',
},], 'calls nuget plugin');
});
});

test('`test nuget-app --file=app.csproj`', function (t) {
chdirWorkspaces();
var plugin = {
Expand Down
21 changes: 21 additions & 0 deletions test/acceptance/workspaces/nuget-app/project.assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": 3,
"targets": {
"Microsoft.NETCore.App/2.0.0": {
"Knockout.Validation/1.0.1": {
"dependencies": {
"knockoutjs": "2.3.0",
"jQuery": "1.10.2"
}
}
}
},
"libraries": {
"knockoutjs/2.3.0": {},
"Knockout.Validation/1.0.1": {},
"jQuery/1.10.2": {}
},
"project": {
"version": "2.2.2"
}
}

0 comments on commit 27aa087

Please sign in to comment.