Skip to content

Commit

Permalink
ENH: Run from CLI
Browse files Browse the repository at this point in the history
ENH: Add src/index.js

Export a function.

ENH: Add bin/cli

Run the exported function from /src

TST: Test cli command

ENH: Add test/integration/cli.test.js
  • Loading branch information
AlexisPuga committed Mar 2, 2021
1 parent 629e8a2 commit 2ba2428
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node
const preciseWatcher = require('../src')

preciseWatcher()
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = () => {
}
12 changes: 12 additions & 0 deletions test/integration/cli.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { promisify } = require('util')
const { execFile } = require('child_process')
const execFileAsync = promisify(execFile)

describe('precise-watcher', () => {
it('Should work with defaults', async () => {
const { stderr, stdout } = await execFileAsync('bin/cli')

expect(stderr).toBe('')
expect(stdout).toBe('')
})
})

0 comments on commit 2ba2428

Please sign in to comment.