Skip to content

Commit 6fc6208

Browse files
committed
Small tweaks
1 parent 502ced2 commit 6fc6208

3 files changed

Lines changed: 22 additions & 23 deletions

File tree

.jshintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"bitwise": true,
3-
"camelcase": true,
43
"curly": true,
54
"esnext": true,
65
"immed": true,

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Whether to skip the binary check or not.
5454
Type: `number`
5555
Default: `1`
5656

57-
Strip a number of leading paths from file names on extraction.
57+
Strip a number of leading paths from file names on extraction.
5858

5959
### .src(url, [os], [arch])
6060

@@ -107,7 +107,7 @@ Type: `string`
107107
Define a [semver range](https://github.com/isaacs/node-semver#ranges) to check
108108
the binary against.
109109

110-
### .run([cmd], cb)
110+
### .run([cmd], callback)
111111

112112
Runs the search for the binary. If no binary is found it will download the file
113113
using the URL provided in `.src()`.
@@ -120,7 +120,7 @@ Default: `['--version']`
120120
Command to run the binary with. If it exits with code `0` it means that the
121121
binary is working.
122122

123-
#### cb(err)
123+
#### callback(err)
124124

125125
Type: `function`
126126

test/test.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
'use strict';
22

3-
var BinWrapper = require('../');
43
var fs = require('fs');
5-
var nock = require('nock');
64
var path = require('path');
7-
var fixture = path.join.bind(path, __dirname, 'fixtures');
8-
var rm = require('rimraf');
5+
var BinWrapper = require('../');
6+
var nock = require('nock');
7+
var rimraf = require('rimraf');
98
var test = require('ava');
9+
var fixture = path.join.bind(path, __dirname, 'fixtures');
1010

1111
test('expose a constructor', function (t) {
1212
t.plan(1);
@@ -24,7 +24,7 @@ test('add a source', function (t) {
2424
var bin = new BinWrapper()
2525
.src('http://foo.com/bar.tar.gz');
2626

27-
t.assert(bin._src[0].url === 'http://foo.com/bar.tar.gz');
27+
t.assert(bin._src[0].url === 'http://foo.com/bar.tar.gz', bin._src[0].url);
2828
});
2929

3030
test('add a source to a specific os', function (t) {
@@ -33,7 +33,7 @@ test('add a source to a specific os', function (t) {
3333
var bin = new BinWrapper()
3434
.src('http://foo.com', process.platform);
3535

36-
t.assert(bin._src[0].os === process.platform);
36+
t.assert(bin._src[0].os === process.platform, bin._src[0].os);
3737
});
3838

3939
test('set destination directory', function (t) {
@@ -42,7 +42,7 @@ test('set destination directory', function (t) {
4242
var bin = new BinWrapper()
4343
.dest(path.join(__dirname, 'foo'));
4444

45-
t.assert(bin._dest === path.join(__dirname, 'foo'));
45+
t.assert(bin._dest === path.join(__dirname, 'foo'), bin._dest);
4646
});
4747

4848
test('set which file to use as the binary', function (t) {
@@ -51,7 +51,7 @@ test('set which file to use as the binary', function (t) {
5151
var bin = new BinWrapper()
5252
.use('foo');
5353

54-
t.assert(bin._use === 'foo');
54+
t.assert(bin._use === 'foo', bin._use);
5555
});
5656

5757
test('set a version range to test against', function (t) {
@@ -60,7 +60,7 @@ test('set a version range to test against', function (t) {
6060
var bin = new BinWrapper()
6161
.version('1.0.0');
6262

63-
t.assert(bin._version === '1.0.0');
63+
t.assert(bin._version === '1.0.0', bin._version);
6464
});
6565

6666
test('get the binary path', function (t) {
@@ -70,7 +70,7 @@ test('get the binary path', function (t) {
7070
.dest('tmp')
7171
.use('foo');
7272

73-
t.assert(bin.path() === 'tmp/foo');
73+
t.assert(bin.path() === 'tmp/foo', bin.path());
7474
});
7575

7676
test('verify that a binary is working', function (t) {
@@ -90,7 +90,7 @@ test('verify that a binary is working', function (t) {
9090
t.assert(fs.existsSync(bin.path()));
9191
t.assert(scope.isDone());
9292

93-
rm(bin.dest(), function (err) {
93+
rimraf(bin.dest(), function (err) {
9494
t.assert(!err, err);
9595
});
9696
});
@@ -114,7 +114,7 @@ test('meet the desired version', function (t) {
114114
t.assert(fs.existsSync(bin.path()));
115115
t.assert(scope.isDone());
116116

117-
rm(bin.dest(), function (err) {
117+
rimraf(bin.dest(), function (err) {
118118
t.assert(!err, err);
119119
});
120120
});
@@ -144,11 +144,11 @@ test('download files even if they are not used', function (t) {
144144
t.assert(!err, err);
145145
t.assert(scope.isDone());
146146
t.assert(files.length === 3);
147-
t.assert(files[0] === 'gifsicle');
148-
t.assert(files[1] === 'gifsicle.exe');
149-
t.assert(files[2] === 'test.js');
147+
t.assert(files[0] === 'gifsicle', files[0]);
148+
t.assert(files[1] === 'gifsicle.exe', files[1]);
149+
t.assert(files[2] === 'test.js', files[2]);
150150

151-
rm(bin.dest(), function (err) {
151+
rimraf(bin.dest(), function (err) {
152152
t.assert(!err, err);
153153
});
154154
});
@@ -171,7 +171,7 @@ test('skip running binary check', function (t) {
171171
t.assert(fs.existsSync(bin.path()));
172172
t.assert(scope.isDone());
173173

174-
rm(bin.dest(), function (err) {
174+
rimraf(bin.dest(), function (err) {
175175
t.assert(!err, err);
176176
});
177177
});
@@ -185,7 +185,7 @@ test('error if no binary is found and no source is provided', function (t) {
185185
.use(process.platform === 'win32' ? 'gifsicle.exe' : 'gifsicle');
186186

187187
bin.run(function (err) {
188-
t.assert(err);
189-
t.assert(err.message === 'No binary found matching your system. It\'s probably not supported.');
188+
t.assert(err, err);
189+
t.assert(err.message === 'No binary found matching your system. It\'s probably not supported.', err.message);
190190
});
191191
});

0 commit comments

Comments
 (0)