source: trip-planner-front/node_modules/node-gyp/test/test-process-release.js@ 6fe77af

Last change on this file since 6fe77af was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 17.4 KB
Line 
1'use strict'
2
3const test = require('tap').test
4const processRelease = require('../lib/process-release')
5
6test('test process release - process.version = 0.8.20', function (t) {
7 t.plan(2)
8
9 var release = processRelease([], { opts: {} }, 'v0.8.20', null)
10
11 t.equal(release.semver.version, '0.8.20')
12 delete release.semver
13
14 t.deepEqual(release, {
15 version: '0.8.20',
16 name: 'node',
17 baseUrl: 'https://nodejs.org/dist/v0.8.20/',
18 tarballUrl: 'https://nodejs.org/dist/v0.8.20/node-v0.8.20.tar.gz',
19 shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS256.txt',
20 versionDir: '0.8.20',
21 ia32: { libUrl: 'https://nodejs.org/dist/v0.8.20/node.lib', libPath: 'node.lib' },
22 x64: { libUrl: 'https://nodejs.org/dist/v0.8.20/x64/node.lib', libPath: 'x64/node.lib' },
23 arm64: { libUrl: 'https://nodejs.org/dist/v0.8.20/arm64/node.lib', libPath: 'arm64/node.lib' }
24 })
25})
26
27test('test process release - process.version = 0.10.21', function (t) {
28 t.plan(2)
29
30 var release = processRelease([], { opts: {} }, 'v0.10.21', null)
31
32 t.equal(release.semver.version, '0.10.21')
33 delete release.semver
34
35 t.deepEqual(release, {
36 version: '0.10.21',
37 name: 'node',
38 baseUrl: 'https://nodejs.org/dist/v0.10.21/',
39 tarballUrl: 'https://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz',
40 shasumsUrl: 'https://nodejs.org/dist/v0.10.21/SHASUMS256.txt',
41 versionDir: '0.10.21',
42 ia32: { libUrl: 'https://nodejs.org/dist/v0.10.21/node.lib', libPath: 'node.lib' },
43 x64: { libUrl: 'https://nodejs.org/dist/v0.10.21/x64/node.lib', libPath: 'x64/node.lib' },
44 arm64: { libUrl: 'https://nodejs.org/dist/v0.10.21/arm64/node.lib', libPath: 'arm64/node.lib' }
45 })
46})
47
48// prior to -headers.tar.gz
49test('test process release - process.version = 0.12.9', function (t) {
50 t.plan(2)
51
52 var release = processRelease([], { opts: {} }, 'v0.12.9', null)
53
54 t.equal(release.semver.version, '0.12.9')
55 delete release.semver
56
57 t.deepEqual(release, {
58 version: '0.12.9',
59 name: 'node',
60 baseUrl: 'https://nodejs.org/dist/v0.12.9/',
61 tarballUrl: 'https://nodejs.org/dist/v0.12.9/node-v0.12.9.tar.gz',
62 shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt',
63 versionDir: '0.12.9',
64 ia32: { libUrl: 'https://nodejs.org/dist/v0.12.9/node.lib', libPath: 'node.lib' },
65 x64: { libUrl: 'https://nodejs.org/dist/v0.12.9/x64/node.lib', libPath: 'x64/node.lib' },
66 arm64: { libUrl: 'https://nodejs.org/dist/v0.12.9/arm64/node.lib', libPath: 'arm64/node.lib' }
67 })
68})
69
70// prior to -headers.tar.gz
71test('test process release - process.version = 0.10.41', function (t) {
72 t.plan(2)
73
74 var release = processRelease([], { opts: {} }, 'v0.10.41', null)
75
76 t.equal(release.semver.version, '0.10.41')
77 delete release.semver
78
79 t.deepEqual(release, {
80 version: '0.10.41',
81 name: 'node',
82 baseUrl: 'https://nodejs.org/dist/v0.10.41/',
83 tarballUrl: 'https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz',
84 shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt',
85 versionDir: '0.10.41',
86 ia32: { libUrl: 'https://nodejs.org/dist/v0.10.41/node.lib', libPath: 'node.lib' },
87 x64: { libUrl: 'https://nodejs.org/dist/v0.10.41/x64/node.lib', libPath: 'x64/node.lib' },
88 arm64: { libUrl: 'https://nodejs.org/dist/v0.10.41/arm64/node.lib', libPath: 'arm64/node.lib' }
89 })
90})
91
92// has -headers.tar.gz
93test('test process release - process.release ~ node@0.10.42', function (t) {
94 t.plan(2)
95
96 var release = processRelease([], { opts: {} }, 'v0.10.42', null)
97
98 t.equal(release.semver.version, '0.10.42')
99 delete release.semver
100
101 t.deepEqual(release, {
102 version: '0.10.42',
103 name: 'node',
104 baseUrl: 'https://nodejs.org/dist/v0.10.42/',
105 tarballUrl: 'https://nodejs.org/dist/v0.10.42/node-v0.10.42-headers.tar.gz',
106 shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt',
107 versionDir: '0.10.42',
108 ia32: { libUrl: 'https://nodejs.org/dist/v0.10.42/node.lib', libPath: 'node.lib' },
109 x64: { libUrl: 'https://nodejs.org/dist/v0.10.42/x64/node.lib', libPath: 'x64/node.lib' },
110 arm64: { libUrl: 'https://nodejs.org/dist/v0.10.42/arm64/node.lib', libPath: 'arm64/node.lib' }
111 })
112})
113
114// has -headers.tar.gz
115test('test process release - process.release ~ node@0.12.10', function (t) {
116 t.plan(2)
117
118 var release = processRelease([], { opts: {} }, 'v0.12.10', null)
119
120 t.equal(release.semver.version, '0.12.10')
121 delete release.semver
122
123 t.deepEqual(release, {
124 version: '0.12.10',
125 name: 'node',
126 baseUrl: 'https://nodejs.org/dist/v0.12.10/',
127 tarballUrl: 'https://nodejs.org/dist/v0.12.10/node-v0.12.10-headers.tar.gz',
128 shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt',
129 versionDir: '0.12.10',
130 ia32: { libUrl: 'https://nodejs.org/dist/v0.12.10/node.lib', libPath: 'node.lib' },
131 x64: { libUrl: 'https://nodejs.org/dist/v0.12.10/x64/node.lib', libPath: 'x64/node.lib' },
132 arm64: { libUrl: 'https://nodejs.org/dist/v0.12.10/arm64/node.lib', libPath: 'arm64/node.lib' }
133 })
134})
135
136test('test process release - process.release ~ node@4.1.23', function (t) {
137 t.plan(2)
138
139 var release = processRelease([], { opts: {} }, 'v4.1.23', {
140 name: 'node',
141 headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
142 })
143
144 t.equal(release.semver.version, '4.1.23')
145 delete release.semver
146
147 t.deepEqual(release, {
148 version: '4.1.23',
149 name: 'node',
150 baseUrl: 'https://nodejs.org/dist/v4.1.23/',
151 tarballUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz',
152 shasumsUrl: 'https://nodejs.org/dist/v4.1.23/SHASUMS256.txt',
153 versionDir: '4.1.23',
154 ia32: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' },
155 x64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' },
156 arm64: { libUrl: 'https://nodejs.org/dist/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
157 })
158})
159
160test('test process release - process.release ~ node@4.1.23 / corp build', function (t) {
161 t.plan(2)
162
163 var release = processRelease([], { opts: {} }, 'v4.1.23', {
164 name: 'node',
165 headersUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz'
166 })
167
168 t.equal(release.semver.version, '4.1.23')
169 delete release.semver
170
171 t.deepEqual(release, {
172 version: '4.1.23',
173 name: 'node',
174 baseUrl: 'https://some.custom.location/',
175 tarballUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz',
176 shasumsUrl: 'https://some.custom.location/SHASUMS256.txt',
177 versionDir: '4.1.23',
178 ia32: { libUrl: 'https://some.custom.location/win-x86/node.lib', libPath: 'win-x86/node.lib' },
179 x64: { libUrl: 'https://some.custom.location/win-x64/node.lib', libPath: 'win-x64/node.lib' },
180 arm64: { libUrl: 'https://some.custom.location/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
181 })
182})
183
184test('test process release - process.release ~ node@12.8.0 Windows', function (t) {
185 t.plan(2)
186
187 var release = processRelease([], { opts: {} }, 'v12.8.0', {
188 name: 'node',
189 sourceUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0.tar.gz',
190 headersUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',
191 libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x64/node.lib'
192 })
193
194 t.equal(release.semver.version, '12.8.0')
195 delete release.semver
196
197 t.deepEqual(release, {
198 version: '12.8.0',
199 name: 'node',
200 baseUrl: 'https://nodejs.org/download/release/v12.8.0/',
201 tarballUrl: 'https://nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',
202 shasumsUrl: 'https://nodejs.org/download/release/v12.8.0/SHASUMS256.txt',
203 versionDir: '12.8.0',
204 ia32: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x86/node.lib', libPath: 'win-x86/node.lib' },
205 x64: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-x64/node.lib', libPath: 'win-x64/node.lib' },
206 arm64: { libUrl: 'https://nodejs.org/download/release/v12.8.0/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
207 })
208})
209
210test('test process release - process.release ~ node@12.8.0 Windows ARM64', function (t) {
211 t.plan(2)
212
213 var release = processRelease([], { opts: {} }, 'v12.8.0', {
214 name: 'node',
215 sourceUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0.tar.gz',
216 headersUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',
217 libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-arm64/node.lib'
218 })
219
220 t.equal(release.semver.version, '12.8.0')
221 delete release.semver
222
223 t.deepEqual(release, {
224 version: '12.8.0',
225 name: 'node',
226 baseUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/',
227 tarballUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/node-v12.8.0-headers.tar.gz',
228 shasumsUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/SHASUMS256.txt',
229 versionDir: '12.8.0',
230 ia32: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-x86/node.lib', libPath: 'win-x86/node.lib' },
231 x64: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-x64/node.lib', libPath: 'win-x64/node.lib' },
232 arm64: { libUrl: 'https://unofficial-builds.nodejs.org/download/release/v12.8.0/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
233 })
234})
235
236test('test process release - process.release ~ node@4.1.23 --target=0.10.40', function (t) {
237 t.plan(2)
238
239 var release = processRelease([], { opts: { target: '0.10.40' } }, 'v4.1.23', {
240 name: 'node',
241 headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
242 })
243
244 t.equal(release.semver.version, '0.10.40')
245 delete release.semver
246
247 t.deepEqual(release, {
248 version: '0.10.40',
249 name: 'node',
250 baseUrl: 'https://nodejs.org/dist/v0.10.40/',
251 tarballUrl: 'https://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz',
252 shasumsUrl: 'https://nodejs.org/dist/v0.10.40/SHASUMS256.txt',
253 versionDir: '0.10.40',
254 ia32: { libUrl: 'https://nodejs.org/dist/v0.10.40/node.lib', libPath: 'node.lib' },
255 x64: { libUrl: 'https://nodejs.org/dist/v0.10.40/x64/node.lib', libPath: 'x64/node.lib' },
256 arm64: { libUrl: 'https://nodejs.org/dist/v0.10.40/arm64/node.lib', libPath: 'arm64/node.lib' }
257 })
258})
259
260test('test process release - process.release ~ node@4.1.23 --dist-url=https://foo.bar/baz', function (t) {
261 t.plan(2)
262
263 var release = processRelease([], { opts: { 'dist-url': 'https://foo.bar/baz' } }, 'v4.1.23', {
264 name: 'node',
265 headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
266 })
267
268 t.equal(release.semver.version, '4.1.23')
269 delete release.semver
270
271 t.deepEqual(release, {
272 version: '4.1.23',
273 name: 'node',
274 baseUrl: 'https://foo.bar/baz/v4.1.23/',
275 tarballUrl: 'https://foo.bar/baz/v4.1.23/node-v4.1.23-headers.tar.gz',
276 shasumsUrl: 'https://foo.bar/baz/v4.1.23/SHASUMS256.txt',
277 versionDir: '4.1.23',
278 ia32: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' },
279 x64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' },
280 arm64: { libUrl: 'https://foo.bar/baz/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
281 })
282})
283
284test('test process release - process.release ~ frankenstein@4.1.23', function (t) {
285 t.plan(2)
286
287 var release = processRelease([], { opts: {} }, 'v4.1.23', {
288 name: 'frankenstein',
289 headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz'
290 })
291
292 t.equal(release.semver.version, '4.1.23')
293 delete release.semver
294
295 t.deepEqual(release, {
296 version: '4.1.23',
297 name: 'frankenstein',
298 baseUrl: 'https://frankensteinjs.org/dist/v4.1.23/',
299 tarballUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
300 shasumsUrl: 'https://frankensteinjs.org/dist/v4.1.23/SHASUMS256.txt',
301 versionDir: 'frankenstein-4.1.23',
302 ia32: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' },
303 x64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' },
304 arm64: { libUrl: 'https://frankensteinjs.org/dist/v4.1.23/win-arm64/frankenstein.lib', libPath: 'win-arm64/frankenstein.lib' }
305 })
306})
307
308test('test process release - process.release ~ frankenstein@4.1.23 --dist-url=http://foo.bar/baz/', function (t) {
309 t.plan(2)
310
311 var release = processRelease([], { opts: { 'dist-url': 'http://foo.bar/baz/' } }, 'v4.1.23', {
312 name: 'frankenstein',
313 headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23.tar.gz'
314 })
315
316 t.equal(release.semver.version, '4.1.23')
317 delete release.semver
318
319 t.deepEqual(release, {
320 version: '4.1.23',
321 name: 'frankenstein',
322 baseUrl: 'http://foo.bar/baz/v4.1.23/',
323 tarballUrl: 'http://foo.bar/baz/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
324 shasumsUrl: 'http://foo.bar/baz/v4.1.23/SHASUMS256.txt',
325 versionDir: 'frankenstein-4.1.23',
326 ia32: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x86/frankenstein.lib', libPath: 'win-x86/frankenstein.lib' },
327 x64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib', libPath: 'win-x64/frankenstein.lib' },
328 arm64: { libUrl: 'http://foo.bar/baz/v4.1.23/win-arm64/frankenstein.lib', libPath: 'win-arm64/frankenstein.lib' }
329 })
330})
331
332test('test process release - process.release ~ node@4.0.0-rc.4', function (t) {
333 t.plan(2)
334
335 var release = processRelease([], { opts: {} }, 'v4.0.0-rc.4', {
336 name: 'node',
337 headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
338 })
339
340 t.equal(release.semver.version, '4.0.0-rc.4')
341 delete release.semver
342
343 t.deepEqual(release, {
344 version: '4.0.0-rc.4',
345 name: 'node',
346 baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
347 tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
348 shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
349 versionDir: '4.0.0-rc.4',
350 ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' },
351 x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' },
352 arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
353 })
354})
355
356test('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0]', function (t) {
357 t.plan(2)
358
359 // note the missing 'v' on the arg, it should normalise when checking
360 // whether we're on the default or not
361 var release = processRelease(['4.0.0-rc.4'], { opts: {} }, 'v4.0.0-rc.4', {
362 name: 'node',
363 headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
364 })
365
366 t.equal(release.semver.version, '4.0.0-rc.4')
367 delete release.semver
368
369 t.deepEqual(release, {
370 version: '4.0.0-rc.4',
371 name: 'node',
372 baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
373 tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
374 shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
375 versionDir: '4.0.0-rc.4',
376 ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' },
377 x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' },
378 arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
379 })
380})
381
382test('test process release - process.release ~ node@4.0.0-rc.4 - bogus string passed as argv[0]', function (t) {
383 t.plan(2)
384
385 // additional arguments can be passed in on the commandline that should be ignored if they
386 // are not specifying a valid version @ position 0
387 var release = processRelease(['this is no version!'], { opts: {} }, 'v4.0.0-rc.4', {
388 name: 'node',
389 headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
390 })
391
392 t.equal(release.semver.version, '4.0.0-rc.4')
393 delete release.semver
394
395 t.deepEqual(release, {
396 version: '4.0.0-rc.4',
397 name: 'node',
398 baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
399 tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
400 shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
401 versionDir: '4.0.0-rc.4',
402 ia32: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib', libPath: 'win-x86/node.lib' },
403 x64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib', libPath: 'win-x64/node.lib' },
404 arm64: { libUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
405 })
406})
407
408test('test process release - NODEJS_ORG_MIRROR', function (t) {
409 t.plan(2)
410
411 process.env.NODEJS_ORG_MIRROR = 'http://foo.bar'
412
413 var release = processRelease([], { opts: {} }, 'v4.1.23', {
414 name: 'node',
415 headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
416 })
417
418 t.equal(release.semver.version, '4.1.23')
419 delete release.semver
420
421 t.deepEqual(release, {
422 version: '4.1.23',
423 name: 'node',
424 baseUrl: 'http://foo.bar/v4.1.23/',
425 tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',
426 shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',
427 versionDir: '4.1.23',
428 ia32: { libUrl: 'http://foo.bar/v4.1.23/win-x86/node.lib', libPath: 'win-x86/node.lib' },
429 x64: { libUrl: 'http://foo.bar/v4.1.23/win-x64/node.lib', libPath: 'win-x64/node.lib' },
430 arm64: { libUrl: 'http://foo.bar/v4.1.23/win-arm64/node.lib', libPath: 'win-arm64/node.lib' }
431 })
432
433 delete process.env.NODEJS_ORG_MIRROR
434})
Note: See TracBrowser for help on using the repository browser.