Skip to content

Commit

Permalink
test: add callbacks
Browse files Browse the repository at this point in the history
Using async fs functions without callbacks is deprecated and will
throw in future versions. This adds a callback and checks that it
does not error.
  • Loading branch information
BridgeAR committed Feb 13, 2018
1 parent 5f7f27b commit b2a2ab1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mkdirp.sync(tmpdir);
fs.writeFileSync(files.main, 'console.log(555)');

test('bin', function (t) {
t.plan(4);
t.plan(5);
var ps = spawn(cmd, [ files.main, '-o', files.bundle, '-v' ]);
var lineNum = 0;
ps.stderr.pipe(split()).on('data', function (line) {
Expand All @@ -27,7 +27,7 @@ test('bin', function (t) {
run(files.bundle, function (err, output) {
t.ifError(err);
t.equal(output, '555\n');
fs.writeFile(files.main, 'console.log(333)');
fs.writeFile(files.main, 'console.log(333)', t.ifError);
})
}
else if (lineNum === 2) {
Expand Down
4 changes: 2 additions & 2 deletions test/bin_brfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fs.writeFileSync(files.main, [
fs.writeFileSync(files.lines, 'beep\nboop');

test('bin brfs', function (t) {
t.plan(4);
t.plan(5);
var ps = spawn(cmd, [
files.main,
'-t', require.resolve('brfs'), '-v',
Expand All @@ -37,7 +37,7 @@ test('bin brfs', function (t) {
run(files.bundle, function (err, output) {
t.ifError(err);
t.equal(output, 'BEEP\nBOOP\n');
fs.writeFile(files.lines, 'robo-bOOgie');
fs.writeFile(files.lines, 'robo-bOOgie', t.ifError);
})
}
else if (lineNum === 2) {
Expand Down
4 changes: 2 additions & 2 deletions test/bin_pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mkdirp.sync(tmpdir);
fs.writeFileSync(files.main, 'console.log(num * 2)');

test('bin with pipe', function (t) {
t.plan(4);
t.plan(5);
var ps = spawn(cmd, [
files.main,
'-o', 'uglifyjs - --enclose 11:num > ' + files.bundle,
Expand All @@ -31,7 +31,7 @@ test('bin with pipe', function (t) {
run(files.bundle, function (err, output) {
t.ifError(err);
t.equal(output, '22\n');
fs.writeFile(files.main, 'console.log(num * 3)');
fs.writeFile(files.main, 'console.log(num * 3)', t.ifError);
});
}
else if (lineNum === 2) {
Expand Down
4 changes: 2 additions & 2 deletions test/bin_standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mkdirp.sync(tmpdir);
fs.writeFileSync(files.main, 'console.log(555)');

test('bin with standalone', function (t) {
t.plan(4);
t.plan(5);
var ps = spawn(cmd, [ files.main, '-o', files.bundle, '-v', '-s', 'XXX' ]);
var lineNum = 0;
ps.stderr.pipe(split()).on('data', function (line) {
Expand All @@ -27,7 +27,7 @@ test('bin with standalone', function (t) {
run(files.bundle, function (err, output) {
t.ifError(err);
t.equal(output, '555\n');
fs.writeFile(files.main, 'console.log(333)');
fs.writeFile(files.main, 'console.log(333)', t.ifError);
})
}
else if (lineNum === 2) {
Expand Down

0 comments on commit b2a2ab1

Please sign in to comment.