File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1+ 7.4.0
Original file line number Diff line number Diff line change 1- const { join, dirname } = require ( 'path' )
1+ const { join } = require ( 'path' )
22const { Runfiles } = require ( '@bazel/runfiles' )
33
44function describe ( name , fn ) {
@@ -51,6 +51,16 @@ describe('runfile resolution', () => {
5151 )
5252 } )
5353
54+ it ( 'should properly resolve with the _main module alias' , ( ) => {
55+ const testFixturePath = runfiles . resolve ( '_main/test_fixture.md' )
56+ const expectedPath = join ( __dirname , 'test_fixture.md' )
57+
58+ assert (
59+ normalizePath ( testFixturePath ) == normalizePath ( expectedPath ) ,
60+ `Expected the test fixture to be resolved next to the spec source file: ${ testFixturePath } vs ${ expectedPath } `
61+ )
62+ } )
63+
5464 it ( 'should properly resolve a runfile within a direct module dependency' , ( ) => {
5565 const fsPatchPath = runfiles . resolve (
5666 'aspect_rules_js/js/private/node-patches/fs.cjs'
Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ describe('runfile resolution', () => {
5555 )
5656 } )
5757
58+ it ( 'should properly resolve with the _main module alias' , ( ) => {
59+ const testFixturePath = runfiles . resolve (
60+ '_main/examples/runfiles/test_fixture.md'
61+ )
62+ const expectedPath = join ( __dirname , 'test_fixture.md' )
63+
64+ assert (
65+ normalizePath ( testFixturePath ) == normalizePath ( expectedPath ) ,
66+ `Expected the test fixture to be resolved next to the spec source file: ${ testFixturePath } vs ${ expectedPath } `
67+ )
68+ } )
69+
5870 it ( 'should properly resolve a subdirectory of a runfile' , ( ) => {
5971 const packagePath = runfiles . resolve ( 'aspect_rules_js/examples' )
6072 // Alternate with trailing slash
You can’t perform that action at this time.
0 commit comments