-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): fetching of latest npm version could fail
- Loading branch information
Showing
6 changed files
with
71 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const path = require('path'); | ||
const Nodist = require('../lib/nodist'); | ||
|
||
const testPath = path.resolve(__dirname + '/tmp'); | ||
|
||
const createNodistInstance = () => new Nodist( | ||
process.env.NODIST_NODE_MIRROR || 'https://nodejs.org/dist', | ||
process.env.NODIST_IOJS_MIRROR || 'https://iojs.org/dist', | ||
path.resolve(testPath) | ||
); | ||
|
||
const promiseWithCallback = (promise, callback) => promise.then( | ||
res => { callback(null, res); }, | ||
err => { callback(err); }, | ||
); | ||
|
||
module.exports = { | ||
createNodistInstance, | ||
promiseWithCallback, | ||
testPath, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
const assert = require('assert'); | ||
const debug = require('debug')('nodist:test'); | ||
const vows = require('vows'); | ||
|
||
const Npmist = require('../lib/npm'); | ||
const { createNodistInstance, promiseWithCallback } = require('./helper'); | ||
|
||
const npmBaseVersion = '6.10.1'; | ||
|
||
vows.describe('npm') | ||
.addBatch({ | ||
'NPMIST': { | ||
topic: new Npmist(createNodistInstance(), npmBaseVersion), | ||
'calling `latestVersion()`': { | ||
topic(npmist) { promiseWithCallback(npmist.latestVersion(), this.callback); }, | ||
'should return valid version number': (error, result) => { | ||
assert.ifError(error); | ||
debug('latestVersion: ' + result); | ||
assert.match(result, /^v\d+\.\d+\.\d+$/); | ||
} | ||
} | ||
} | ||
}) | ||
.export(module); |