This repository has been archived by the owner on Dec 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(husky): applied the husky enhancer in the list rather than s…
…eparately
- Loading branch information
Showing
4 changed files
with
53 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import * as huskyLifter from '@form8ion/husky'; | ||
|
||
import {assert} from 'chai'; | ||
import any from '@travi/any'; | ||
import sinon from 'sinon'; | ||
|
||
import {enhanceHuskyEnhancer} from './enhanced-enhancers'; | ||
|
||
suite('enhanced enhancers', () => { | ||
let sandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.createSandbox(); | ||
|
||
sandbox.stub(huskyLifter, 'lift'); | ||
}); | ||
|
||
teardown(() => sandbox.restore()); | ||
|
||
test('that the package manager is passed to the husky enhancer', async () => { | ||
const packageManager = any.word(); | ||
const results = any.simpleObject(); | ||
const projectRoot = any.string(); | ||
const huskyLiftResults = any.simpleObject(); | ||
huskyLifter.lift.withArgs({projectRoot, packageManager, results}).resolves(huskyLiftResults); | ||
|
||
const enhancedHuskyEnhancer = enhanceHuskyEnhancer(packageManager); | ||
|
||
assert.equal(await enhancedHuskyEnhancer.lift({results, projectRoot}), huskyLiftResults); | ||
assert.equal(enhancedHuskyEnhancer.test, huskyLifter.test); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {lift as liftHusky, test as liftPredicate} from '@form8ion/husky'; | ||
|
||
export function enhanceHuskyEnhancer(packageManager) { | ||
return { | ||
test: liftPredicate, | ||
lift: ({projectRoot, results}) => liftHusky({projectRoot, results, packageManager}) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters