test-process-release.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. var test = require('tape')
  2. var processRelease = require('../lib/process-release')
  3. test('test process release - process.version = 0.8.20', function (t) {
  4. t.plan(2)
  5. var release = processRelease([], { opts: {} }, 'v0.8.20', null)
  6. t.equal(release.semver.version, '0.8.20')
  7. delete release.semver
  8. t.deepEqual(release, {
  9. version: '0.8.20',
  10. name: 'node',
  11. baseUrl: 'https://nodejs.org/dist/v0.8.20/',
  12. tarballUrl: 'https://nodejs.org/dist/v0.8.20/node-v0.8.20.tar.gz',
  13. shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS256.txt',
  14. versionDir: '0.8.20',
  15. libUrl32: 'https://nodejs.org/dist/v0.8.20/node.lib',
  16. libUrl64: 'https://nodejs.org/dist/v0.8.20/x64/node.lib',
  17. libPath32: 'node.lib',
  18. libPath64: 'x64/node.lib'
  19. })
  20. })
  21. test('test process release - process.version = 0.10.21', function (t) {
  22. t.plan(2)
  23. var release = processRelease([], { opts: {} }, 'v0.10.21', null)
  24. t.equal(release.semver.version, '0.10.21')
  25. delete release.semver
  26. t.deepEqual(release, {
  27. version: '0.10.21',
  28. name: 'node',
  29. baseUrl: 'https://nodejs.org/dist/v0.10.21/',
  30. tarballUrl: 'https://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz',
  31. shasumsUrl: 'https://nodejs.org/dist/v0.10.21/SHASUMS256.txt',
  32. versionDir: '0.10.21',
  33. libUrl32: 'https://nodejs.org/dist/v0.10.21/node.lib',
  34. libUrl64: 'https://nodejs.org/dist/v0.10.21/x64/node.lib',
  35. libPath32: 'node.lib',
  36. libPath64: 'x64/node.lib'
  37. })
  38. })
  39. // prior to -headers.tar.gz
  40. test('test process release - process.version = 0.12.9', function (t) {
  41. t.plan(2)
  42. var release = processRelease([], { opts: {} }, 'v0.12.9', null)
  43. t.equal(release.semver.version, '0.12.9')
  44. delete release.semver
  45. t.deepEqual(release, {
  46. version: '0.12.9',
  47. name: 'node',
  48. baseUrl: 'https://nodejs.org/dist/v0.12.9/',
  49. tarballUrl: 'https://nodejs.org/dist/v0.12.9/node-v0.12.9.tar.gz',
  50. shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt',
  51. versionDir: '0.12.9',
  52. libUrl32: 'https://nodejs.org/dist/v0.12.9/node.lib',
  53. libUrl64: 'https://nodejs.org/dist/v0.12.9/x64/node.lib',
  54. libPath32: 'node.lib',
  55. libPath64: 'x64/node.lib'
  56. })
  57. })
  58. // prior to -headers.tar.gz
  59. test('test process release - process.version = 0.10.41', function (t) {
  60. t.plan(2)
  61. var release = processRelease([], { opts: {} }, 'v0.10.41', null)
  62. t.equal(release.semver.version, '0.10.41')
  63. delete release.semver
  64. t.deepEqual(release, {
  65. version: '0.10.41',
  66. name: 'node',
  67. baseUrl: 'https://nodejs.org/dist/v0.10.41/',
  68. tarballUrl: 'https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz',
  69. shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt',
  70. versionDir: '0.10.41',
  71. libUrl32: 'https://nodejs.org/dist/v0.10.41/node.lib',
  72. libUrl64: 'https://nodejs.org/dist/v0.10.41/x64/node.lib',
  73. libPath32: 'node.lib',
  74. libPath64: 'x64/node.lib'
  75. })
  76. })
  77. // has -headers.tar.gz
  78. test('test process release - process.release ~ node@0.10.42', function (t) {
  79. t.plan(2)
  80. var release = processRelease([], { opts: {} }, 'v0.10.42', null)
  81. t.equal(release.semver.version, '0.10.42')
  82. delete release.semver
  83. t.deepEqual(release, {
  84. version: '0.10.42',
  85. name: 'node',
  86. baseUrl: 'https://nodejs.org/dist/v0.10.42/',
  87. tarballUrl: 'https://nodejs.org/dist/v0.10.42/node-v0.10.42-headers.tar.gz',
  88. shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt',
  89. versionDir: '0.10.42',
  90. libUrl32: 'https://nodejs.org/dist/v0.10.42/node.lib',
  91. libUrl64: 'https://nodejs.org/dist/v0.10.42/x64/node.lib',
  92. libPath32: 'node.lib',
  93. libPath64: 'x64/node.lib'
  94. })
  95. })
  96. // has -headers.tar.gz
  97. test('test process release - process.release ~ node@0.12.10', function (t) {
  98. t.plan(2)
  99. var release = processRelease([], { opts: {} }, 'v0.12.10', null)
  100. t.equal(release.semver.version, '0.12.10')
  101. delete release.semver
  102. t.deepEqual(release, {
  103. version: '0.12.10',
  104. name: 'node',
  105. baseUrl: 'https://nodejs.org/dist/v0.12.10/',
  106. tarballUrl: 'https://nodejs.org/dist/v0.12.10/node-v0.12.10-headers.tar.gz',
  107. shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt',
  108. versionDir: '0.12.10',
  109. libUrl32: 'https://nodejs.org/dist/v0.12.10/node.lib',
  110. libUrl64: 'https://nodejs.org/dist/v0.12.10/x64/node.lib',
  111. libPath32: 'node.lib',
  112. libPath64: 'x64/node.lib'
  113. })
  114. })
  115. test('test process release - process.release ~ node@4.1.23', function (t) {
  116. t.plan(2)
  117. var release = processRelease([], { opts: {} }, 'v4.1.23', {
  118. name: 'node',
  119. headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
  120. })
  121. t.equal(release.semver.version, '4.1.23')
  122. delete release.semver
  123. t.deepEqual(release, {
  124. version: '4.1.23',
  125. name: 'node',
  126. baseUrl: 'https://nodejs.org/dist/v4.1.23/',
  127. tarballUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz',
  128. shasumsUrl: 'https://nodejs.org/dist/v4.1.23/SHASUMS256.txt',
  129. versionDir: '4.1.23',
  130. libUrl32: 'https://nodejs.org/dist/v4.1.23/win-x86/node.lib',
  131. libUrl64: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib',
  132. libPath32: 'win-x86/node.lib',
  133. libPath64: 'win-x64/node.lib'
  134. })
  135. })
  136. test('test process release - process.release ~ node@4.1.23 / corp build', function (t) {
  137. t.plan(2)
  138. var release = processRelease([], { opts: {} }, 'v4.1.23', {
  139. name: 'node',
  140. headersUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz'
  141. })
  142. t.equal(release.semver.version, '4.1.23')
  143. delete release.semver
  144. t.deepEqual(release, {
  145. version: '4.1.23',
  146. name: 'node',
  147. baseUrl: 'https://some.custom.location/',
  148. tarballUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz',
  149. shasumsUrl: 'https://some.custom.location/SHASUMS256.txt',
  150. versionDir: '4.1.23',
  151. libUrl32: 'https://some.custom.location/win-x86/node.lib',
  152. libUrl64: 'https://some.custom.location/win-x64/node.lib',
  153. libPath32: 'win-x86/node.lib',
  154. libPath64: 'win-x64/node.lib'
  155. })
  156. })
  157. test('test process release - process.version = 1.8.4', function (t) {
  158. t.plan(2)
  159. var release = processRelease([], { opts: {} }, 'v1.8.4', null)
  160. t.equal(release.semver.version, '1.8.4')
  161. delete release.semver
  162. t.deepEqual(release, {
  163. version: '1.8.4',
  164. name: 'iojs',
  165. baseUrl: 'https://iojs.org/download/release/v1.8.4/',
  166. tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
  167. shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
  168. versionDir: 'iojs-1.8.4',
  169. libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
  170. libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
  171. libPath32: 'win-x86/iojs.lib',
  172. libPath64: 'win-x64/iojs.lib'
  173. })
  174. })
  175. test('test process release - process.release ~ iojs@3.2.24', function (t) {
  176. t.plan(2)
  177. var release = processRelease([], { opts: {} }, 'v3.2.24', {
  178. name: 'io.js',
  179. headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
  180. })
  181. t.equal(release.semver.version, '3.2.24')
  182. delete release.semver
  183. t.deepEqual(release, {
  184. version: '3.2.24',
  185. name: 'iojs',
  186. baseUrl: 'https://iojs.org/download/release/v3.2.24/',
  187. tarballUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz',
  188. shasumsUrl: 'https://iojs.org/download/release/v3.2.24/SHASUMS256.txt',
  189. versionDir: 'iojs-3.2.24',
  190. libUrl32: 'https://iojs.org/download/release/v3.2.24/win-x86/iojs.lib',
  191. libUrl64: 'https://iojs.org/download/release/v3.2.24/win-x64/iojs.lib',
  192. libPath32: 'win-x86/iojs.lib',
  193. libPath64: 'win-x64/iojs.lib'
  194. })
  195. })
  196. test('test process release - process.release ~ iojs@3.2.11 +libUrl32', function (t) {
  197. t.plan(2)
  198. var release = processRelease([], { opts: {} }, 'v3.2.11', {
  199. name: 'io.js',
  200. headersUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
  201. libUrl: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib' // custom
  202. })
  203. t.equal(release.semver.version, '3.2.11')
  204. delete release.semver
  205. t.deepEqual(release, {
  206. version: '3.2.11',
  207. name: 'iojs',
  208. baseUrl: 'https://iojs.org/download/release/v3.2.11/',
  209. tarballUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
  210. shasumsUrl: 'https://iojs.org/download/release/v3.2.11/SHASUMS256.txt',
  211. versionDir: 'iojs-3.2.11',
  212. libUrl32: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib',
  213. libUrl64: 'https://iojs.org/download/release/v3.2.11/win-x64/iojs.lib',
  214. libPath32: 'win-x86/iojs.lib',
  215. libPath64: 'win-x64/iojs.lib'
  216. })
  217. })
  218. test('test process release - process.release ~ iojs@3.2.101 +libUrl64', function (t) {
  219. t.plan(2)
  220. var release = processRelease([], { opts: {} }, 'v3.2.101', {
  221. name: 'io.js',
  222. headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
  223. libUrl: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib' // custom
  224. })
  225. t.equal(release.semver.version, '3.2.101')
  226. delete release.semver
  227. t.deepEqual(release, {
  228. version: '3.2.101',
  229. name: 'iojs',
  230. baseUrl: 'https://iojs.org/download/release/v3.2.101/',
  231. tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
  232. shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
  233. versionDir: 'iojs-3.2.101',
  234. libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
  235. libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
  236. libPath32: 'win-x86/iojs.lib',
  237. libPath64: 'win-x64/iojs.lib'
  238. })
  239. })
  240. test('test process release - process.release ~ iojs@3.3.0 - borked win-ia32', function (t) {
  241. t.plan(2)
  242. var release = processRelease([], { opts: {} }, 'v3.2.101', {
  243. name: 'io.js',
  244. headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
  245. libUrl: 'https://iojs.org/download/release/v3.2.101/win-ia32/iojs.lib' // custom
  246. })
  247. t.equal(release.semver.version, '3.2.101')
  248. delete release.semver
  249. t.deepEqual(release, {
  250. version: '3.2.101',
  251. name: 'iojs',
  252. baseUrl: 'https://iojs.org/download/release/v3.2.101/',
  253. tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
  254. shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
  255. versionDir: 'iojs-3.2.101',
  256. libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
  257. libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
  258. libPath32: 'win-x86/iojs.lib',
  259. libPath64: 'win-x64/iojs.lib'
  260. })
  261. })
  262. test('test process release - process.release ~ node@4.1.23 --target=0.10.40', function (t) {
  263. t.plan(2)
  264. var release = processRelease([], { opts: { target: '0.10.40' } }, 'v4.1.23', {
  265. name: 'node',
  266. headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
  267. })
  268. t.equal(release.semver.version, '0.10.40')
  269. delete release.semver
  270. t.deepEqual(release, {
  271. version: '0.10.40',
  272. name: 'node',
  273. baseUrl: 'https://nodejs.org/dist/v0.10.40/',
  274. tarballUrl: 'https://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz',
  275. shasumsUrl: 'https://nodejs.org/dist/v0.10.40/SHASUMS256.txt',
  276. versionDir: '0.10.40',
  277. libUrl32: 'https://nodejs.org/dist/v0.10.40/node.lib',
  278. libUrl64: 'https://nodejs.org/dist/v0.10.40/x64/node.lib',
  279. libPath32: 'node.lib',
  280. libPath64: 'x64/node.lib'
  281. })
  282. })
  283. test('test process release - process.release ~ node@4.1.23 --target=1.8.4', function (t) {
  284. t.plan(2)
  285. var release = processRelease([], { opts: { target: '1.8.4' } }, 'v4.1.23', {
  286. name: 'node',
  287. headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
  288. })
  289. t.equal(release.semver.version, '1.8.4')
  290. delete release.semver
  291. t.deepEqual(release, {
  292. version: '1.8.4',
  293. name: 'iojs',
  294. baseUrl: 'https://iojs.org/download/release/v1.8.4/',
  295. tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
  296. shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
  297. versionDir: 'iojs-1.8.4',
  298. libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
  299. libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
  300. libPath32: 'win-x86/iojs.lib',
  301. libPath64: 'win-x64/iojs.lib'
  302. })
  303. })
  304. test('test process release - process.release ~ node@4.1.23 --dist-url=https://foo.bar/baz', function (t) {
  305. t.plan(2)
  306. var release = processRelease([], { opts: { 'dist-url': 'https://foo.bar/baz' } }, 'v4.1.23', {
  307. name: 'node',
  308. headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
  309. })
  310. t.equal(release.semver.version, '4.1.23')
  311. delete release.semver
  312. t.deepEqual(release, {
  313. version: '4.1.23',
  314. name: 'node',
  315. baseUrl: 'https://foo.bar/baz/v4.1.23/',
  316. tarballUrl: 'https://foo.bar/baz/v4.1.23/node-v4.1.23-headers.tar.gz',
  317. shasumsUrl: 'https://foo.bar/baz/v4.1.23/SHASUMS256.txt',
  318. versionDir: '4.1.23',
  319. libUrl32: 'https://foo.bar/baz/v4.1.23/win-x86/node.lib',
  320. libUrl64: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib',
  321. libPath32: 'win-x86/node.lib',
  322. libPath64: 'win-x64/node.lib'
  323. })
  324. })
  325. test('test process release - process.release ~ frankenstein@4.1.23', function (t) {
  326. t.plan(2)
  327. var release = processRelease([], { opts: {} }, 'v4.1.23', {
  328. name: 'frankenstein',
  329. headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz'
  330. })
  331. t.equal(release.semver.version, '4.1.23')
  332. delete release.semver
  333. t.deepEqual(release, {
  334. version: '4.1.23',
  335. name: 'frankenstein',
  336. baseUrl: 'https://frankensteinjs.org/dist/v4.1.23/',
  337. tarballUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
  338. shasumsUrl: 'https://frankensteinjs.org/dist/v4.1.23/SHASUMS256.txt',
  339. versionDir: 'frankenstein-4.1.23',
  340. libUrl32: 'https://frankensteinjs.org/dist/v4.1.23/win-x86/frankenstein.lib',
  341. libUrl64: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib',
  342. libPath32: 'win-x86/frankenstein.lib',
  343. libPath64: 'win-x64/frankenstein.lib'
  344. })
  345. })
  346. test('test process release - process.release ~ frankenstein@4.1.23 --dist-url=http://foo.bar/baz/', function (t) {
  347. t.plan(2)
  348. var release = processRelease([], { opts: { 'dist-url': 'http://foo.bar/baz/' } }, 'v4.1.23', {
  349. name: 'frankenstein',
  350. headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23.tar.gz'
  351. })
  352. t.equal(release.semver.version, '4.1.23')
  353. delete release.semver
  354. t.deepEqual(release, {
  355. version: '4.1.23',
  356. name: 'frankenstein',
  357. baseUrl: 'http://foo.bar/baz/v4.1.23/',
  358. tarballUrl: 'http://foo.bar/baz/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
  359. shasumsUrl: 'http://foo.bar/baz/v4.1.23/SHASUMS256.txt',
  360. versionDir: 'frankenstein-4.1.23',
  361. libUrl32: 'http://foo.bar/baz/v4.1.23/win-x86/frankenstein.lib',
  362. libUrl64: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib',
  363. libPath32: 'win-x86/frankenstein.lib',
  364. libPath64: 'win-x64/frankenstein.lib'
  365. })
  366. })
  367. test('test process release - process.release ~ node@4.0.0-rc.4', function (t) {
  368. t.plan(2)
  369. var release = processRelease([], { opts: {} }, 'v4.0.0-rc.4', {
  370. name: 'node',
  371. headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
  372. })
  373. t.equal(release.semver.version, '4.0.0-rc.4')
  374. delete release.semver
  375. t.deepEqual(release, {
  376. version: '4.0.0-rc.4',
  377. name: 'node',
  378. baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
  379. tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
  380. shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
  381. versionDir: '4.0.0-rc.4',
  382. libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
  383. libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
  384. libPath32: 'win-x86/node.lib',
  385. libPath64: 'win-x64/node.lib'
  386. })
  387. })
  388. test('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0]', function (t) {
  389. t.plan(2)
  390. // note the missing 'v' on the arg, it should normalise when checking
  391. // whether we're on the default or not
  392. var release = processRelease([ '4.0.0-rc.4' ], { opts: {} }, 'v4.0.0-rc.4', {
  393. name: 'node',
  394. headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
  395. })
  396. t.equal(release.semver.version, '4.0.0-rc.4')
  397. delete release.semver
  398. t.deepEqual(release, {
  399. version: '4.0.0-rc.4',
  400. name: 'node',
  401. baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
  402. tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
  403. shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
  404. versionDir: '4.0.0-rc.4',
  405. libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
  406. libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
  407. libPath32: 'win-x86/node.lib',
  408. libPath64: 'win-x64/node.lib'
  409. })
  410. })
  411. test('test process release - process.release ~ node@4.0.0-rc.4 - bogus string passed as argv[0]', function (t) {
  412. t.plan(2)
  413. // additional arguments can be passed in on the commandline that should be ignored if they
  414. // are not specifying a valid version @ position 0
  415. var release = processRelease([ 'this is no version!' ], { opts: {} }, 'v4.0.0-rc.4', {
  416. name: 'node',
  417. headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
  418. })
  419. t.equal(release.semver.version, '4.0.0-rc.4')
  420. delete release.semver
  421. t.deepEqual(release, {
  422. version: '4.0.0-rc.4',
  423. name: 'node',
  424. baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
  425. tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
  426. shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
  427. versionDir: '4.0.0-rc.4',
  428. libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
  429. libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
  430. libPath32: 'win-x86/node.lib',
  431. libPath64: 'win-x64/node.lib'
  432. })
  433. })
  434. test('test process release - NODEJS_ORG_MIRROR', function (t) {
  435. t.plan(2)
  436. process.env.NODEJS_ORG_MIRROR = 'http://foo.bar'
  437. var release = processRelease([], { opts: {} }, 'v4.1.23', {
  438. name: 'node',
  439. headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
  440. })
  441. t.equal(release.semver.version, '4.1.23')
  442. delete release.semver
  443. t.deepEqual(release, {
  444. version: '4.1.23',
  445. name: 'node',
  446. baseUrl: 'http://foo.bar/v4.1.23/',
  447. tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',
  448. shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',
  449. versionDir: '4.1.23',
  450. libUrl32: 'http://foo.bar/v4.1.23/win-x86/node.lib',
  451. libUrl64: 'http://foo.bar/v4.1.23/win-x64/node.lib',
  452. libPath32: 'win-x86/node.lib',
  453. libPath64: 'win-x64/node.lib'
  454. })
  455. delete process.env.NODEJS_ORG_MIRROR
  456. })
  457. test('test process release - NVM_NODEJS_ORG_MIRROR', function (t) {
  458. t.plan(2)
  459. process.env.NVM_NODEJS_ORG_MIRROR = 'http://foo.bar'
  460. var release = processRelease([], { opts: {} }, 'v4.1.23', {
  461. name: 'node',
  462. headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
  463. })
  464. t.equal(release.semver.version, '4.1.23')
  465. delete release.semver
  466. t.deepEqual(release, {
  467. version: '4.1.23',
  468. name: 'node',
  469. baseUrl: 'http://foo.bar/v4.1.23/',
  470. tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',
  471. shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',
  472. versionDir: '4.1.23',
  473. libUrl32: 'http://foo.bar/v4.1.23/win-x86/node.lib',
  474. libUrl64: 'http://foo.bar/v4.1.23/win-x64/node.lib',
  475. libPath32: 'win-x86/node.lib',
  476. libPath64: 'win-x64/node.lib'
  477. })
  478. delete process.env.NVM_NODEJS_ORG_MIRROR
  479. })
  480. test('test process release - IOJS_ORG_MIRROR', function (t) {
  481. t.plan(2)
  482. process.env.IOJS_ORG_MIRROR = 'http://foo.bar'
  483. var release = processRelease([], { opts: {} }, 'v3.2.24', {
  484. name: 'io.js',
  485. headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
  486. })
  487. t.equal(release.semver.version, '3.2.24')
  488. delete release.semver
  489. t.deepEqual(release, {
  490. version: '3.2.24',
  491. name: 'iojs',
  492. baseUrl: 'http://foo.bar/v3.2.24/',
  493. tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
  494. shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
  495. versionDir: 'iojs-3.2.24',
  496. libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
  497. libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
  498. libPath32: 'win-x86/iojs.lib',
  499. libPath64: 'win-x64/iojs.lib'
  500. })
  501. delete process.env.IOJS_ORG_MIRROR
  502. })
  503. test('test process release - NVM_IOJS_ORG_MIRROR', function (t) {
  504. t.plan(2)
  505. process.env.NVM_IOJS_ORG_MIRROR = 'http://foo.bar'
  506. var release = processRelease([], { opts: {} }, 'v3.2.24', {
  507. name: 'io.js',
  508. headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
  509. })
  510. t.equal(release.semver.version, '3.2.24')
  511. delete release.semver
  512. t.deepEqual(release, {
  513. version: '3.2.24',
  514. name: 'iojs',
  515. baseUrl: 'http://foo.bar/v3.2.24/',
  516. tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
  517. shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
  518. versionDir: 'iojs-3.2.24',
  519. libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
  520. libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
  521. libPath32: 'win-x86/iojs.lib',
  522. libPath64: 'win-x64/iojs.lib'
  523. })
  524. delete process.env.NVM_IOJS_ORG_MIRROR
  525. })