Skip to content

Commit

Permalink
feat: made the tool callable
Browse files Browse the repository at this point in the history
and started to wire up the husky check
  • Loading branch information
travi committed May 12, 2020
1 parent b33c0ca commit 66cd073
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 11 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ $ npm install @form8ion/ski-patrol --save-dev
### Example

```javascript
import skiPatrol from '@form8ion/ski-patrol';
import {assess} from '@form8ion/ski-patrol';

(async () => {
await assess();
})();
```

## Contributing
Expand Down
8 changes: 5 additions & 3 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// remark-usage-ignore-next
/* eslint-disable-next-line no-unused-vars */
import skiPatrol from './lib/index.cjs';
import {patrol} from './lib/index.cjs';

(async () => {
await patrol({projectRoot: process.cwd()});
})();
7 changes: 0 additions & 7 deletions src/canary-test.js

This file was deleted.

3 changes: 3 additions & 0 deletions src/husky.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function () {

}
25 changes: 25 additions & 0 deletions src/ski-patrol-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {assert} from 'chai';
import sinon from 'sinon';
import any from '@travi/any';
import * as husky from './husky';
import {patrol} from './ski-patrol';

suite('ski-patrol', () => {
let sandbox;

setup(() => {
sandbox = sinon.createSandbox();

sandbox.stub(husky, 'default');
});

teardown(() => sandbox.restore());

test('that the project is checked for issues', async () => {
const projectRoot = any.string();

await patrol({projectRoot});

assert.calledWith(husky.default, projectRoot);
});
});
5 changes: 5 additions & 0 deletions src/ski-patrol.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import husky from './husky';

export async function patrol({projectRoot}) {
await husky(projectRoot);
}

0 comments on commit 66cd073

Please sign in to comment.