test: remove bazel_integration_test, fix ci failures
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index 1819535..e53500d 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -1,5 +1,5 @@
 ---
-bazel: 5.0.0
+bazel: 6.1.1
 # Note, this will tell the user to do the wrong thing (manually run buildifer)
 # See https://github.com/bazelbuild/continuous-integration/issues/1161
 buildifier:
@@ -30,76 +30,7 @@
     # on bazelci apt-get fails with permission denied and there is no sudo
     # command to switch to root.
     # TODO(gregmagolan): figure out how to install missing shared libs
-    - "--test_tag_filters=-e2e,-examples,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome"
-    test_targets:
-    - "//..."
-  ubuntu1804_debug:
-    name: ubuntu1804_debug
-    platform: ubuntu1804
-    test_flags:
-    - "--compilation_mode=dbg"
-    - "--define=VERBOSE_LOGS=1"
-    # Both chrome & firefox are missing shared libs on bazelci ubuntu.
-    # On circleci we have the same issue but we can work around it using apt-get.
-    # on bazelci apt-get fails with permission denied and there is no sudo
-    # command to switch to root.
-    # TODO(gregmagolan): figure out how to install missing shared libs
-    - "--test_tag_filters=-e2e,-examples,-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome"
-    test_targets:
-    - "//..."
-  ubuntu1804_e2e:
-    name: ubuntu1804_e2e
-    platform: ubuntu1804
-    # We need to reduce the memory & CPU usage of the top-level
-    # bazel process for bazel-in-bazel tests to not
-    # deplete the system memory completely.
-    # - startup JVM memory reduced
-    # - top-level bazel process should use as little memory as possible and only 1 core
-    # - nested bazel process should use a limited number of cores
-    shell_commands:
-    - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc
-    build_targets:
-    - "//..."
-    # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests.
-    skip_use_bazel_version_for_test: true
-    test_flags:
-    - "--test_tag_filters=e2e"
-    - "--local_ram_resources=792"
-    # test_args will be passed to the nested bazel process
-    - "--test_arg=--local_ram_resources=13288"
-    - "--test_arg=--local_cpu_resources=7"
-    test_targets:
-    - "//..."
-  ubuntu1804_examples:
-    name: ubuntu1804_examples
-    platform: ubuntu1804
-    # We need to reduce the memory & CPU usage of the top-level
-    # bazel process for bazel-in-bazel tests to not
-    # deplete the system memory completely.
-    # - startup JVM memory reduced
-    # - top-level bazel process should use as little memory as possible and only 1 core
-    # - nested bazel process should use a limited number of cores
-    shell_commands:
-    - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc
-    build_flags:
-    - "--build_tag_filters=examples"
-    build_targets:
-    - "//..."
-    # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests.
-    skip_use_bazel_version_for_test: true
-    test_flags:
-    - "--test_tag_filters=examples"
-    - "--local_ram_resources=792"
-    # test_args will be passed to the nested bazel process
-    - "--test_arg=--local_ram_resources=13288"
-    - "--test_arg=--local_cpu_resources=7"
-    # Both chrome & firefox are missing shared libs on bazelci ubuntu.
-    # On circleci we have the same issue but we can work around it using apt-get.
-    # on bazelci apt-get fails with permission denied and there is no sudo
-    # command to switch to root.
-    # TODO(gregmagolan): figure out how to install missing shared libs
-    - "--test_arg=--test_tag_filters=-browser:chromium-local,-browser:firefox-local"
-    - "--test_output=streamed"
+    - "--test_tag_filters=-browser:chromium-local,-browser:firefox-local,-browser:custom_chrome"
     test_targets:
     - "//..."
   # Temporarily disabled MacOS tests until pre-existing failure can be investigated.
@@ -121,63 +52,7 @@
   #   test_flags:
   #   # Firefox are missing shared libs on bazelci mac
   #   # TODO(gregmagolan): figure out how to install missing shared libs
-  #   - "--test_tag_filters=-e2e,-examples,-browser:firefox-local"
-  #   test_targets:
-  #   - "//..."
-  # macos_e2e:
-  #   name: macos_e2e
-  #   platform: macos
-  #   # We need to reduce the memory & CPU usage of the top-level
-  #   # bazel process for bazel-in-bazel tests to not
-  #   # deplete the system memory completely.
-  #   # - startup JVM memory reduced
-  #   # - top-level bazel process should use as little memory as possible and only 1 core
-  #   # - nested bazel process should use a limited number of cores
-  #   shell_commands:
-  #   - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc
-  #   build_flags:
-  #   - "--build_tag_filters=e2e"
-  #   build_targets:
-  #   - "//..."
-  #   # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests.
-  #   skip_use_bazel_version_for_test: true
-  #   test_flags:
-  #   - "--test_tag_filters=e2e,-no-bazelci-mac"
-  #   - "--local_ram_resources=792"
-  #   # test_args will be passed to the nested bazel process
-  #   # TODO(gregmagolan): fix frequent flake with multiple cores in nested bazel (osx buildkite & local)
-  #   - "--test_arg=--local_ram_resources=13288"
-  #   # Firefox are missing shared libs on bazelci mac
-  #   # TODO(gregmagolan): figure out how to install missing shared libs
-  #   - "--test_arg=--test_tag_filters=-browser:firefox-local"
-  #   test_targets:
-  #   - "//..."
-  # macos_examples:
-  #   name: macos_examples
-  #   platform: macos
-  #   # We need to reduce the memory & CPU usage of the top-level
-  #   # bazel process for bazel-in-bazel tests to not
-  #   # deplete the system memory completely.
-  #   # - startup JVM memory reduced
-  #   # - top-level bazel process should use as little memory as possible and only 1 core
-  #   # - nested bazel process should use a limited number of cores
-  #   shell_commands:
-  #   - echo 'startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1536m' >> .bazelrc
-  #   build_flags:
-  #   - "--build_tag_filters=examples"
-  #   build_targets:
-  #   - "//..."
-  #   # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests.
-  #   skip_use_bazel_version_for_test: true
-  #   test_flags:
-  #   - "--test_tag_filters=examples"
-  #   - "--local_ram_resources=792"
-  #   # test_args will be passed to the nested bazel process
-  #   # TODO(gregmagolan): fix frequent flake with multiple cores in nested bazel (osx buildkite & local)
-  #   - "--test_arg=--local_ram_resources=13288"
-  #   # Firefox are missing shared libs on bazelci mac
-  #   # TODO(gregmagolan): figure out how to install missing shared libs
-  #   - "--test_arg=--test_tag_filters=-no-bazelci-mac,-browser:firefox-local"
+  #   - "--test_tag_filters=-browser:firefox-local"
   #   test_targets:
   #   - "//..."
   # TODO(gregmagolan): fix platform configuraiton for this test job for Bazel 2.0
@@ -205,13 +80,13 @@
     # Disabled due to https://github.com/bazelbuild/rules_nodejs/issues/1486
     #- "@fine_grained_deps_yarn//typescript/bin:tsc"
     build_flags:
-    - "--build_tag_filters=-e2e,-examples,-fix-windows,-no-bazelci-windows,-requires-runfiles"
+    - "--build_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles"
     build_targets:
     - "//..."
     test_flags:
     # Firefox not supported on Windows with rules_webtesting (if run it exit with success)
     # See https://github.com/bazelbuild/rules_webtesting/blob/0.3.3/browsers/BUILD.bazel#L66.
-    - "--test_tag_filters=-e2e,-examples,-fix-windows,-no-bazelci-windows,-requires-runfiles,-browser:firefox-local"
+    - "--test_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles,-browser:firefox-local"
     test_targets:
     - "//..."
   windows_runfiles_enabled:
@@ -222,48 +97,6 @@
     - "--enable_runfiles"
     test_targets:
     - "//..."
-  windows_e2e:
-    name: windows_e2e
-    platform: windows
-    build_flags:
-    - "--build_tag_filters=e2e,-fix-windows,-no-bazelci-windows,-requires-runfiles"
-    build_targets:
-    - "//..."
-    # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests.
-    skip_use_bazel_version_for_test: true
-    test_flags:
-    - "--test_tag_filters=e2e,-fix-windows,-no-bazelci-windows,-requires-runfiles"
-    - "--local_ram_resources=792"
-    # test_args will be passed to the nested bazel process
-    - "--test_arg=--local_ram_resources=13288"
-    # Firefox not supported on Windows with rules_webtesting (if run it exit with success)
-    # See https://github.com/bazelbuild/rules_webtesting/blob/0.3.3/browsers/BUILD.bazel#L66.
-    # Chrome fails to launch on Windows inside bazel-in-bazel with: [17:12:04] E/launcher -
-    # spawn D:\...\external\io_bazel_rules_webtesting\third_party\chromedriver\chromedriver.out\chromedriver_win32\chromedriver.exe ENOENT
-    - "--test_arg=--test_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles,-browser:chromium-local,-browser:firefox-local"
-    test_targets:
-    - "//..."
-  windows_examples:
-    name: windows_examples
-    platform: windows
-    build_flags:
-    - "--build_tag_filters=examples,-fix-windows,-no-bazelci-windows,-requires-runfiles"
-    build_targets:
-    - "//..."
-    # We control Bazel version in integration tests, so we don't need USE_BAZEL_VERSION for tests.
-    skip_use_bazel_version_for_test: true
-    test_flags:
-    - "--test_tag_filters=examples,-fix-windows,-no-bazelci-windows,-requires-runfiles"
-    - "--local_ram_resources=792"
-    # test_args will be passed to the nested bazel process
-    - "--test_arg=--local_ram_resources=13288"
-    # Firefox not supported on Windows with rules_webtesting (if run it exit with success)
-    # See https://github.com/bazelbuild/rules_webtesting/blob/0.3.3/browsers/BUILD.bazel#L66.
-    # Chrome fails to launch on Windows inside bazel-in-bazel with: [17:12:04] E/launcher -
-    # spawn D:\...\external\io_bazel_rules_webtesting\third_party\chromedriver\chromedriver.out\chromedriver_win32\chromedriver.exe ENOENT
-    - "--test_arg=--test_tag_filters=-fix-windows,-no-bazelci-windows,-requires-runfiles,-browser:chromium-local,-browser:firefox-local"
-    test_targets:
-    - "//..."
   rbe_ubuntu1604:
     name: rbe_ubuntu1604
     platform: rbe_ubuntu1604
@@ -272,9 +105,9 @@
     build_flags:
     # TODO(gregmagolan): figure out how to install missing shared libs
     # Without this filter the @cypress external repository will be built and that build will fail due to missing shared libs.
-    - "--build_tag_filters=-examples,-e2e,-no-rbe,-browser:chromium-local,-browser:firefox-local"
+    - "--build_tag_filters=-no-rbe,-browser:chromium-local,-browser:firefox-local"
     test_flags:
     # TODO(gregmagolan): figure out how to install missing shared libs
-    - "--test_tag_filters=-examples,-e2e,-no-rbe,-browser:chromium-local,-browser:firefox-local"
+    - "--test_tag_filters=-no-rbe,-browser:chromium-local,-browser:firefox-local"
     test_targets:
     - "//..."
diff --git a/.bazelignore b/.bazelignore
index 3a2c18f..324052f 100644
--- a/.bazelignore
+++ b/.bazelignore
@@ -7,7 +7,6 @@
 node_modules
 e2e/symlinked_node_modules_yarn/node_modules
 e2e/symlinked_node_modules_npm/node_modules
-examples/angular/node_modules
 
 # **/dist
 dist
diff --git a/.bazelrc b/.bazelrc
index e009717..c1c40ee 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -5,8 +5,8 @@
 # This lets us glob() up all the files inside the examples to make them inputs to tests
 # To update these lines, just run `yarn bazel:update-deleted-packages`
 # (Note, we cannot use common --deleted_packages because the bazel version command doesn't support it)
-build --deleted_packages=e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,e2e/fine_grained_symlinks,e2e/linker_disabled_regression,e2e/linker_disabled_regression/subdir,e2e/node_loader_preserve_symlinks,e2e/nodejs_host,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,examples/angular,examples/angular/src,examples/angular/src/app,examples/angular/src/app/hello-world,examples/angular/src/app/home,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/assets,examples/angular/src/lib/shorten,examples/angular/src/shared/material,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/create-react-app,examples/from_source,examples/jest,examples/jest/ts,examples/jest/ts/src,examples/jest/ts/test,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protobufjs,examples/react_webpack,examples/toolchain,examples/vue,examples/vue/src,examples/vue/src/components/HelloWorld,examples/web_testing,examples/webapp,examples/worker
-query --deleted_packages=e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,e2e/fine_grained_symlinks,e2e/linker_disabled_regression,e2e/linker_disabled_regression/subdir,e2e/node_loader_preserve_symlinks,e2e/nodejs_host,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,examples/angular,examples/angular/src,examples/angular/src/app,examples/angular/src/app/hello-world,examples/angular/src/app/home,examples/angular/src/app/todos,examples/angular/src/app/todos/reducers,examples/angular/src/assets,examples/angular/src/lib/shorten,examples/angular/src/shared/material,examples/angular/tools,examples/angular_bazel_architect,examples/angular_bazel_architect/projects/frontend-lib,examples/app,examples/app/styles,examples/app/test,examples/closure,examples/create-react-app,examples/from_source,examples/jest,examples/jest/ts,examples/jest/ts/src,examples/jest/ts/test,examples/kotlin,examples/nestjs,examples/nestjs/src,examples/parcel,examples/protobufjs,examples/react_webpack,examples/toolchain,examples/vue,examples/vue/src,examples/vue/src/components/HelloWorld,examples/web_testing,examples/webapp,examples/worker
+build --deleted_packages=e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,e2e/fine_grained_symlinks,e2e/linker_disabled_regression,e2e/linker_disabled_regression/subdir,e2e/node_loader_preserve_symlinks,e2e/nodejs_host,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/smoke,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,examples/worker
+query --deleted_packages=e2e/bazel_run_chdir,e2e/bazel_run_chdir/subfolder,e2e/fine_grained_symlinks,e2e/linker_disabled_regression,e2e/linker_disabled_regression/subdir,e2e/node_loader_preserve_symlinks,e2e/nodejs_host,e2e/nodejs_image,e2e/nodejs_image/foolib,e2e/packages,e2e/smoke,e2e/symlinked_node_modules_npm,e2e/symlinked_node_modules_yarn,examples/worker
 
 # Mock versioning command to test the --stamp behavior
 build --workspace_status_command="echo BUILD_SCM_VERSION 1.2.3"
diff --git a/BUILD.bazel b/BUILD.bazel
index 031c940..c7e19b1 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -82,7 +82,6 @@
     substitutions = COMMON_REPLACEMENTS,
     deps = [
         "//internal:package_contents",
-        "//internal/bazel_integration_test:package_contents",
         "//internal/common:package_contents",
         "//internal/copy_repository:package_contents",
         "//internal/coverage:package_contents",
diff --git a/DEVELOPING.md b/DEVELOPING.md
index a28eab9..2ab3e20 100644
--- a/DEVELOPING.md
+++ b/DEVELOPING.md
@@ -51,14 +51,9 @@
 
 ## Integration tests
 
-In order to test that the rules work outside of this repo, this repo uses bazel-in-bazel with the
-bazel_integration_test rule to set up an environment with the package paths matching what end users
-will see. The end-to-end tests in e2e, and examples are built this way.
-
-The integration tests must be run in series, as they use up too many resources when run in parallel.
-
-`bazel test ...` includes all these integration tests. If you wish to exclude some of them, see the output of
-`yarn test` in the previous section.
+In order to test that the rules work outside of this repo, this repo has full bazel WORKSPACEs for e2e tests
+and examples to set up an environment with the package paths matching what end users will see.
+The end-to-end tests in e2e, and examples are built this way.
 
 When running the e2e tests, it is recommended to tune the memory usage of Bazel locally. This can be done with `bazel --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1280m test ... --test_tag_filters=e2e --local_ram_resources=792 --test_arg=--local_ram_resources=13288`. A shortcut for this is `yarn test_e2e //...`.
 
diff --git a/MODULE.bazel b/MODULE.bazel
index 41eb741..0a976c8 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -2,8 +2,8 @@
 
 module(
     name = "rules_nodejs",
-    compatibility_level = 1,
     version = "0.0.0",
+    compatibility_level = 1,
 )
 
 bazel_dep(name = "bazel_skylib", version = "1.1.1")
@@ -14,6 +14,6 @@
 # Note, this gets the default version of Node.js from
 # https://github.com/bazelbuild/rules_nodejs/blob/5.8.0/nodejs/repositories.bzl#L11
 node.toolchain(name = "nodejs")
-
 use_repo(node, "nodejs_toolchains")
+
 register_toolchains("@nodejs_toolchains//:all")
diff --git a/WORKSPACE b/WORKSPACE
index 6e1306b..0a1fa79 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -75,26 +75,10 @@
 # Declare an external repository for each npm package fetchable by the lock file
 _npm_patches_repositories()
 
-# Setup the rules_webtesting toolchain
-load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
-
-web_test_repositories()
-
-load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories")
-
-browser_repositories(
-    chromium = True,
-    firefox = True,
-)
-
 #
 # Dependencies to run stardoc & generating documentation
 #
 
-load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")
-
-sass_repositories()
-
 load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
 
 stardoc_repositories()
@@ -116,7 +100,6 @@
 # RBE configuration
 #
 
-load("//:index.bzl", "SUPPORTED_BAZEL_VERSIONS")
 load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig")
 
 # Creates toolchain configuration for remote execution with BuildKite CI
@@ -130,8 +113,3 @@
     name = "rbe_default",
     toolchain = "ubuntu1804-bazel-java11",
 )
-
-load("@build_bazel_integration_testing//tools:repositories.bzl", "bazel_binaries")
-
-# Depend on the Bazel binaries
-bazel_binaries(versions = SUPPORTED_BAZEL_VERSIONS)
diff --git a/commitlint.config.js b/commitlint.config.js
index 2d73029..5a6bf69 100644
--- a/commitlint.config.js
+++ b/commitlint.config.js
@@ -7,10 +7,8 @@
       'always',
       [
         'builtin',
-        'create',
         'examples',
         'runfiles',
-        'typescript',
         'worker',
         'docs',
       ],
diff --git a/e2e/BUILD.bazel b/e2e/BUILD.bazel
deleted file mode 100644
index 68101b4..0000000
--- a/e2e/BUILD.bazel
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-load(":test.bzl", "e2e_integration_test")
-
-e2e_integration_test(
-    name = "e2e_fine_grained_symlinks",
-    # TODO: figure out why this fails on Windows since setting
-    # symlink_node_modules to False in the test WORKSPACE
-    tags = ["no-bazelci-windows"],
-)
-
-e2e_integration_test(
-    name = "e2e_node_loader_preserve_symlinks",
-    # TODO: figure out why this fails on Windows since setting
-    # symlink_node_modules to False in the test WORKSPACE
-    tags = ["no-bazelci-windows"],
-)
-
-e2e_integration_test(
-    name = "e2e_nodejs_image",
-    bazel_commands = [
-        "info",
-        "test ...",
-        "run --platforms=@rules_nodejs//nodejs:linux_amd64 //:nodejs_image",
-    ],
-    # Only run on buildkite linux as other CI platforms have no docker available
-    tags = [
-        "no-bazelci-mac",
-        "no-bazelci-windows",
-        "no-circleci",
-    ],
-)
-
-e2e_integration_test(
-    name = "e2e_nodejs_host",
-)
-
-e2e_integration_test(
-    name = "e2e_packages",
-    # TODO(alex): figure out why this is broken by turning on linker
-    tags = ["no-bazelci-windows"],
-)
-
-e2e_integration_test(
-    name = "e2e_symlinked_node_modules_npm",
-    # TODO: figure out why this fails on Windows since setting
-    # symlink_node_modules to False in the test WORKSPACE
-    tags = ["no-bazelci-windows"],
-)
-
-e2e_integration_test(
-    name = "e2e_symlinked_node_modules_yarn",
-    # TODO: figure out why this fails on Windows since setting
-    # symlink_node_modules to False in the test WORKSPACE
-    tags = ["no-bazelci-windows"],
-)
-
-e2e_integration_test(
-    name = "e2e_bazel_run_chdir",
-    bazel_commands = [
-        "run //subfolder:chdir-test",
-    ],
-    # TODO: figure out why this fails on Windows
-    tags = ["no-bazelci-windows"],
-)
-
-e2e_integration_test(
-    name = "e2e_linker_disabled_regression",
-    bazel_commands = [
-        "build //...",
-        "run //subdir:binary",
-    ],
-    # TODO: figure out why this fails on Windows
-    tags = ["no-bazelci-windows"],
-)
diff --git a/e2e/bazel_run_chdir/test.sh b/e2e/bazel_run_chdir/test.sh
new file mode 100755
index 0000000..4ee2191
--- /dev/null
+++ b/e2e/bazel_run_chdir/test.sh
@@ -0,0 +1 @@
+bazel run //subfolder:chdir-test
\ No newline at end of file
diff --git a/e2e/linker_disabled_regression/test.sh b/e2e/linker_disabled_regression/test.sh
new file mode 100755
index 0000000..6b4102a
--- /dev/null
+++ b/e2e/linker_disabled_regression/test.sh
@@ -0,0 +1 @@
+bazel run //subdir:binary && bazel run //:binary
\ No newline at end of file
diff --git a/e2e/smoke/MODULE.bazel b/e2e/smoke/MODULE.bazel
index 1296845..f74578c 100644
--- a/e2e/smoke/MODULE.bazel
+++ b/e2e/smoke/MODULE.bazel
@@ -1,13 +1,14 @@
 "bzlmod dependencies"
+
 module(
     name = "rules_nodejs_smoke_test",
-    compatibility_level = 1,
     version = "0.0.0",
+    compatibility_level = 1,
 )
 
-bazel_dep(name = "rules_nodejs", dev_dependency = True, version = "0.0.0")
-bazel_dep(name = "bazel_skylib", dev_dependency = True, version = "1.3.0")
-bazel_dep(name = "aspect_bazel_lib", dev_dependency = True, version = "1.30.2")
+bazel_dep(name = "rules_nodejs", version = "0.0.0", dev_dependency = True)
+bazel_dep(name = "bazel_skylib", version = "1.3.0", dev_dependency = True)
+bazel_dep(name = "aspect_bazel_lib", version = "1.30.2", dev_dependency = True)
 
 local_path_override(
     module_name = "rules_nodejs",
@@ -22,7 +23,6 @@
     name = "node16",
     node_version = "16.5.0",
 )
-
 node.toolchain(
     name = "node15",
     node_version = "15.14.0",
@@ -30,12 +30,12 @@
 
 # FIXME(6.0): a repo rule with name=foo should create a repo named @foo, not @foo_toolchains
 use_repo(
-    node, 
-    "node16_toolchains",
-    "node15_linux_amd64",
+    node,
     "node15_darwin_amd64",
+    "node15_linux_amd64",
     "node15_windows_amd64",
-    "node16_linux_amd64",
     "node16_darwin_amd64",
+    "node16_linux_amd64",
+    "node16_toolchains",
     "node16_windows_amd64",
 )
diff --git a/e2e/test.bzl b/e2e/test.bzl
deleted file mode 100644
index 5bfb9f0..0000000
--- a/e2e/test.bzl
+++ /dev/null
@@ -1,26 +0,0 @@
-"Define a convenience macro for e2e integration testing"
-
-load("@build_bazel_rules_nodejs//internal/bazel_integration_test:bazel_integration_test.bzl", "rules_nodejs_integration_test")
-
-def e2e_integration_test(name, **kwargs):
-    "Set defaults for the bazel_integration_test common to our e2e"
-    workspace_root = kwargs.pop("workspace_root", name[len("e2e_"):])
-
-    native.filegroup(
-        name = "_%s_sources" % name,
-        srcs = native.glob(
-            [
-                "%s/*" % workspace_root,
-                "%s/**/*" % workspace_root,
-            ],
-            exclude = ["%s/node_modules/**" % workspace_root],
-        ),
-    )
-
-    rules_nodejs_integration_test(
-        name = name,
-        tags = kwargs.pop("tags", []) + ["e2e"],
-        workspace_files = kwargs.pop("workspace_files", "_%s_sources" % name),
-        resolutions = {"//packages/worker:npm_package": "@bazel/worker"},
-        **kwargs
-    )
diff --git a/index.bzl b/index.bzl
index 672c863..dc93153 100644
--- a/index.bzl
+++ b/index.bzl
@@ -84,7 +84,7 @@
 # against.
 # This version should be updated together with the version of the Bazel
 # in .bazelversion. This is asserted in //internal:bazel_version_test.
-BAZEL_VERSION = "5.0.0"
+BAZEL_VERSION = "6.1.1"
 
 # Versions of Bazel which users should be able to use.
 # Ensures we don't break backwards-compatibility,
diff --git a/internal/bazel_integration_test/BUILD.bazel b/internal/bazel_integration_test/BUILD.bazel
deleted file mode 100644
index bbc085e..0000000
--- a/internal/bazel_integration_test/BUILD.bazel
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
-load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
-
-package(default_visibility = ["//visibility:public"])
-
-nodejs_binary(
-    name = "test_runner",
-    configuration_env_vars = ["BAZEL_INTEGRATION_TEST_DEBUG"],
-    data = ["@npm//tmp"],
-    entry_point = ":test_runner.js",
-    templated_args = ["--node_options=--max-old-space-size=1024"],
-)
-
-filegroup(
-    name = "package_contents",
-    srcs = glob(["*"]),
-)
-
-bzl_library(
-    name = "bzl",
-    srcs = glob(["*.bzl"]),
-    visibility = ["//visibility:public"],
-)
diff --git a/internal/bazel_integration_test/bazel_integration_test.bzl b/internal/bazel_integration_test/bazel_integration_test.bzl
deleted file mode 100644
index cfa4cbe..0000000
--- a/internal/bazel_integration_test/bazel_integration_test.bzl
+++ /dev/null
@@ -1,301 +0,0 @@
-# Copyright 2017 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Bazel integration testing
-"""
-
-load("@build_bazel_rules_nodejs//:index.bzl", "BAZEL_VERSION", "SUPPORTED_BAZEL_VERSIONS")
-load("@build_bazel_rules_nodejs//packages:index.bzl", "NPM_PACKAGES")
-load("//internal/common:windows_utils.bzl", "BATCH_RLOCATION_FUNCTION", "is_windows")
-
-# Avoid using non-normalized paths (workspace/../other_workspace/path)
-def _to_manifest_path(ctx, file):
-    if file.short_path.startswith("../"):
-        return file.short_path[3:]
-    else:
-        return ctx.workspace_name + "/" + file.short_path
-
-def _bazel_integration_test(ctx):
-    if len(ctx.files.workspace_files) == 0:
-        fail("""
-No files were found to run under integration testing. See comment in /.bazelrc.
-You probably need to run
-
-    yarn bazel:update-deleted-packages
-
-""")
-
-    # Serialize configuration file for test runner
-    config = ctx.actions.declare_file("%s.config.js" % ctx.attr.name)
-    ctx.actions.write(
-        output = config,
-        content = """// bazel_integration_test runner config generated by bazel_integration_test rule
-module.exports = {{
-    workspaceRoot: '{TMPL_workspace_root}',
-    bazelBinaryWorkspace: '{TMPL_bazel_binary_workspace}',
-    bazelCommands: [ {TMPL_bazel_commands} ],
-    repositories: {{ {TMPL_repositories} }},
-    bazelrcAppend: `{TMPL_bazelrc_append}`,
-    bazelrcImports: {{ {TMPL_bazelrc_imports} }},
-    npmPackages: {{ {TMPL_npm_packages} }},
-    resolutions: {{ {TMPL_resolutions} }},
-    checkNpmPackages: [ {TMPL_check_npm_packages} ],
-    packageJsonRepacements: {{ {TMPL_package_json_substitutions} }},
-}};
-""".format(
-            TMPL_workspace_root = ctx.files.workspace_files[0].dirname,
-            TMPL_bazel_binary_workspace = ctx.attr.bazel_binary.label.workspace_name,
-            TMPL_bazel_commands = ", ".join(["'%s'" % s for s in ctx.attr.bazel_commands]),
-            TMPL_repositories = ", ".join(["'%s': '%s'" % (ctx.attr.repositories[f], _to_manifest_path(ctx, f.files.to_list()[0])) for f in ctx.attr.repositories]),
-            TMPL_bazelrc_append = ctx.attr.bazelrc_append,
-            TMPL_bazelrc_imports = ", ".join(["'%s': '%s'" % (ctx.attr.bazelrc_imports[f], _to_manifest_path(ctx, f.files.to_list()[0])) for f in ctx.attr.bazelrc_imports]),
-            TMPL_npm_packages = ", ".join(["'%s': '%s'" % (ctx.attr.npm_packages[f], _to_manifest_path(ctx, f.files.to_list()[0])) for f in ctx.attr.npm_packages]),
-            TMPL_resolutions = ", ".join(["'%s': '%s'" % (ctx.attr.resolutions[f], _to_manifest_path(ctx, f.files.to_list()[0])) for f in ctx.attr.resolutions]),
-            TMPL_check_npm_packages = ", ".join(["'%s'" % s for s in ctx.attr.check_npm_packages]),
-            TMPL_package_json_substitutions = ", ".join(["'%s': '%s'" % (f, ctx.attr.package_json_substitutions[f]) for f in ctx.attr.package_json_substitutions]),
-        ),
-    )
-
-    if is_windows(ctx):
-        launcher_content = """@echo off
-SETLOCAL ENABLEEXTENSIONS
-SETLOCAL ENABLEDELAYEDEXPANSION
-{rlocation_function}
-call :rlocation {TMPL_test_runner} TEST_RUNNER
-call :rlocation {TMPL_args} ARGS
-%TEST_RUNNER% %ARGS% %*
-        """.format(
-            TMPL_test_runner = _to_manifest_path(ctx, ctx.executable._test_runner),
-            TMPL_args = _to_manifest_path(ctx, config),
-            rlocation_function = BATCH_RLOCATION_FUNCTION,
-        )
-        executable = ctx.actions.declare_file(ctx.attr.name + ".bat")
-    else:
-        launcher_content = """#!/usr/bin/env bash
-# --- begin runfiles.bash initialization v2 ---
-# Copy-pasted from the Bazel Bash runfiles library v2.
-set -uo pipefail; f=build_bazel_rules_nodejs/third_party/github.com/bazelbuild/bazel/tools/bash/runfiles/runfiles.bash
-source "${{RUNFILES_DIR:-/dev/null}}/$f" 2>/dev/null || \
-  source "$(grep -sm1 "^$f " "${{RUNFILES_MANIFEST_FILE:-/dev/null}}" | cut -f2- -d' ')" 2>/dev/null || \
-  source "$0.runfiles/$f" 2>/dev/null || \
-  source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
-  source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
-  {{ echo>&2 "ERROR: cannot find $f"; exit 1; }}; f=; set -e
-# --- end runfiles.bash initialization v2 ---
-
-readonly TEST_RUNNER=$(rlocation "{TMPL_test_runner}")
-readonly ARGS=$(rlocation "{TMPL_args}")
-
-readonly COMMAND="${{TEST_RUNNER}} ${{ARGS}} $@"
-${{COMMAND}}
-        """.format(
-            TMPL_test_runner = _to_manifest_path(ctx, ctx.executable._test_runner),
-            TMPL_args = _to_manifest_path(ctx, config),
-        )
-        executable = ctx.actions.declare_file(ctx.attr.name + ".sh")
-
-    # Test executable is a shell script on Linux and macOS and a Batch script on Windows,
-    # which runs ctx.executable._test_runner and passes it the generated configuration file
-    ctx.actions.write(
-        output = executable,
-        is_executable = True,
-        content = launcher_content,
-    )
-
-    runfiles = [config] + ctx.files.bazel_binary + ctx.files.workspace_files + ctx.files.repositories + ctx.files.bazelrc_imports + ctx.files.npm_packages + ctx.files.resolutions
-
-    return [DefaultInfo(
-        runfiles = ctx.runfiles(files = runfiles).merge(ctx.attr._test_runner[DefaultInfo].data_runfiles),
-        executable = executable,
-    )]
-
-BAZEL_INTEGRATION_TEST_ATTRS = {
-    "bazel_binary": attr.label(
-        mandatory = True,
-        doc = """The bazel binary files to test against.
-
-It is assumed by the test runner that the bazel binary is found at label_workspace/bazel (wksp/bazel.exe on Windows)""",
-    ),
-    "bazel_commands": attr.string_list(
-        default = ["info", "test ..."],
-        doc = """The list of bazel commands to run. Defaults to `["info", "test ..."]`.
-
-Note that if a command contains a bare `--` argument, the --test_arg passed to Bazel will appear before it.
-""",
-    ),
-    "bazelrc_append": attr.string(
-        doc = """String to append to the .bazelrc file in the workspace-under-test.
-
-This can be used to pass bazel startup args that would otherwise not be possible to set. For example,
-```
-bazelrc_append = "startup --host_jvm_args=-Xms256m --host_jvm_args=-Xmx2g"
-```
-""",
-    ),
-    "bazelrc_imports": attr.label_keyed_string_dict(
-        allow_files = True,
-        doc = """A label keyed string dictionary of import replacements to make in the .bazelrc file of the workspace
-under test.
-
-This can be used to pass a common bazelrc file to all integration tests. For example,
-```
-bazelrc_imports = {
-    "//:common.bazelrc": "import %workspace%/../../common.bazelrc",
-},
-```""",
-    ),
-    "check_npm_packages": attr.string_list(
-        doc = """A list of npm packages that should be replaced in this test.
-
-This attribute checks that none of the npm packages lists is found in the workspace-under-test's
-package.json file unlinked to a generated npm package.
-
-This can be used to verify that all npm package artifacts that need to be tested against are indeed
-replaced in all integration tests. For example,
-```
-check_npm_packages = [
-    "@bazel/typescript",
-],
-```
-If an `npm_packages` replacement on any package listed is missed then the test will fail. Since listing all
-npm packages in `npm_packages` is expensive as any change will result in all integration tests re-running,
-this attribute allows a fine grained `npm_packages` per integration test with the added safety that none
-are missed for any one test.
-""",
-    ),
-    "npm_packages": attr.label_keyed_string_dict(
-        doc = """A label keyed string dictionary of npm package replacements to make in the workspace-under-test's
-package.json with generated npm package targets. The targets should be pkg_npm rules.
-
-For example,
-```
-npm_packages = {
-    "//packages/typescript:npm_package": "@bazel/typescript",
-}
-```""",
-    ),
-    "package_json_substitutions": attr.string_dict(
-        doc = """A string dictionary of other package.json package replacements to make.
-
-This can be used for integration testing against multiple external npm dependencies without duplicating code. For example,
-```
-[bazel_integration_test(
-    name = "e2e_typescript_%s" % tsc_version.replace(".", "_"),
-    ...
-    package_json_substitutions = {
-        "typescript": tsc_version,
-    },
-    ...
-) for tsc_version in [
-    "2.7.x",
-    "2.8.x",
-    "2.9.x",
-    "3.0.x",
-    "3.1.x",
-    "3.2.x",
-    "3.3.x",
-    "3.4.x",
-    "3.5.x",
-]]```""",
-    ),
-    "resolutions": attr.label_keyed_string_dict(
-        doc = """
-        Packages to put into package.json's resolutions object.
-        ATTENTION: This will not work with npm_install as resolution is not taken
-        into consideration when resolving modules by npm.
-        See: https://stackoverflow.com/questions/52416312/npm-equivalent-of-yarn-resolutions
-        https://github.com/npm/rfcs/blob/latest/accepted/0036-overrides.md
-        """,
-    ),
-    "repositories": attr.label_keyed_string_dict(
-        doc = """A label keyed string dictionary of repositories to replace in the workspace-under-test's WORKSPACE
-file with generated workspace archive targets. The targets should be pkg_tar rules.
-
-This can be used to test against .tar.gz release artifacts in integration tests. For example,
-```
-repositories = {
-    "//:release": "build_bazel_rules_nodejs",
-},
-```
-where `//:release` is the pkg_tar target that generates the `build_bazel_rules_nodejs` `.tar.gz` release artifact that
-is published on GitHub.
-""",
-        default = {
-            "//:release": "build_bazel_rules_nodejs",
-            "//:release-core": "rules_nodejs",
-        },
-    ),
-    "workspace_files": attr.label(
-        doc = """A filegroup of all files in the workspace-under-test necessary to run the test.""",
-    ),
-    "_test_runner": attr.label(
-        executable = True,
-        cfg = "exec",
-        default = Label("@build_bazel_rules_nodejs//internal/bazel_integration_test:test_runner"),
-    ),
-}
-
-bazel_integration_test = rule(
-    implementation = _bazel_integration_test,
-    doc = """Runs an integration test by running a specified version of bazel against an external workspace.
-
-Run with --define=BAZEL_INTEGRATION_TEST_DEBUG=1 to put the test in debug mode which will
-preserve the workspace under test root /tmp folder and exit without running the test. This
-allows you to change directory into the workspace under test root folder and run the integration
-test manually.
-""",
-    attrs = BAZEL_INTEGRATION_TEST_ATTRS,
-    test = True,
-)
-
-def rules_nodejs_integration_test(name, **kwargs):
-    "Set defaults for the bazel_integration_test common to our examples and e2e"
-    tags = kwargs.pop("tags", []) + [
-        # exclusive keyword will force the test to be run in the "exclusive" mode,
-        # ensuring that no other tests are running at the same time. Such tests
-        # will be executed in serial fashion after all build activity and non-exclusive
-        # tests have been completed. Remote execution is disabled for such tests
-        # because Bazel doesn't have control over what's running on a remote machine.
-        "exclusive",
-        # These test should run outside of the sandbox as they fail on bazelci otherwise
-        "local",
-    ]
-
-    # convert the npm packages into the tar output
-    npm_packages = kwargs.pop("npm_packages", {})
-    _tar_npm_packages = {}
-    for key in npm_packages:
-        _tar_npm_packages[key + ".tar"] = npm_packages[key]
-
-    # convert the npm packages into the tar output and add to resolutions
-    resolutions = kwargs.pop("resolutions", {})
-    _tar_package_resolutions = {}
-    for key in resolutions:
-        _tar_package_resolutions[key + ".tar"] = resolutions[key]
-
-    for bazel_version in SUPPORTED_BAZEL_VERSIONS:
-        bazel_integration_test(
-            name = "%s_%s" % (name, "bazel" + bazel_version) if bazel_version != BAZEL_VERSION else name,
-            check_npm_packages = NPM_PACKAGES,
-            bazel_binary = "@build_bazel_bazel_%s//:bazel_binary" % bazel_version.replace(".", "_"),
-            # some bazelrc imports are outside of the nested workspace so
-            # the test runner will handle these as special cases
-            bazelrc_imports = {
-                "//:common.bazelrc": "import %workspace%/../../common.bazelrc",
-            },
-            npm_packages = _tar_npm_packages,
-            resolutions = _tar_package_resolutions,
-            tags = tags,
-            **kwargs
-        )
diff --git a/internal/bazel_integration_test/test_runner.js b/internal/bazel_integration_test/test_runner.js
deleted file mode 100644
index bf97c00..0000000
--- a/internal/bazel_integration_test/test_runner.js
+++ /dev/null
@@ -1,417 +0,0 @@
-/**
- * @license
- * Copyright 2017 The Bazel Authors. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- *
- * You may obtain a copy of the License at
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Set TEST_MANIFEST to true and use `bazel run` to excersize the MANIFEST
-// file code path on Linux and OSX
-const TEST_MANIFEST = false;
-
-const spawnSync = require('child_process').spawnSync;
-const fs = require('fs');
-const path = require('path');
-const tmp = require('tmp');
-const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']);
-const DEBUG = !!process.env['BAZEL_INTEGRATION_TEST_DEBUG'];
-const VERBOSE_LOGS = !!process.env['VERBOSE_LOGS'];
-
-function log(...m) {
-  console.error('[test_runner.js]', ...m);
-}
-
-function log_verbose(...m) {
-  if (VERBOSE_LOGS) console.error('[test_runner.js]', ...m);
-}
-
-const config = require(process.argv[2]);
-log_verbose(`config: ${JSON.stringify(config, null, 2)}`);
-
-const testArgs = process.argv.slice(3);
-log_verbose(`testArgs: ${JSON.stringify(testArgs, null, 2)}`);
-
-/**
- * Helper function to debug log out the contents of a file.
- */
-function logFileContents(desc, contents) {
-  log_verbose(`${
-      desc}\n========================================================================================\n${
-      contents}\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n`);
-}
-
-/**
- * Create a new directory and any necessary subdirectories
- * if they do not exist.
- */
-function mkdirp(p) {
-  if (!fs.existsSync(p)) {
-    mkdirp(path.dirname(p));
-    fs.mkdirSync(p);
-  }
-}
-
-/**
- * Checks if a given path exists and is a file.
- * Note: fs.statSync() is used which resolves symlinks.
- */
-function isFile(p) {
-  return fs.existsSync(p) && fs.statSync(p).isFile();
-}
-
-/**
- * Utility function to copy all files in a folder recursively.
- */
-function copyFolderSync(from, to) {
-  fs.readdirSync(from).forEach(element => {
-    const src = path.posix.join(from, element);
-    const dest = path.posix.join(to, element);
-    if (fs.statSync(src).isFile()) {
-      mkdirp(path.dirname(dest));
-      fs.copyFileSync(src, dest);
-      log_verbose(`copying ${src} -> ${dest}`);
-    } else {
-      copyFolderSync(src, dest);
-    }
-  });
-}
-
-/**
- * Loads the Bazel MANIFEST file and returns its contents as an object
- * if is found. Returns undefined if there is no MANIFEST file.
- */
-function loadRunfilesManifest() {
-  // On Windows, Bazel sets RUNFILES_MANIFEST_ONLY=1 and RUNFILES_MANIFEST_FILE.
-  // On Linux and OSX RUNFILES_MANIFEST_FILE is not set and not available in the test
-  // sandbox but outside of the test sandbox (when executing with `bazel run` for example)
-  // we can look for the MANIFEST file and load it. This allows us to exercise the
-  // manifest loading code path on Linux and OSX.
-  const runfilesManifestFile = path.posix.join(process.env.RUNFILES_DIR, 'MANIFEST');
-  const isRunfilesManifestFile = isFile(runfilesManifestFile);
-  if (process.env.RUNFILES_MANIFEST_ONLY === '1' || (TEST_MANIFEST && isRunfilesManifestFile)) {
-    const manifestPath = process.env.RUNFILES_MANIFEST_FILE || runfilesManifestFile;
-    const runfilesManifest = Object.create(null);
-    const input = fs.readFileSync(manifestPath, {encoding: 'utf-8'});
-    for (const line of input.split('\n')) {
-      if (!line) continue;
-      const [runfilesPath, realPath] = line.split(' ');
-      runfilesManifest[runfilesPath] = realPath;
-    }
-    return runfilesManifest;
-  } else {
-    return undefined;
-  }
-}
-
-const RUNFILES_MANIFEST = loadRunfilesManifest();
-
-/**
- * Helper function to copy the workspace under test to tmp
- */
-function copyWorkspace(workspacePath) {
-  const to = tmp.dirSync({keep: DEBUG, unsafeCleanup: !DEBUG}).name;
-  if (RUNFILES_MANIFEST) {
-    const start = workspacePath.startsWith('../') ?
-        workspacePath.slice(3) :
-        `${process.env['TEST_WORKSPACE']}/${workspacePath}/`;
-    let copied = 0;
-    for (const key of Object.keys(RUNFILES_MANIFEST)) {
-      if (key.startsWith(start)) {
-        const element = key.slice(start.length);
-        const dest = path.posix.join(to, element);
-        mkdirp(path.dirname(dest));
-        log_verbose(`copying (MANIFEST) ${RUNFILES_MANIFEST[key]} -> ${dest}`);
-        fs.copyFileSync(RUNFILES_MANIFEST[key], dest);
-        ++copied;
-      }
-    }
-    if (!copied) {
-      throw new Error(`no workspace files found under path ${workspacePath}`)
-    }
-  } else {
-    if (!fs.existsSync(workspacePath)) {
-      throw new Error(`workspace under test not found at ${workspacePath}`);
-    }
-    copyFolderSync(workspacePath, to);
-  }
-  return to;
-}
-
-/**
- * Helper function to copy a runfiles npm package to tmp.
- * This is necessary so that the npm package folder that is symlinked
- * into node_modules in the workspace under test is writtable as
- * yarn & npm may attempt to write files there.
- */
-function copyNpmPackage(packagePath) {
-  const to = tmp.dirSync({keep: DEBUG, unsafeCleanup: !DEBUG}).name;
-  const from = RUNFILES_MANIFEST ? RUNFILES_MANIFEST[packagePath] :
-                                   path.posix.join(process.cwd(), '..', packagePath);
-  if (!isFile(from)) {
-    throw new Error(`npm package ${packagePath} not found at ${from}`);
-  }
-
-  const parsed = path.parse(from);
-  copyFolderSync(parsed.dir, to);
-  return path.join(to, parsed.base);
-}
-
-const workspacePath = config.workspaceRoot.startsWith('external/') ?
-    '..' + config.workspaceRoot.slice('external'.length) :
-    config.workspaceRoot;
-log_verbose(`copying workspace under test ${workspacePath} to tmp`);
-const workspaceRoot = copyWorkspace(workspacePath);
-
-// Handle .bazelrc import replacements
-const bazelrcImportsKeys = Object.keys(config.bazelrcImports);
-const bazelrcFile = path.posix.join(workspaceRoot, '.bazelrc');
-if (bazelrcImportsKeys.length && isFile(bazelrcFile)) {
-  let bazelrcContents = fs.readFileSync(bazelrcFile, {encoding: 'utf-8'});
-  for (const importKey of bazelrcImportsKeys) {
-    const importContents =
-        fs.readFileSync(runfiles.resolve(config.bazelrcImports[importKey]), {encoding: 'utf-8'});
-    bazelrcContents = bazelrcContents.replace(importKey, importContents);
-  }
-  fs.writeFileSync(bazelrcFile, bazelrcContents);
-  logFileContents('.bazelrc file with replacements:', bazelrcContents);
-}
-
-// Handle appending to .bazelrc
-if (config.bazelrcAppend) {
-  let bazelrcContents =
-      isFile(bazelrcFile) ? fs.readFileSync(bazelrcFile, {encoding: 'utf-8'}) : '';
-  bazelrcContents += '\n\n# Appended by bazel_integration_test\n';
-  bazelrcContents += config.bazelrcAppend;
-  fs.writeFileSync(bazelrcFile, bazelrcContents);
-  logFileContents('.bazelrc file after appending:', bazelrcContents);
-}
-
-// Handle WORKSPACE replacements
-{
-  const workspaceFile = path.posix.join(workspaceRoot, 'WORKSPACE');
-  let workspaceContents = fs.readFileSync(workspaceFile, {encoding: 'utf-8'});
-  // replace repositories
-  for (const repositoryKey of Object.keys(config.repositories)) {
-    const archiveFile = runfiles.resolve(config.repositories[repositoryKey]).replace(/\\/g, '/');
-
-    // Special case during build_bazel_rules_nodejs -> rules_nodejs migration.
-    // One of our dependencies is on antother package within our repo,
-    // so we need to override by installing our locally-built copy of it before calling the
-    // build_bazel_rules_nodejs_dependencies helper.
-    if (repositoryKey === "rules_nodejs") {
-      workspaceContents = workspaceContents.replace('build_bazel_rules_nodejs_dependencies()',
-      `http_archive(\n  name = "${repositoryKey}",\n  url="file:${archiveFile}"\n)\nbuild_bazel_rules_nodejs_dependencies()`);
-    }
-
-    const regex =
-        new RegExp(`(local_repository|http_archive|git_repository)\\(\\s*name\\s*\\=\\s*"${
-            repositoryKey}"[^)]+`);
-    const replacement =
-        `load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")\nhttp_archive(\n  name = "${
-            repositoryKey}",\n  url="file:${archiveFile}"\n`;
-
-    workspaceContents = workspaceContents.replace(regex, replacement)
-
-    if (!workspaceContents.includes(archiveFile)) {
-      console.error(
-          `bazel_integration_test: WORKSPACE replacement for repository ${repositoryKey} failed!`)
-      process.exit(1);
-    }
-  }
-  // We have to disable the frozen lockfile option for the tests it won't match with the version
-  // from the yarn.lock file.
-  workspaceContents =
-      workspaceContents.replace(/(yarn_lock[\s\S]+?,)/gm, 'frozen_lockfile = False,\n    $1')
-
-  // We have to use npm install in favour of npm ci as the package-lock.json would not match the
-  // replaced version
-  workspaceContents = workspaceContents.replace(
-      /(package_lock_json[\s\S]+?,)/gm, 'npm_command = "install",\n    $1')
-  fs.writeFileSync(workspaceFile, workspaceContents);
-  logFileContents('WORKSPACE file with replacements:', workspaceContents);
-}
-
-// Handle package.json replacements
-const packageJsonFile = path.posix.join(workspaceRoot, 'package.json');
-const packageJsonLockFile = path.posix.join(workspaceRoot, 'package-lock.json');
-const packageJsonLockContents = isFile(packageJsonLockFile) ?
-    JSON.parse(fs.readFileSync(packageJsonLockFile, {encoding: 'utf-8'})) :
-    undefined;
-
-if (isFile(packageJsonFile)) {
-  let packageJsonContents = fs.readFileSync(packageJsonFile, {encoding: 'utf-8'});
-
-  const npmPackageKeys = Object.keys(config.npmPackages);
-  if (npmPackageKeys.length) {
-    for (const packageJsonKey of npmPackageKeys) {
-      log_verbose(`copying npm package ${packageJsonKey} to tmp`);
-      const packagePath = copyNpmPackage(config.npmPackages[packageJsonKey]).replace(/\\/g, '/');
-      const regex = new RegExp(`\"${packageJsonKey}\"\\s*\:\\s*\"[^"]+`)
-      const replacement = `"${packageJsonKey}": "file:${packagePath}`;
-      packageJsonContents = packageJsonContents.replace(regex, replacement);
-      if (!packageJsonContents.includes(packagePath)) {
-        console.error(`bazel_integration_test: package.json replacement for npm package ${
-            packageJsonKey} failed!`)
-        process.exit(1);
-      }
-
-      if (packageJsonLockContents && packageJsonLockContents.packages && packageJsonKey) {
-        // keeping the entry results in a npm error, but removing it solves it
-        // TODO(matt): regenerate the entry here when I understand the filepaths :/
-        delete packageJsonLockContents.packages[`node_modules/${packageJsonKey}`];
-      }
-    }
-
-    fs.writeFileSync(packageJsonFile, packageJsonContents);
-
-    if (packageJsonLockContents) {
-      fs.writeFileSync(packageJsonLockFile, JSON.stringify(packageJsonLockContents, null, 2));
-    }
-  }
-
-
-  const resolutionKeys = Object.keys(config.resolutions);
-
-  if (resolutionKeys.length) {
-    const packageJson = JSON.parse(fs.readFileSync(packageJsonFile, {encoding: 'utf-8'}));
-    const resolutions = {};
-    for (const resolutionKey of resolutionKeys) {
-      const packagePath = copyNpmPackage(config.resolutions[resolutionKey]).replace(/\\/g, '/');
-      resolutions[`**/${resolutionKey}`] = `file:${packagePath}`;
-    }
-    packageJson.resolutions = resolutions;
-    fs.writeFileSync(packageJsonFile, JSON.stringify(packageJson, null, 2));
-  }
-
-  const packageJsonReplacementKeys = Object.keys(config.packageJsonRepacements);
-  if (packageJsonReplacementKeys.length) {
-    for (const packageJsonKey of packageJsonReplacementKeys) {
-      const regex = new RegExp(`\"${packageJsonKey}\"\\s*\:\\s*\"[^"]+`)
-      const replacement = `"${packageJsonKey}": "${config.packageJsonRepacements[packageJsonKey]}`;
-      packageJsonContents = packageJsonContents.replace(regex, replacement);
-      if (!packageJsonContents.includes(replacement)) {
-        console.error(`bazel_integration_test: package.json replacement for npm package ${
-            packageJsonKey} failed!`)
-        process.exit(1);
-      }
-    }
-  }
-
-  for (const packageJsonKey of config.checkNpmPackages) {
-    if (packageJsonContents.includes(`"${packageJsonKey}"`) &&
-        !packageJsonContents.includes(`"${packageJsonKey}": "file:`)) {
-      console.error(`bazel_integration_test: expected replacement of npm package ${
-          packageJsonKey} for locally generated npm package not found; add ${
-          packageJsonKey} to npm_packages attribute`);
-      process.exit(1);
-    }
-  }
-
-  logFileContents('package.json file with replacements:', packageJsonContents);
-}
-
-const isWindows = process.platform === 'win32';
-const bazelBinary =
-    runfiles.resolve(`${config.bazelBinaryWorkspace}/bazel${isWindows ? '.exe' : ''}`);
-
-if (DEBUG) {
-  log(`
-
-================================================================================
-Integration test put in DEBUG mode with BAZEL_INTEGRATION_TEST_DEBUG env set.
-
-    bazel binary: ${bazelBinary}
-    workspace under test root: ${workspaceRoot}
-
-Change directory to workspace under test root folder,
-
-    cd ${workspaceRoot}
-
-and run integration test manually.
-================================================================================
-`);
-  // Exit with error code so that BAZEL_INTEGRATION_TEST_DEBUG does not lead
-  // to a accidental passing test.
-  process.exit(1);
-}
-
-for (const bazelCommand of config.bazelCommands) {
-  const bazelArgs = bazelCommand.split(' ');
-  // look for `--` argument and insert testArgs before it
-  // if it exists, otherwise push to end of arguments
-  const doubleHyphenPos = bazelArgs.indexOf('--');
-  if (doubleHyphenPos !== -1) {
-    bazelArgs.splice(doubleHyphenPos, 0, ...testArgs);
-  } else {
-    bazelArgs.push(...testArgs);
-  }
-  // Cleanup the env that comes from the outer-bazel execution.
-  // The inner bazel process can be affected by these environment variables
-  // so we need to cleanup the environment to ensure the inner test is hermetic.
-  const env = {...process.env};
-  const keys = Object.keys(env);
-  for (const key of keys) {
-    if (key.startsWith('npm_')) {
-      delete env[key];
-    }
-  }
-  const BAZEL_KEYS = [
-    '_RLOCATION_ISABS_PATTERN',
-    'BASH_FUNC_is_absolute%%',
-    'BASH_FUNC_rlocation%%',
-    'BASH_FUNC_runfiles_export_envvars%%',
-    'BAZEL_NODE_MODULES_ROOTS',
-    'BAZEL_NODE_PATCH_REQUIRE',
-    'BAZEL_NODE_RUNFILES_HELPER',
-    'BAZEL_PATCH_ROOTS',
-    'BAZEL_TARGET',
-    'BAZEL_WORKSPACE',
-    'BAZELISK_SKIP_WRAPPER',
-    'BUILD_WORKING_DIRECTORY',
-    'BUILD_WORKSPACE_DIRECTORY',
-    'GTEST_TMP_DIR',
-    'INIT_CWD',
-    'JAVA_RUNFILES',
-    'OLDPWD',
-    'PYTHON_RUNFILES',
-    'RUN_UNDER_RUNFILES',
-    'RUNFILES_DIR',
-    'RUNFILES',
-    'TEST_BINARY',
-    'TEST_INFRASTRUCTURE_FAILURE_FILE',
-    'TEST_LOGSPLITTER_OUTPUT_FILE',
-    'TEST_PREMATURE_EXIT_FILE',
-    'TEST_SIZE',
-    'TEST_SRCDIR',
-    'TEST_TARGET',
-    'TEST_TIMEOUT',
-    'TEST_TMPDIR',
-    'TEST_UNDECLARED_OUTPUTS_ANNOTATIONS_DIR',
-    'TEST_UNDECLARED_OUTPUTS_DIR',
-    'TEST_UNUSED_RUNFILES_LOG_FILE',
-    'TEST_WARNINGS_OUTPUT_FILE',
-    'TEST_WORKSPACE',
-    'XML_OUTPUT_FILE',
-  ];
-  for (const key of BAZEL_KEYS) {
-    delete env[key];
-  }
-  env['PWD'] = workspaceRoot;
-  env['HOME'] = require('os').homedir();
-  log_verbose(JSON.stringify(env, null, 2));
-  log(`running 'bazel ${bazelArgs.join(' ')}' in ${workspaceRoot}`);
-  spawnedProcess = spawnSync(bazelBinary, bazelArgs, {env, cwd: workspaceRoot, stdio: 'inherit'});
-  if (spawnedProcess.status) {
-    process.exit(spawnedProcess.status);
-  }
-}
diff --git a/internal/tsc.bzl b/internal/tsc.bzl
index ab8165e..eb0b16f 100644
--- a/internal/tsc.bzl
+++ b/internal/tsc.bzl
@@ -1,6 +1,9 @@
+"""
+Basic wrapper around tsc to replace ts_project()
+"""
+
 load("@npm//typescript:index.bzl", _tsc = "tsc")
 
-# Basic wrapper around tsc to replace tsc()
 def tsc(name, srcs, deps = [], data = [], tsconfig = "//:tsconfig.json", **kwargs):
     outs = [s.replace(".ts", ".js") for s in srcs] + [s.replace(".ts", ".d.ts") for s in srcs]
 
diff --git a/package.json b/package.json
index 908368c..c2ae683 100644
--- a/package.json
+++ b/package.json
@@ -105,9 +105,9 @@
         "zone.js": "^0.11.4"
     },
     "scripts": {
-        "test": "bazel test --test_tag_filters=-e2e,-examples,-browser:firefox-local",
-        "test_windows": "bazel test --test_tag_filters=-e2e,-examples,-requires-runfiles,-fix-windows,-browser:firefox-local",
-        "test_windows_with_runfiles": "bazel test --enable_runfiles --test_tag_filters=-e2e,-examples,-fix-windows,-browser:firefox-local",
+        "test": "bazel test --test_tag_filters=-browser:firefox-local",
+        "test_windows": "bazel test --test_tag_filters=-requires-runfiles,-fix-windows,-browser:firefox-local",
+        "test_windows_with_runfiles": "bazel test --enable_runfiles --test_tag_filters=-fix-windows,-browser:firefox-local",
         "test_e2e": "bazel --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1280m test --test_tag_filters=e2e --local_ram_resources=792 --test_arg=--local_ram_resources=13288",
         "test_examples": "bazel --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1280m test --test_tag_filters=examples --local_ram_resources=792 --test_arg=--local_ram_resources=13288",
         "run_integration_test": "bazel --host_jvm_args=-Xms256m --host_jvm_args=-Xmx1280m run --local_ram_resources=792 --test_arg=--local_ram_resources=13288",
diff --git a/packages/index.bzl b/packages/index.bzl
index fc4821b..1ab4795 100644
--- a/packages/index.bzl
+++ b/packages/index.bzl
@@ -18,6 +18,5 @@
 NPM_PACKAGES = ["@bazel/%s" % pkg for pkg in [
     "create",
     "runfiles",
-    "typescript",
     "worker",
 ]]
diff --git a/packages/node-patches/BUILD.bazel b/packages/node-patches/BUILD.bazel
index b4886a5..04ff087 100644
--- a/packages/node-patches/BUILD.bazel
+++ b/packages/node-patches/BUILD.bazel
@@ -71,4 +71,4 @@
 copy_to_bin(
     name = "bundle",
     srcs = ["bundle.cjs"],
-)
\ No newline at end of file
+)
diff --git a/packages/worker/BUILD.bazel b/packages/worker/BUILD.bazel
index 680b21b..739682b 100644
--- a/packages/worker/BUILD.bazel
+++ b/packages/worker/BUILD.bazel
@@ -28,6 +28,18 @@
 
 tsc(
     name = "src",
+    outs = [
+        "index.d.ts",
+        "index.js",
+        "src/gc.d.ts",
+        "src/gc.js",
+        "src/size.d.ts",
+        "src/size.js",
+        "src/worker.d.ts",
+        "src/worker.js",
+        "src/worker_protocol.d.ts",
+        "src/worker_protocol.js",
+    ],
     args = [
         "-p",
         "$(execpath tsconfig.json)",
@@ -47,18 +59,6 @@
         "@npm//@types/node",
         "@npm//google-protobuf",
     ],
-    outs = [
-        "index.js",
-        "src/gc.js",
-        "src/size.js",
-        "src/worker.js",
-        "src/worker_protocol.js",
-        "index.d.ts",
-        "src/gc.d.ts",
-        "src/size.d.ts",
-        "src/worker.d.ts",
-        "src/worker_protocol.d.ts",
-    ],
 )
 
 js_library(
diff --git a/providers.bzl b/providers.bzl
index 93e76a0..9ddcee6 100644
--- a/providers.bzl
+++ b/providers.bzl
@@ -67,3 +67,8 @@
 node_modules_aspect = _node_modules_aspect
 NodeRuntimeDepsInfo = _NodeRuntimeDepsInfo
 run_node = _run_node
+
+# Export NpmPackageInfo for pre-3.0 legacy support in downstream rule sets
+# such as rules_docker
+# TODO(6.0): remove NpmPackageInfo from rules_docker & then remove it here
+NpmPackageInfo = _ExternalNpmPackageInfo
diff --git a/repositories.bzl b/repositories.bzl
index 3deb434..0701886 100644
--- a/repositories.bzl
+++ b/repositories.bzl
@@ -48,18 +48,6 @@
 
     build_bazel_rules_nodejs_dependencies()
 
-    # Dependencies for generating documentation
-    maybe(
-        http_archive,
-        name = "io_bazel_rules_sass",
-        sha256 = "c6249cf64dffbc81312191800b0984b5197d77864c13d0dc4d469937cc3f8108",
-        strip_prefix = "rules_sass-1.32.11",
-        urls = [
-            "https://github.com/bazelbuild/rules_sass/archive/1.32.11.zip",
-            "https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.32.11.zip",
-        ],
-    )
-
     maybe(
         http_archive,
         name = "com_google_protobuf",
@@ -103,16 +91,6 @@
 
     maybe(
         http_archive,
-        name = "build_bazel_integration_testing",
-        urls = [
-            "https://github.com/bazelbuild/bazel-integration-testing/archive/165440b2dbda885f8d1ccb8d0f417e6cf8c54f17.zip",
-        ],
-        strip_prefix = "bazel-integration-testing-165440b2dbda885f8d1ccb8d0f417e6cf8c54f17",
-        sha256 = "2401b1369ef44cc42f91dc94443ef491208dbd06da1e1e10b702d8c189f098e3",
-    )
-
-    maybe(
-        http_archive,
         name = "rules_codeowners",
         strip_prefix = "rules_codeowners-27fe3bbe6e5b0df196e360fc9e081835f22a10be",
         sha256 = "0aada1d5df72cb13161a78dff965e02575930f3ea9550e778f6fa45f3f4e2537",
@@ -130,10 +108,3 @@
         ],
         sha256 = "6b5969a7acd7b60c02f816773b06fcf32fbe8ba0c7919ccdc2df4f8fb923804a",
     )
-
-    maybe(
-        http_archive,
-        name = "io_bazel_rules_webtesting",
-        sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
-        urls = ["https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz"],
-    )