Comparing version 0.1.0 to 1.0.0
@@ -5,4 +5,4 @@ # History | ||
## 0.1.0 | ||
## 1.0.0 | ||
First commit |
22
index.js
'use strict'; | ||
module.exports = function() { | ||
return ''; | ||
var Coffee = require('./lib/coffee'); | ||
exports.Coffee = Coffee; | ||
exports.fork = function(modulePath, args, opt) { | ||
return new Coffee({ | ||
method: 'fork', | ||
cmd: modulePath, | ||
args: args, | ||
opt: opt | ||
}); | ||
}; | ||
exports.spawn = function(cmd, args, opt) { | ||
return new Coffee({ | ||
method: 'spawn', | ||
cmd: cmd, | ||
args: args, | ||
opt: opt | ||
}); | ||
}; |
{ | ||
"name": "coffee", | ||
"version": "0.1.0", | ||
"description": "The best module ever.", | ||
"version": "1.0.0", | ||
"description": "Test command line on nodejs", | ||
"main": "index", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"debug": "~2.1.1" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "2", | ||
"istanbul": "0", | ||
"jshint": "*", | ||
"istanbul": "0", | ||
"coveralls": "2", | ||
"mocha": "1", | ||
"should": "4" | ||
"should": "~4.6.0" | ||
}, | ||
@@ -20,2 +22,10 @@ "repository": { | ||
"author": "popomore <sakura9515@gmail.com>", | ||
"keywords": [ | ||
"test", | ||
"shell", | ||
"spawn", | ||
"fork", | ||
"child_process", | ||
"exec" | ||
], | ||
"license": "MIT", | ||
@@ -22,0 +32,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
# coffee | ||
# Coffee | ||
@@ -8,9 +8,9 @@ [![NPM version](https://img.shields.io/npm/v/coffee.svg?style=flat)](https://npmjs.org/package/coffee) | ||
The best module ever. | ||
Test command line on nodejs | ||
--- | ||
``` | ||
## Install | ||
``` | ||
$ npm install coffee -g | ||
@@ -21,8 +21,77 @@ ``` | ||
Coffee is useful to test command line in Mocha or other test frammework. | ||
``` | ||
var coffee = require('coffee'); | ||
describe('cat', function() { | ||
it('should concat input', function(done) { | ||
var coffee = require('coffee'); | ||
coffe.spawn('cat') | ||
.write('1') | ||
.write('2') | ||
.expect('stdout', '12') | ||
.expect('code', 0) | ||
.end(done); | ||
}) | ||
}) | ||
``` | ||
You can also use fork for spawning Node processes. | ||
``` | ||
coffe.fork('/path/to/file.js', ['args ']) | ||
.expect('stdout', '12\n') | ||
.expect('stderr', '34\n') | ||
.expect('code', 0) | ||
.end(done); | ||
``` | ||
In file.js | ||
``` | ||
console.log(12); | ||
console.log(34); | ||
``` | ||
## API | ||
### coffee.spawn | ||
Run command using `child_process.spawn`, then return `Coffee` instance. | ||
Arguments see [child_process.spawn](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) | ||
### coffee.fork | ||
Run command using `child_process.fork`, then return `Coffee` instance. | ||
Arguments see [child_process.fork](http://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options) | ||
### Coffee | ||
Assertion object | ||
#### coffee.expect(type, expected) | ||
Assert type with expected value, expected value can be string, regular expression, and array. | ||
``` | ||
coffe.spawn('echo', ['abcdefg']) | ||
.expect('stdout', 'abcdefg') | ||
.expect('stdout', /^abc/) | ||
.expect('stdout', ['abcdefg', /abc/]) | ||
.end(done); | ||
``` | ||
Accept type: `stdout`, `stderr`, `code` | ||
#### coffee.write(data) | ||
Write data to stdin, see example above. | ||
#### coffee.end(callback) | ||
Callback will be called after completing the assertion, the first argument is Error if throw exception. | ||
## LISENCE | ||
Copyright (c) 2015 popomore. Licensed under the MIT license. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7338
8
144
0
96
1
+ Addeddebug@~2.1.1
+ Addeddebug@2.1.3(transitive)
+ Addedms@0.7.0(transitive)