Skip to content

Commit

Permalink
fix bug caused by batch yielding undefined function
Browse files Browse the repository at this point in the history
  • Loading branch information
amilajack committed Feb 25, 2019
1 parent 8b11520 commit 78da731
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ $ npm install --save @amilajack/joker
## How it looks

```js
import Joker from '@amilajack/joker';

await new Joker()
.cwd(path.join(__dirname, 'fixtures'))
.env('NODE_ENV', 'production')
.before('touch /tmp/test')
.run('ls /tmp/')
.stdout(/test/)
.code(0)
.end();
const path = require('path');
const { default: Joker } = require('@amilajack/joker');

(async () => {
await new Joker()
.cwd(path.join(__dirname, 'fixtures'))
.env('NODE_ENV', 'production')
.before('touch /tmp/test')
.run('ls /tmp/')
.stdout(/test/)
.code(0)
.end();
})();
```

## API
Expand Down
4 changes: 3 additions & 1 deletion src/batch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ export default class Batch {
latestFn(next);
return;
}
latestFn();
if (typeof latestFn === 'function') {
latestFn();
}
next();
}

Expand Down

0 comments on commit 78da731

Please sign in to comment.