@@ -132,6 +132,68 @@ describe('Version', () => {
132132 ` ) ;
133133 } ) ;
134134
135+ it ( 'should throw when apply is combined with releaseType' , async ( ) => {
136+ fsExtra . __setMockFiles ( {
137+ [ CODE_PACKAGE_JSON_PATH ] : JSON . stringify ( { version : '1.0.0' } ) ,
138+ [ MANAGER_API_VERSION_PATH ] : `export const version = "1.0.0";` ,
139+ [ VERSIONS_PATH ] : `export default { "@storybook/addon-a11y": "1.0.0" };` ,
140+ } ) ;
141+
142+ await expect ( version ( { apply : true , releaseType : 'prerelease' } ) ) . rejects
143+ . toThrowErrorMatchingInlineSnapshot ( `
144+ "[
145+ {
146+ "code": "custom",
147+ "message": "--apply cannot be combined with --exact or --release-type, as it will always read from code/package.json#deferredNextVersion",
148+ "path": []
149+ }
150+ ]"
151+ ` ) ;
152+ } ) ;
153+
154+ it ( 'should throw when apply is combined with exact' , async ( ) => {
155+ fsExtra . __setMockFiles ( {
156+ [ CODE_PACKAGE_JSON_PATH ] : JSON . stringify ( { version : '1.0.0' } ) ,
157+ [ MANAGER_API_VERSION_PATH ] : `export const version = "1.0.0";` ,
158+ [ VERSIONS_PATH ] : `export default { "@storybook/addon-a11y": "1.0.0" };` ,
159+ } ) ;
160+
161+ await expect ( version ( { apply : true , exact : '1.0.0' } ) ) . rejects
162+ . toThrowErrorMatchingInlineSnapshot ( `
163+ "[
164+ {
165+ "code": "custom",
166+ "message": "--apply cannot be combined with --exact or --release-type, as it will always read from code/package.json#deferredNextVersion",
167+ "path": []
168+ }
169+ ]"
170+ ` ) ;
171+ } ) ;
172+
173+ it ( 'should throw when apply is combined with deferred' , async ( ) => {
174+ fsExtra . __setMockFiles ( {
175+ [ CODE_PACKAGE_JSON_PATH ] : JSON . stringify ( { version : '1.0.0' } ) ,
176+ [ MANAGER_API_VERSION_PATH ] : `export const version = "1.0.0";` ,
177+ [ VERSIONS_PATH ] : `export default { "@storybook/addon-a11y": "1.0.0" };` ,
178+ } ) ;
179+
180+ await expect ( version ( { apply : true , deferred : true } ) ) . rejects
181+ . toThrowErrorMatchingInlineSnapshot ( `
182+ "[
183+ {
184+ "code": "custom",
185+ "message": "--deferred cannot be combined with --apply",
186+ "path": []
187+ },
188+ {
189+ "code": "custom",
190+ "message": "Combining --exact with --release-type is invalid, but having one of them is required",
191+ "path": []
192+ }
193+ ]"
194+ ` ) ;
195+ } ) ;
196+
135197 it . each ( [
136198 // prettier-ignore
137199 { releaseType : 'major' , currentVersion : '1.1.1' , expectedVersion : '2.0.0' } ,
0 commit comments