-
-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathnode-labels.test.js
More file actions
135 lines (99 loc) · 2.84 KB
/
node-labels.test.js
File metadata and controls
135 lines (99 loc) · 2.84 KB
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
'use strict'
const tap = require('tap')
const nodeLabels = require('../lib/node-labels')
tap.test('label: "test" when only ./test/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'test/debugger/test-debugger-pid.js',
'test/debugger/test-debugger-repl-break-in-module.js',
'test/debugger/test-debugger-repl-term.js'
])
t.same(labels, ['test'])
t.end()
})
tap.test('no labels: when ./test/ and ./doc/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'test/debugger/test-debugger-pid.js',
'doc/api/fs.md'
])
t.same(labels, [])
t.end()
})
tap.test('label: "doc" when only ./doc/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'doc/api/fs.md',
'doc/api/http.md',
'doc/onboarding.md'
])
t.same(labels, ['doc'])
t.end()
})
tap.test('label: "benchmark" when only ./benchmark/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'benchmark/http_server_lag.js',
'benchmark/http/check_is_http_token.js'
])
t.same(labels, ['benchmark'])
t.end()
})
tap.test('label: "c++" when ./src/* has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'src/async-wrap.h',
'src/async-wrap.cc'
])
t.same(labels, ['c++'])
t.end()
})
tap.test('label: not "c++" when ./src/node_version.h has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'src/node_version.h'
])
t.same(labels, [])
t.end()
})
tap.test('label: "v8" when ./deps/v8/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'deps/v8/src/arguments.cc'
])
t.same(labels, ['v8'])
t.end()
})
tap.test('label: "libuv" when ./deps/ub/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'deps/uv/src/fs-poll.c'
])
t.same(labels, ['libuv'])
t.end()
})
tap.test('label: "v8", "openssl" when ./deps/v8/ and ./deps/openssl/ files has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'deps/v8/src/arguments.cc',
'deps/openssl/openssl/ssl/ssl_rsa.c'
])
t.same(labels, ['v8', 'openssl'])
t.end()
})
//
// Planned tests to be resolved later
//
tap.test('label: "repl" when ./lib/repl.js has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'lib/repl.js',
'test/debugger/test-debugger-pid.js',
'test/debugger/test-debugger-repl-break-in-module.js',
'test/debugger/test-debugger-repl-term.js'
])
t.same(labels, ['repl'], { todo: true })
t.end()
})
tap.test('label: "lib / src" when more than 5 sub-systems has been changed', (t) => {
const labels = nodeLabels.resolveLabels([
'lib/assert.js',
'lib/dns.js',
'lib/repl.js',
'lib/process.js',
'src/async-wrap.cc',
'lib/module.js'
])
t.same(labels, ['lib / src'], { todo: true })
t.end()
})