@@ -168,6 +168,7 @@ describe("steps/generateChanges", () => {
168168 const root = `${ cwd } /test/fixtures/change` ;
169169 const aliases : Alias [ ] = [
170170 {
171+ alias : "~/*" ,
171172 prefix : "~/" ,
172173 aliasPaths : [ `${ root } /src` , `${ root } /src/alternateSrc` ] ,
173174 } ,
@@ -277,6 +278,22 @@ describe("steps/generateChanges", () => {
277278 ` ) ;
278279 } ) ;
279280
281+ it ( "does not replace paths that are already relative" , ( ) => {
282+ const result = aliasToRelativePath (
283+ "../.." ,
284+ "test/fixtures/change/out/nested/imports.js" ,
285+ [ { alias : "*" , prefix : "" , aliasPaths : [ `${ root } /src` ] } ] ,
286+ programPaths
287+ ) ;
288+
289+ expect ( result ) . toMatchInlineSnapshot ( `
290+ Object {
291+ "file": "test/fixtures/change/out/nested/imports.js",
292+ "original": "../..",
293+ }
294+ ` ) ;
295+ } ) ;
296+
280297 it ( "returns the correct relative path for an aliased path from a nested directory using a secondary alias" , ( ) => {
281298 const result = aliasToRelativePath (
282299 "~/alternate" ,
@@ -300,6 +317,7 @@ describe("steps/generateChanges", () => {
300317 const root = `${ cwd } /test/fixtures/change` ;
301318 const aliases : Alias [ ] = [
302319 {
320+ alias : "~/*" ,
303321 prefix : "~/" ,
304322 aliasPaths : [ `${ root } /src` , `${ root } /src/alternateSrc` ] ,
305323 } ,
@@ -495,6 +513,7 @@ describe("steps/generateChanges", () => {
495513 const root = `${ cwd } /test/fixtures/change` ;
496514 const aliases : Alias [ ] = [
497515 {
516+ alias : "~/*" ,
498517 prefix : "~/" ,
499518 aliasPaths : [ `${ root } /src` , `${ root } /src/alternateSrc` ] ,
500519 } ,
0 commit comments