@@ -70,11 +70,16 @@ describe("Migrator", () => {
7070 it . effect ( "fromFileSystem imports migrations through the file URL the platform resolves" , ( ) =>
7171 Effect . gen ( function * ( ) {
7272 const posix = yield * Effect . provide ( Path . Path , Path . layer )
73+ const migrationUrl = new URL ( "./fixtures/migrator/0001_first.js" , import . meta. url )
74+ let resolvedPath : string | undefined
7375 // stand in for a Windows platform layer, which core has no implementation of
7476 const windowsLike = Layer . succeed ( Path . Path ) ( {
7577 ...posix ,
7678 join : ( ...segments : ReadonlyArray < string > ) => segments . join ( "\\" ) ,
77- toFileUrl : ( path : string ) => Effect . succeed ( new URL ( `file:///${ path . replaceAll ( "\\" , "/" ) } ` ) )
79+ toFileUrl : ( path : string ) => {
80+ resolvedPath = path
81+ return Effect . succeed ( migrationUrl )
82+ }
7883 } )
7984
8085 const migrations = yield * Migrator . fromFileSystem ( "C:\\migrations" ) . pipe (
@@ -87,13 +92,10 @@ describe("Migrator", () => {
8792 // the loader is lazy, and `ResolvedMigration` declares a `SqlClient`
8893 // requirement this loader never uses
8994 const load = migrations [ 0 ] ! [ 2 ] as Effect . Effect < unknown , unknown >
90- const specifier = yield * load . pipe (
91- Effect . catchDefect ( ( defect ) => Effect . succeed ( String ( defect ) ) ) ,
92- Effect . orElseSucceed ( ( ) => "" )
93- )
95+ const imported = yield * load
9496
95- // the raw path would have been rejected as protocol "c:"
96- assert . include ( specifier , "file:///C:/migrations/0001_first.js ")
97+ assert . strictEqual ( resolvedPath , "C:\\migrations\\0001_first.js" )
98+ assert . strictEqual ( ( imported as { readonly marker : string } ) . marker , "loaded ")
9799 } ) )
98100
99101 it . effect ( "fromFileSystem surfaces file URL failures as import errors" , ( ) =>
0 commit comments