Skip to content

Commit 917eee8

Browse files
committed
refactor: switch to latest ShellJS plugin API
1 parent cceaf1e commit 917eee8

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This exposes the plugin utilities
2-
var plugin = require('shelljs/src/common');
2+
var plugin = require('shelljs/plugin');
33

44
// Require whatever modules you need for your project
55
var child = require('child_process');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"eslint-config-airbnb-base": "^4.0.2",
3232
"eslint-plugin-import": "^1.11.1",
3333
"mocha": "^2.5.3",
34-
"shelljs": "0.7.2",
34+
"shelljs": "github:shelljs/shelljs",
3535
"shelljs-changelog": "^0.2.2",
3636
"shelljs-release": "^0.2.0",
3737
"should": "^10.0.0"

test/test.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* globals describe, it */
1+
/* globals describe, it, open */
22

33
/*
44
* Using ShellJS Plugins:
@@ -85,8 +85,7 @@ describe('plugin-open', function () {
8585
ret.stdout.should.equal('');
8686
var errorMsg = 'open: option not recognized: f';
8787
ret.stderr.should.equal(errorMsg);
88-
// TODO(nate): refactor ShellJS to support this
89-
// shell.error().should.equal(errorMsg);
88+
shell.error().should.equal(errorMsg);
9089
});
9190

9291
it('cannot open files that are missing', function () {
@@ -95,8 +94,12 @@ describe('plugin-open', function () {
9594
ret.stdout.should.equal('');
9695
var errorMsg = 'open: Unable to locate file: missingFile.txt';
9796
ret.stderr.should.equal(errorMsg);
98-
// TODO(nate): refactor ShellJS to support this
99-
// shell.error().should.equal(errorMsg);
97+
shell.error().should.equal(errorMsg);
98+
ret = open('missingFile.txt');
99+
ret.code.should.equal(1);
100+
ret.stdout.should.equal('');
101+
ret.stderr.should.equal(errorMsg);
102+
shell.error().should.equal(errorMsg);
100103
});
101104

102105
it('opens URLs', function () {

0 commit comments

Comments
 (0)