forked from nodejs/citgm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-citgm-all.js
166 lines (149 loc) · 4.91 KB
/
test-citgm-all.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
'use strict';
var test = require('tap').test;
var spawn = require('../../lib/spawn');
var citgmAllPath = require.resolve('../../bin/citgm-all.js');
test('citgm-all: /w markdown /w -j', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup.json', '-m', '-j', '1']);
proc.on('error', function(err) {
t.error(err);
t.fail('we should not get an error testing omg-i-pass');
});
proc.on('close', function (code) {
t.equals(code, 0, 'citgm-all should run all the tests in the lookup');
});
});
test('citgm-all: envVar /w -J', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-envVar.json', '-J']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 0, 'citgm-all should export an environment variable');
});
});
test('citgm-all: /w missing lookup.json', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/this-does-not-exist-json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 1, 'citgm-all should fail if the lookup.json does not exist');
});
});
test('citgm-all: /w bad lookup.json', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-broken.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 1, 'citgm-all should fail if the lookup.json contains errors');
});
});
test('citgm-all: fail /w tap /w junit', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-fail.json', '-t', '-x']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 1, 'citgm-all should have failed');
});
});
test('citgm-all: flaky-fail', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-flaky.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 0, 'citgm-all should exit with signal 0');
});
});
test('citgm-all: fail expectFail', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-expectFail.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 0, 'citgm-all should exit with signal 0');
});
});
test('citgm-all: pass expectFail', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-expectFail-fail.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 1, 'citgm-all should exit with signal 1');
});
});
test('citgm-all: test with replace', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-backwards-compatibilty.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 0, 'citgm-all should exit with signal 0');
});
});
test('citgm-all: flaky-fail ignoring flakyness', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-f', '-l', 'test/fixtures/custom-lookup-flaky.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 1, 'citgm-all should exit with signal 1');
});
});
test('citgm-all: withTags', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['--withTags' , 'tag1', '-l', 'test/fixtures/custom-lookup-tag.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 0, 'citgm-all should only run omg-i-pass');
});
});
test('citgm-all: excludeTags', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['--excludeTags', 'tag2', '-l', 'test/fixtures/custom-lookup-tag.json']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 0, 'citgm-all should not run omg-i-fail');
});
});
test('citgm-all: skip /w rootcheck /w tap to fs /w junit to fs /w append', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup-skip.json', '-s', '--tap', '/dev/null', '--junit', '/dev/null', '-a']);
proc.on('error', function(err) {
t.error(err);
});
proc.on('close', function (code) {
t.equals(code, 0, 'it should run omg-i-pass and skip omg-i-fail');
});
});
test('bin: sigterm', function (t) {
t.plan(1);
var proc = spawn(citgmAllPath, ['-l', 'test/fixtures/custom-lookup.json', '-m']);
proc.on('error', function(err) {
t.error(err);
t.fail('we should not get an error testing omg-i-pass');
});
proc.stdout.once('data', function () {
proc.kill('SIGINT');
});
proc.on('exit', function (code) {
t.equal(code, 1, 'citgm-all should fail');
});
});