Skip to content

Commit

Permalink
specify directory
Browse files Browse the repository at this point in the history
  • Loading branch information
slxiao committed Sep 23, 2019
1 parent cd8c763 commit 60cb008
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Some key points of **test-funnel**:
```shell
$ npm -g install test-funnel
```
# Usgae
# CLI Usgae
After installed, command `test-funnel` will be available. Run command `test-funnel -h` to get help guidelines.
```shell
Usage: test-funnel [options]
Expand All @@ -38,5 +38,19 @@ Options:
-r, --runner <name> test runner, could be one of jest/mocha, not trigger runner if not specified
-h, --help output usage information
```
# API Usage
```js
var Funnel = require('test-funnel');
Funnel ({
baseFolder: "./",
testFolder: "test",
testFileExtention: "test.js",
newCommit: "HEAD~0",
oldCommit: "HEAD~1",
runner: ""
});
```
# License
MIT License
2 changes: 1 addition & 1 deletion lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const defaultConfig = {

async function run(res, config) {
await new Promise((resolve, reject) => {
let cmd = config.runner == "jest" ? 'jest --testPathPattern=' + res.join("|") : 'mocha -g=' + res.join("|");
let cmd = config.runner == "jest" ? 'jest --rootDir=' + config.testFolder + ' --testPathPattern=' + res.join("|") : 'mocha -g=' + res.join("|");
console.log("start to run tests, command: " + cmd);
exec(cmd, function(error, stdout, stderr) {
console.log('stdout: ' + stdout);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "test-funnel",
"version": "1.1.0",
"version": "1.1.2",
"description": "Javascript test selector",
"main": "./bin/cli.js",
"bin": {
Expand All @@ -9,7 +9,7 @@
"scripts": {
"test": "jest",
"build": "rimraf dist/ && babel ./ --out-dir dist/ --ignore ./node_modules,./.babelrc,./package.json,./npm-debug.log --copy-files",
"start": "npm run build && node dist/bin/cli.js -r jest"
"start": "npm run build && node dist/bin/cli.js -r jest -o HEAD~7"
},
"jest": {
"transform": {
Expand Down

0 comments on commit 60cb008

Please sign in to comment.