@@ -234,20 +234,25 @@ write_file(
234234 content = ["v16.5.0" ],
235235)
236236
237+ write_file (
238+ name = "write_node_version_20" ,
239+ out = "expected_node_20" ,
240+ content = ["v20.19.6" ],
241+ )
242+
243+ write_file (
244+ name = "write_node_version_24" ,
245+ out = "expected_node_24" ,
246+ content = ["v24.12.0" ],
247+ )
248+
237249# To see what nodejs version is used by default
238250my_nodejs (
239251 name = "run_no_toolchain" ,
240252 out = "thing_no_toolchain" ,
241253 entry_point = "version.js" ,
242254)
243255
244- # this tests to make sure that the first version imported in the workspace is used as default
245- diff_test (
246- name = "node_version_default_toolchain_test" ,
247- file1 = "write_node_version_16" ,
248- file2 = "thing_no_toolchain" ,
249- )
250-
251256# Output contains the version number of node that is used.
252257# This is used in tests later to verify the toolchain specified is resolved correctly
253258my_nodejs (
@@ -279,11 +284,11 @@ my_nodejs(
279284 # using the select statement will download toolchains for all three platforms
280285 # you can also just provide an individual toolchain if you don't want to download them all
281286 toolchain = select ({
282- "@bazel_tools//src/conditions:linux_x86_64" : "@nodejs_linux_amd64 //:toolchain" ,
283- "@bazel_tools//src/conditions:linux_aarch64" : "@nodejs_linux_arm64 //:toolchain" ,
284- "@bazel_tools//src/conditions:darwin_x86_64" : "@nodejs_darwin_amd64 //:toolchain" ,
285- "@bazel_tools//src/conditions:darwin_arm64" : "@nodejs_darwin_arm64 //:toolchain" ,
286- "@bazel_tools//src/conditions:windows" : "@nodejs_windows_amd64 //:toolchain" ,
287+ "@bazel_tools//src/conditions:linux_x86_64" : "@node16_linux_amd64 //:toolchain" ,
288+ "@bazel_tools//src/conditions:linux_aarch64" : "@node16_linux_arm64 //:toolchain" ,
289+ "@bazel_tools//src/conditions:darwin_x86_64" : "@node16_darwin_amd64 //:toolchain" ,
290+ "@bazel_tools//src/conditions:darwin_arm64" : "@node16_darwin_arm64 //:toolchain" ,
291+ "@bazel_tools//src/conditions:windows" : "@node16_windows_amd64 //:toolchain" ,
287292 }),
288293)
289294
@@ -312,3 +317,46 @@ diff_test(
312317 file1 = "write_node_version_15" ,
313318 file2 = "thing_toolchain_15" ,
314319)
320+
321+ my_nodejs (
322+ name = "run_default" ,
323+ out = "thing_toolchain_20" ,
324+ entry_point = "version.js" ,
325+ # using the select statement will download toolchains for all three platforms
326+ # you can also just provide an individual toolchain if you don't want to download them all
327+ toolchain = select ({
328+ "@bazel_tools//src/conditions:linux_x86_64" : "@nodejs_linux_amd64//:toolchain" ,
329+ "@bazel_tools//src/conditions:linux_aarch64" : "@nodejs_linux_arm64//:toolchain" ,
330+ "@bazel_tools//src/conditions:darwin_x86_64" : "@nodejs_darwin_amd64//:toolchain" ,
331+ "@bazel_tools//src/conditions:darwin_arm64" : "@nodejs_darwin_arm64//:toolchain" ,
332+ "@bazel_tools//src/conditions:windows" : "@nodejs_windows_amd64//:toolchain" ,
333+ }),
334+ )
335+
336+ # this tests to make sure that the first version imported in the workspace is used as default
337+ diff_test (
338+ name = "node_version_default_toolchain_test" ,
339+ file1 = "write_node_version_20" ,
340+ file2 = "thing_no_toolchain" ,
341+ )
342+
343+ my_nodejs (
344+ name = "run_24" ,
345+ out = "thing_toolchain_24" ,
346+ entry_point = "version.js" ,
347+ # using the select statement will download toolchains for all three platforms
348+ # you can also just provide an individual toolchain if you don't want to download them all
349+ toolchain = select ({
350+ "@bazel_tools//src/conditions:linux_x86_64" : "@node24_linux_amd64//:toolchain" ,
351+ "@bazel_tools//src/conditions:linux_aarch64" : "@node24_linux_arm64//:toolchain" ,
352+ "@bazel_tools//src/conditions:darwin_x86_64" : "@node24_darwin_amd64//:toolchain" ,
353+ "@bazel_tools//src/conditions:darwin_arm64" : "@node24_darwin_arm64//:toolchain" ,
354+ "@bazel_tools//src/conditions:windows" : "@node24_windows_amd64//:toolchain" ,
355+ }),
356+ )
357+
358+ diff_test (
359+ name = "test_node_version_24" ,
360+ file1 = "write_node_version_24" ,
361+ file2 = "thing_toolchain_24" ,
362+ )
0 commit comments