-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from TheElter/feature/glob_option
Feature/glob option (second part)
- Loading branch information
Showing
11 changed files
with
148 additions
and
23 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
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,69 @@ | ||
'use strict' | ||
|
||
var path = require('path') | ||
var tap = require('tap') | ||
var childProcess = require('child_process') | ||
|
||
const cliPath = path.resolve(__dirname, '..', 'index.js') | ||
const example4Path = path.resolve(__dirname, 'data', 'example4') | ||
|
||
tap.test('default flags', t => { | ||
t.plan(3) | ||
|
||
childProcess.execFile('node', [cliPath, example4Path], (error, stdout, stderr) => { | ||
t.equal(error.code, 1) | ||
t.match(stdout, 'bar is required') | ||
t.match(stdout, 'wow is required') | ||
}) | ||
}) | ||
|
||
tap.test('no-dependency', t => { | ||
t.plan(5) | ||
|
||
childProcess.execFile('node', [cliPath, example4Path, '--no-dependency'], (error, stdout, stderr) => { | ||
t.equal(error.code, 1) | ||
t.match(stdout, 'gearup is required') | ||
t.match(stdout, 'foo is required') | ||
t.match(stdout, 'bar is required') | ||
t.match(stdout, 'wow is required') | ||
}) | ||
}) | ||
|
||
tap.test('peer-dependency', t => { | ||
t.plan(1) | ||
|
||
childProcess.execFile('node', [cliPath, example4Path, '--peer-dependency'], (error, stdout, stderr) => { | ||
t.equal(error, null) | ||
}) | ||
}) | ||
|
||
tap.test('no-optional-dependency', t => { | ||
t.plan(4) | ||
|
||
childProcess.execFile('node', [cliPath, example4Path, '--no-optional-dependency'], (error, stdout, stderr) => { | ||
t.equal(error.code, 1) | ||
t.match(stdout, 'bar is required') | ||
t.match(stdout, 'wow is required') | ||
t.match(stdout, 'is is required') | ||
}) | ||
}) | ||
|
||
tap.test('glob-pattern', t => { | ||
t.plan(4) | ||
|
||
childProcess.execFile('node', [cliPath, example4Path, '--glob-pattern', '**/*.strange'], (error, stdout, stderr) => { | ||
t.equal(error.code, 1) | ||
t.match(stdout, 'gnats is required') | ||
t.match(stdout, 'Unused package gearup') | ||
t.match(stdout, 'Unused package is') | ||
}) | ||
}) | ||
|
||
tap.test('no directory', t => { | ||
t.plan(2) | ||
|
||
childProcess.execFile('node', [cliPath, 'package.json'], (error, stdout, stderr) => { | ||
t.equal(error.code, 1) | ||
t.match(stderr, 'First params should be a directory path') | ||
}) | ||
}) |
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,12 @@ | ||
'use strict' | ||
|
||
// dependencies | ||
require('foo') | ||
require('gearup/utils') | ||
|
||
// peerDependencies | ||
require('bar') | ||
require('wow') | ||
|
||
// optionalDependencies | ||
require('is') |
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,22 @@ | ||
{ | ||
"name": "example4", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"gearup": "^1.3.2", | ||
"foo": "^1.3.2" | ||
}, | ||
"peerDependencies": { | ||
"bar": "^1.3.2", | ||
"wow": "^1.3.2" | ||
}, | ||
"optionalDependencies": { | ||
"is": "^1.3.2" | ||
} | ||
} |
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,4 @@ | ||
'use strict' | ||
|
||
require('foo') | ||
require('gnats') |
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