Skip to content

Commit d4809c3

Browse files
committed
test: add e2e/runfiles bazelversion
1 parent cd48714 commit d4809c3

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

e2e/runfiles/.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.4.0

e2e/runfiles/test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { join, dirname } = require('path')
1+
const { join } = require('path')
22
const { Runfiles } = require('@bazel/runfiles')
33

44
function 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'

examples/runfiles/test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)