forked from lastboy/package-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
executable file
·103 lines (90 loc) · 2.01 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
console.log("Package Script Test....");
function test1() {
require('./pkgscript.js').spawn([
{
command: "npm",
args: ["rm", "-g", "grunt-cli"]
},
{
command: "npm",
args: ["rm", "-g", "bower"]
}
], {log: false});
}
function test2() {
require('./pkgscript.js').spawn([
{
command: "npm",
args: ["install", "-g", "grunt-cli"]
},
{
command: "npm",
args: ["install", "-g", "bower"]
}
], {log: false});
}
function test3() {
var pkgscript = require('./pkgscript.js');
//pkgscript.init({log: false});
pkgscript.spawn([
{
admin:false,
command: "npm",
args: ["--version"]
},
{
admin:false,
command: "npm",
args: ["--version"]
}
]);
}
function test41() {
var pkgscript = require('./pkgscript.js');
pkgscript.uninstall([
{
admin:true,
name: "bower"
},{
name: "grunt-cli"
}
], {init: {global:true, log:true}});
}
function test412() {
var pkgscript = require('./pkgscript.js');
pkgscript.install([
{
admin:true,
name: "bower"
},{
name: "grunt-cli"
}
], {init: {global:true, log:true}, callback: function() {
console.log(" Test completed... ");
}});
}
function test42() {
var pkgscript = require('./pkgscript.js');
pkgscript.install([
{
admin:false,
name: "test"
}
], {callback: function() {
var pkgscript = require('./pkgscript.js');
pkgscript.uninstall([
{
admin:false,
name: "test"
}
], {debug: 1, depth: "10", callback: function() {
console.log(" Test completed... ");
}});
}});
}
//test1();
//test2();
//test41();
//test412();
test42();
//test3();