Skip to content

Commit

Permalink
feat(config): created the husky directory and declared the dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed Mar 30, 2021
1 parent fb976e8 commit c7391e7
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cucumber.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
base: '--require-module @babel/register --format-options \'{"snippetInterface": "async-await"}\'',
base: '--publish-quiet --require-module @babel/register --format-options \'{"snippetInterface": "async-await"}\'',
wip: '--tags "@wip"',
noWip: '--tags "not @wip"',
focus: '--tags @focus'
Expand Down
56 changes: 50 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@cucumber/cucumber": "^7.0.0-rc.0",
"@form8ion/babel-preset": "1.6.52",
"@form8ion/commitlint-config": "1.0.16",
"@form8ion/core": "1.4.2",
"@form8ion/eslint-config": "1.7.10",
"@form8ion/eslint-config-cucumber": "1.4.0",
"@form8ion/eslint-config-mocha": "1.2.10",
Expand Down Expand Up @@ -78,5 +79,8 @@
"rollup": "2.44.0",
"rollup-plugin-auto-external": "2.0.0",
"sinon": "10.0.0"
},
"dependencies": {
"make-dir": "^3.1.0"
}
}
7 changes: 0 additions & 7 deletions src/canary-test.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {default as scaffold} from './scaffold';
export {default as scaffold} from './scaffolder';
3 changes: 0 additions & 3 deletions src/scaffold.js

This file was deleted.

25 changes: 25 additions & 0 deletions src/scaffolder-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 mkdir from '../thirdparty-wrappers/make-dir';
import scaffold from './scaffolder';

suite('scaffolder', () => {
let sandbox;

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

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

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

test('that husky is configured', async () => {
const projectRoot = any.string();
const {devDependencies} = await scaffold({projectRoot});

assert.deepEqual(devDependencies, ['husky']);
assert.calledWith(mkdir.default, `${projectRoot}/.husky`);
});
});
7 changes: 7 additions & 0 deletions src/scaffolder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import makeDir from '../thirdparty-wrappers/make-dir';

export default async function ({projectRoot}) {
await makeDir(`${projectRoot}/.husky`);

return {devDependencies: ['husky']};
}
1 change: 1 addition & 0 deletions test/integration/features/scaffolder.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Feature: Scaffolder

Scenario: Scaffold
When the project is scaffolded
Then husky is configured
2 changes: 1 addition & 1 deletion test/integration/features/step_definitions/common-steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ When('the project is scaffolded', async function () {
node_modules: stubbedNodeModules
});

await scaffold({projectRoot: process.cwd()});
this.scaffoldResult = await scaffold({projectRoot: process.cwd()});
});
8 changes: 8 additions & 0 deletions test/integration/features/step_definitions/config-steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Then} from '@cucumber/cucumber';
import {assert} from 'chai';
import {directoryExists} from '@form8ion/core';

Then('husky is configured', async function () {
assert.include(this.scaffoldResult.devDependencies, 'husky');
assert.isTrue(await directoryExists(`${process.cwd()}/.husky`));
});
3 changes: 3 additions & 0 deletions thirdparty-wrappers/make-dir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import makeDir from 'make-dir';

export default makeDir;

0 comments on commit c7391e7

Please sign in to comment.