Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for presets #153

Merged
merged 6 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ Example:
"dev": {
"@cksource/foo": "cksource/foo#dev"
},
"newFeature": {
"@cksource/foo": "cksource/foo#newFeatureBranch",
"@cksource/bar": "cksource/foo#newFeatureBranch"
"exampleFeature": {
przemyslaw-zan marked this conversation as resolved.
Show resolved Hide resolved
"@cksource/foo": "cksource/foo#i/1-example-feature",
"@cksource/bar": "cksource/foo#i/1-example-feature"
}
}
}
Expand Down
14 changes: 4 additions & 10 deletions tests/utils/getoptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,17 @@ describe( 'utils', () => {
} );

it( 'throws an error when --preset option is used, but presets are not defined in "mrgit.json"', () => {
try {
expect( () => {
getOptions( { preset: 'foo' }, cwd );
throw new Error( 'Expected to throw.' );
} catch ( error ) {
expect( error.message ).to.equal( 'Preset "foo" is not defined in "mrgit.json" file.' );
}
} ).to.throw( Error, 'Preset "foo" is not defined in "mrgit.json" file.' );
} );

it( 'throws an error when --preset option is used, but the specific preset is not defined in "mrgit.json"', () => {
const cwdForPresets = path.resolve( __dirname, '..', 'fixtures', 'project-with-presets' );

try {
expect( () => {
getOptions( { preset: 'foo' }, cwdForPresets );
throw new Error( 'Expected to throw.' );
} catch ( error ) {
expect( error.message ).to.equal( 'Preset "foo" is not defined in "mrgit.json" file.' );
}
} ).to.throw( Error, 'Preset "foo" is not defined in "mrgit.json" file.' );
} );

it( 'returns options with preset merged with dependencies when --preset option is used', () => {
Expand Down