From 85f4f72d9b1c0f9a3760d80023f478281d7efbaa Mon Sep 17 00:00:00 2001 From: SomaticIT Date: Tue, 16 Sep 2014 04:11:30 +0200 Subject: [PATCH] Add npm tests --- npm/npm-tests.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 npm/npm-tests.ts diff --git a/npm/npm-tests.ts b/npm/npm-tests.ts new file mode 100644 index 000000000..9a8578264 --- /dev/null +++ b/npm/npm-tests.ts @@ -0,0 +1,28 @@ +/** +* Test suite created by Maxime LUCE +* +* Created by using code samples from https://github.com/npm/npm#using-npm-programmatically. +*/ + +/// +/// + +import npm = require("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.on("log", function (message: string) { + console.log(message); + }); +})