DefinitelyTyped/types/npm/npm-tests.ts
Dmitrii Sorin 4a5cd9c56a Support silent function calls (#38531)
* Support silent function calls

NPM API commands support a second parameter which is boolean:

https://github.com/npm/cli/blob/latest/lib/view.js#L76
https://github.com/npm/cli/blob/latest/lib/ls.js#L33

* Update overload types for info command

* Revert "Support silent function calls"

This reverts commit 4d18bdc187ba836a6ecb37c5e530066c48066915.

* Update tests
2019-10-02 14:26:44 -07:00

31 lines
745 B
TypeScript

/**
* Test suite created by Maxime LUCE <https://github.com/SomaticIT>
*
* Created by using code samples from https://github.com/npm/npm#using-npm-programmatically.
*/
import * as npm from 'npm';
npm.load({}, function (er) {
if (er) {
return console.error(er);
}
npm.commands.install(["some", "args"], function (er, data) {
if (er) {
return console.error(er);
}
// command succeeded, and data might have some info
});
npm.commands.view(["some", "args"], true, function () {}); // silent: true
npm.commands.view(["some", "args"], function () {});
npm.on("log", function (message: string) {
console.log(message);
});
npm.config.set('audit', false);
})