├── .aspect ├── bazelrc │ ├── .gitignore │ ├── BUILD.bazel │ ├── bazel7.bazelrc │ ├── ci.bazelrc │ ├── convenience.bazelrc │ ├── correctness.bazelrc │ ├── debug.bazelrc │ ├── javascript.bazelrc │ └── performance.bazelrc ├── cli │ └── config.yaml └── workflows │ ├── bazelrc │ └── config.yaml ├── .bazelignore ├── .bazeliskrc ├── .bazelrc ├── .bazelversion ├── .bcr ├── README.md ├── metadata.template.json ├── presubmit.yml └── source.template.json ├── .gitattributes ├── .github └── workflows │ ├── BUILD.bazel │ ├── bazel6.bazelrc │ ├── bazel7.bazelrc │ ├── buildifier.yaml │ ├── ci.bazelrc │ ├── ci.yaml │ ├── publish.yaml │ ├── release.yml │ └── release_prep.sh ├── .gitignore ├── .npmrc ├── .pre-commit-config.yaml ├── .prettierignore ├── BUILD.bazel ├── CONTRIBUTING.md ├── LICENSE ├── MODULE.bazel ├── README.md ├── WORKSPACE ├── bazel └── platforms │ └── BUILD.bazel ├── docs ├── BUILD.bazel ├── jest_test.md └── troubleshooting.md ├── e2e ├── case12.sh ├── case4.sh ├── case4 │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── BUILD.bazel │ ├── WORKSPACE.bazel │ ├── index.test.js │ ├── jest.config.js │ ├── package.json │ ├── pnpm-lock.yaml │ └── pnpm-workspace.yaml ├── case6.sh ├── case7.sh ├── npm_packages │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── BUILD.bazel │ ├── MODULE.bazel │ ├── WORKSPACE.bazel │ ├── WORKSPACE.bzlmod │ ├── jest.config.cjs.js │ ├── jest.config.esm.js │ ├── package.json │ ├── packages │ │ ├── lib │ │ │ ├── BUILD.bazel │ │ │ ├── babel.config.json │ │ │ ├── index.js │ │ │ ├── lib.spec.js │ │ │ └── package.json │ │ └── wrapper-lib │ │ │ ├── BUILD.bazel │ │ │ ├── babel.config.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── subdir │ │ │ ├── BUILD.bazel │ │ │ └── index.js │ │ │ └── wrapper.spec.js │ ├── pnpm-lock.yaml │ ├── pnpm-workspace.yaml │ └── tools │ │ ├── BUILD.bazel │ │ ├── jest-env.js │ │ └── jest-env.mjs ├── smoke │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── BUILD.bazel │ ├── MODULE.bazel │ ├── README.md │ ├── WORKSPACE.bazel │ ├── WORKSPACE.bzlmod │ ├── index.test.js │ ├── jest.config.js │ ├── package.json │ ├── pnpm-lock.yaml │ └── pnpm-workspace.yaml ├── swc │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── .swcrc │ ├── BUILD.bazel │ ├── MODULE.bazel │ ├── README.md │ ├── WORKSPACE.bazel │ ├── WORKSPACE.bzlmod │ ├── jest-swc-workaround.js │ ├── jest.config.js │ ├── lib │ │ ├── BUILD.bazel │ │ ├── mocked-cjs.test.js │ │ ├── mocked-esm.test.js │ │ ├── service.js │ │ └── service.test.js │ ├── package.json │ ├── pnpm-lock.yaml │ └── pnpm-workspace.yaml └── update_snapshots_test.sh ├── example ├── (simple_group) │ ├── BUILD.bazel │ ├── index.js │ ├── index.test.js │ ├── jest.config.cjs │ ├── jest.config.js │ ├── jest.config.json │ └── jest.config.mjs ├── BUILD.bazel ├── custom_reporters │ ├── BUILD.bazel │ ├── index.js │ ├── index.test.js │ └── jest.config.js ├── custom_sequencer │ ├── BUILD.bazel │ ├── index.js │ ├── index.test.js │ ├── index_2.test.js │ ├── jest.config.js │ └── sequencer.js ├── custom_snapshot_resolver │ ├── .babelrc.js │ ├── BUILD.bazel │ ├── __my_snapshots__ │ │ ├── greetings.test.js.snap │ │ └── link.test.js.snap │ ├── greetings.js │ ├── greetings.test.js │ ├── jest.config.js │ ├── link.js │ ├── link.test.js │ └── snapshot_resolver.js ├── custom_snapshot_resolver_files │ ├── .babelrc.js │ ├── BUILD.bazel │ ├── greetings.js │ ├── greetings.test.js │ ├── greetings.test.js.snap │ ├── jest.config.js │ ├── link.js │ ├── link.test.js │ ├── link.test.js.snap │ └── snapshot_resolver.js ├── esm │ ├── BUILD.bazel │ ├── index.mjs │ ├── index.test.mjs │ └── jest.config.mjs ├── esm_transform │ ├── BUILD.bazel │ ├── babel.config.json │ ├── index.js │ ├── index.test.js │ ├── jest.config.js │ └── package.json ├── esm_type_module │ ├── BUILD.bazel │ ├── index.js │ ├── index.test.js │ ├── jest.config.mjs │ └── package.json ├── multiple_snapshots │ ├── .babelrc.js │ ├── BUILD.bazel │ ├── greetings │ │ ├── __snapshots__ │ │ │ └── greetings.test.js.snap │ │ ├── greetings.js │ │ └── greetings.test.js │ ├── jest.config.js │ └── link │ │ ├── __snapshots__ │ │ └── link.test.js.snap │ │ ├── link.js │ │ └── link.test.js ├── package.json ├── sharding │ ├── BUILD.bazel │ ├── index.js │ ├── index.test.js │ ├── index_2.test.js │ └── jest.config.js ├── simple │ ├── BUILD.bazel │ ├── index.js │ ├── index.test.js │ ├── jest.config.cjs │ ├── jest.config.js │ ├── jest.config.json │ └── jest.config.mjs ├── snapshots │ ├── .babelrc.js │ ├── BUILD.bazel │ ├── __snapshots__ │ │ ├── greetings.test.js.snap │ │ └── link.test.js.snap │ ├── greetings.js │ ├── greetings.test.js │ ├── jest.config.js │ ├── link.js │ └── link.test.js └── snapshots_files │ ├── .babelrc.js │ ├── BUILD.bazel │ ├── __snapshots__ │ ├── greetings.test.js.snap │ └── link.test.js.snap │ ├── greetings.js │ ├── greetings.test.js │ ├── jest.config.js │ ├── link.js │ └── link.test.js ├── internal_deps.bzl ├── jest ├── BUILD.bazel ├── defs.bzl ├── dependencies.bzl ├── private │ ├── BUILD.bazel │ ├── bazel_haste_map.cjs │ ├── bazel_sequencer.cjs │ ├── bazel_snapshot_reporter.cjs │ ├── bazel_snapshot_resolver.cjs │ ├── jest_config_template.mjs │ ├── jest_test.bzl │ ├── maybe.bzl │ └── merger.sh └── tests │ ├── BUILD.bazel │ ├── case1.jest.config.js │ ├── case1.test.js │ ├── case10 │ ├── BUILD.bazel │ ├── __snapshots__ │ │ └── case10.test.js.snap │ ├── case10.config-init.js │ ├── case10.jest.config.js │ ├── case10.setup.js │ └── case10.test.js │ ├── case10a │ ├── BUILD.bazel │ ├── __snapshots__ │ │ └── case10a.test.js.snap │ ├── case10a.config-init.js │ ├── case10a.jest.config.js │ ├── case10a.setup.js │ └── case10a.test.js │ ├── case11 │ ├── case11.test.js │ ├── case11a.jest.config.js │ └── case11b.jest.config.js │ ├── case12.index.js │ ├── case12.test.js │ ├── case13.jest.config.js │ ├── case13.test.js │ ├── case14-lib.foo.js │ ├── case14.jest.config.js │ ├── case14.test.js │ ├── case2 │ ├── case2.jest.config.js │ └── case2.test.js │ ├── case3.jest.config.js │ ├── case3.test.js │ ├── case5.jest.config.js │ ├── case5.test.js │ ├── case6.index.js │ ├── case6.jest.config.js │ ├── case6.test.js │ ├── case7.index.js │ ├── case7.test.js │ ├── case8.test.js │ ├── case9.index.mjs │ ├── case9.jest.config.js │ ├── case9.test.mjs │ ├── configs │ ├── BUILD.bazel │ └── basic.jest.config.js │ ├── env_inherit │ ├── BUILD.bazel │ └── env_inherit.test.js │ ├── fixed_args │ ├── BUILD.bazel │ └── fixed_args.test.js │ ├── package.json │ └── package_json_module │ ├── BUILD.bazel │ ├── README.md │ ├── __snapshots__ │ ├── greetings.test.js.snap │ └── link.test.js.snap │ ├── babel.config.cjs │ ├── greetings.js │ ├── greetings.test.js │ ├── jest.config.js │ ├── link.js │ ├── link.test.js │ ├── package.json │ └── simple.test.js ├── package.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── renovate.json ├── test_case8.jest.config.js └── tools └── BUILD.bazel /.aspect/bazelrc/.gitignore: -------------------------------------------------------------------------------- 1 | user.bazelrc -------------------------------------------------------------------------------- /.aspect/bazelrc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | "Aspect bazelrc presets; see https://docs.aspect.build/guides/bazelrc" 2 | 3 | load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets") 4 | 5 | write_aspect_bazelrc_presets( 6 | name = "update_aspect_bazelrc_presets", 7 | presets = [ 8 | "ci", 9 | "convenience", 10 | "correctness", 11 | "debug", 12 | "javascript", 13 | "performance", 14 | ], 15 | ) 16 | -------------------------------------------------------------------------------- /.aspect/bazelrc/bazel7.bazelrc: -------------------------------------------------------------------------------- 1 | ../../.github/workflows/bazel7.bazelrc -------------------------------------------------------------------------------- /.aspect/bazelrc/ci.bazelrc: -------------------------------------------------------------------------------- 1 | # Set this flag to enable re-tries of failed tests on CI. 2 | # When any test target fails, try one or more times. This applies regardless of whether the "flaky" 3 | # tag appears on the target definition. 4 | # This is a tradeoff: legitimately failing tests will take longer to report, 5 | # but we can paper over flaky tests that pass most of the time. 6 | # The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires 7 | # the buildcop to make frequent code edits. 8 | # Not recommended for local builds so that the flakiness is observed during development and thus 9 | # is more likely to get fixed. 10 | # Note that when passing after the first attempt, Bazel will give a special "FLAKY" status. 11 | # Docs: https://bazel.build/docs/user-manual#flaky-test-attempts 12 | test --flaky_test_attempts=2 13 | 14 | # Announce all announces command options read from the bazelrc file(s) when starting up at the 15 | # beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc 16 | # settings are being applied on each run. 17 | # Docs: https://bazel.build/docs/user-manual#announce-rc 18 | build --announce_rc 19 | 20 | # Add a timestamp to each message generated by Bazel specifying the time at which the message was 21 | # displayed. 22 | # Docs: https://bazel.build/docs/user-manual#show-timestamps 23 | build --show_timestamps 24 | 25 | # Only show progress every 60 seconds on CI. 26 | # We want to find a compromise between printing often enough to show that the build isn't stuck, 27 | # but not so often that we produce a long log file that requires a lot of scrolling. 28 | # https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit 29 | build --show_progress_rate_limit=60 30 | 31 | # Use cursor controls in screen output. 32 | # Docs: https://bazel.build/docs/user-manual#curses 33 | build --curses=yes 34 | 35 | # Use colors to highlight output on the screen. Set to `no` if your CI does not display colors. 36 | # Docs: https://bazel.build/docs/user-manual#color 37 | build --color=yes 38 | 39 | # The terminal width in columns. Configure this to override the default value based on what your CI system renders. 40 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151 41 | build --terminal_columns=143 42 | 43 | ###################################### 44 | # Generic remote cache configuration # 45 | ###################################### 46 | 47 | # Only download remote outputs of top level targets to the local machine. 48 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel 49 | build --remote_download_toplevel 50 | 51 | # The maximum amount of time to wait for remote execution and cache calls. 52 | # https://bazel.build/reference/command-line-reference#flag--remote_timeout 53 | build --remote_timeout=3600 54 | 55 | # Upload locally executed action results to the remote cache. 56 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results 57 | build --remote_upload_local_results 58 | 59 | # Fall back to standalone local execution strategy if remote execution fails. If the grpc remote 60 | # cache connection fails, it will fail the build, add this so it falls back to the local cache. 61 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback 62 | build --remote_local_fallback 63 | 64 | # Fixes builds hanging on CI that get the TCP connection closed without sending RST packets. 65 | # Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time 66 | build --grpc_keepalive_time=30s 67 | -------------------------------------------------------------------------------- /.aspect/bazelrc/convenience.bazelrc: -------------------------------------------------------------------------------- 1 | # Attempt to build & test every target whose prerequisites were successfully built. 2 | # Docs: https://bazel.build/docs/user-manual#keep-going 3 | build --keep_going 4 | 5 | # Output test errors to stderr so users don't have to `cat` or open test failure log files when test 6 | # fail. This makes the log noiser in exchange for reducing the time-to-feedback on test failures for 7 | # users. 8 | # Docs: https://bazel.build/docs/user-manual#test-output 9 | test --test_output=errors 10 | 11 | # Show the output files created by builds that requested more than one target. This helps users 12 | # locate the build outputs in more cases 13 | # Docs: https://bazel.build/docs/user-manual#show-result 14 | build --show_result=20 15 | 16 | # Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is 17 | # Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS 18 | # identifiers are `linux`, `macos`, `windows`, `freebsd`, and `openbsd`. Enabling this flag is 19 | # equivalent to using `--config=linux` on Linux, `--config=windows` on Windows, etc. 20 | # Docs: https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config 21 | common --enable_platform_specific_config 22 | 23 | # Output a heap dump if an OOM is thrown during a Bazel invocation 24 | # (including OOMs due to `--experimental_oom_more_eagerly_threshold`). 25 | # The dump will be written to `/.heapdump.hprof`. 26 | # You may need to configure CI to capture this artifact and upload for later use. 27 | # Docs: https://bazel.build/reference/command-line-reference#flag--heap_dump_on_oom 28 | common --heap_dump_on_oom 29 | -------------------------------------------------------------------------------- /.aspect/bazelrc/correctness.bazelrc: -------------------------------------------------------------------------------- 1 | # Do not upload locally executed action results to the remote cache. 2 | # This should be the default for local builds so local builds cannot poison the remote cache. 3 | # It should be flipped to `--remote_upload_local_results` on CI 4 | # by using `--bazelrc=.aspect/bazelrc/ci.bazelrc`. 5 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results 6 | build --noremote_upload_local_results 7 | 8 | # Don't allow network access for build actions in the sandbox. 9 | # Ensures that you don't accidentally make non-hermetic actions/tests which depend on remote 10 | # services. 11 | # Developers should tag targets with `tags=["requires-network"]` to opt-out of the enforcement. 12 | # Docs: https://bazel.build/reference/command-line-reference#flag--sandbox_default_allow_network 13 | build --sandbox_default_allow_network=false 14 | 15 | # Warn if a test's timeout is significantly longer than the test's actual execution time. 16 | # Bazel's default for test_timeout is medium (5 min), but most tests should instead be short (1 min). 17 | # While a test's timeout should be set such that it is not flaky, a test that has a highly 18 | # over-generous timeout can hide real problems that crop up unexpectedly. 19 | # For instance, a test that normally executes in a minute or two should not have a timeout of 20 | # ETERNAL or LONG as these are much, much too generous. 21 | # Docs: https://bazel.build/docs/user-manual#test-verbose-timeout-warnings 22 | test --test_verbose_timeout_warnings 23 | 24 | # Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server 25 | # notices when a directory changes, if you have a directory listed in the srcs of some target. 26 | # Recommended when using 27 | # [copy_directory](https://github.com/aspect-build/bazel-lib/blob/main/docs/copy_directory.md) and 28 | # [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories 29 | # inputs to copy_directory actions. 30 | # Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args 31 | startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1 32 | 33 | # Allow exclusive tests to run in the sandbox. Fixes a bug where Bazel doesn't enable sandboxing for 34 | # tests with `tags=["exclusive"]`. 35 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_exclusive_test_sandboxed 36 | test --incompatible_exclusive_test_sandboxed 37 | 38 | # Use a static value for `PATH` and does not inherit `LD_LIBRARY_PATH`. Doesn't let environment 39 | # variables like `PATH` sneak into the build, which can cause massive cache misses when they change. 40 | # Use `--action_env=ENV_VARIABLE` if you want to inherit specific environment variables from the 41 | # client, but note that doing so can prevent cross-user caching if a shared cache is used. 42 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env 43 | build --incompatible_strict_action_env 44 | 45 | # Propagate tags from a target declaration to the actions' execution requirements. 46 | # Ensures that tags applied in your BUILD file, like `tags=["no-remote"]` 47 | # get propagated to actions created by the rule. 48 | # Without this option, you rely on rules authors to manually check the tags you passed 49 | # and apply relevant ones to the actions they create. 50 | # See https://github.com/bazelbuild/bazel/issues/8830 for details. 51 | # Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation 52 | build --experimental_allow_tags_propagation 53 | fetch --experimental_allow_tags_propagation 54 | query --experimental_allow_tags_propagation 55 | 56 | # Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong 57 | # default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python 58 | # package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the 59 | # default), it is treated as false if and only if this flag is set. See 60 | # https://github.com/bazelbuild/bazel/issues/10076. 61 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py 62 | build --incompatible_default_to_explicit_init_py 63 | 64 | # Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when 65 | # attempting to use `glob()` to match files in a subdirectory that is opaque to the current package 66 | # because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195. 67 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob 68 | common --incompatible_disallow_empty_glob 69 | 70 | # Always download coverage files for tests from the remote cache. By default, coverage files are not 71 | # downloaded on test result cahce hits when --remote_download_minimal is enabled, making it impossible 72 | # to generate a full coverage report. 73 | # Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs 74 | # detching remote cache results 75 | test --experimental_fetch_all_coverage_outputs 76 | -------------------------------------------------------------------------------- /.aspect/bazelrc/debug.bazelrc: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # Use `bazel test --config=debug` to enable these settings # 3 | ############################################################ 4 | 5 | # Stream stdout/stderr output from each test in real-time. 6 | # Docs: https://bazel.build/docs/user-manual#test-output 7 | test:debug --test_output=streamed 8 | 9 | # Run one test at a time. 10 | # Docs: https://bazel.build/reference/command-line-reference#flag--test_strategy 11 | test:debug --test_strategy=exclusive 12 | 13 | # Prevent long running tests from timing out. 14 | # Docs: https://bazel.build/docs/user-manual#test-timeout 15 | test:debug --test_timeout=9999 16 | 17 | # Always run tests even if they have cached results. 18 | # Docs: https://bazel.build/docs/user-manual#cache-test-results 19 | test:debug --nocache_test_results 20 | -------------------------------------------------------------------------------- /.aspect/bazelrc/javascript.bazelrc: -------------------------------------------------------------------------------- 1 | # Aspect recommended Bazel flags when using Aspect's JavaScript rules: https://github.com/aspect-build/rules_js 2 | # Docs for Node.js flags: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options 3 | 4 | # Support for debugging Node.js tests. Use bazel run with `--config=debug` to turn on the NodeJS 5 | # inspector agent. The node process will break before user code starts and wait for the debugger to 6 | # connect. Pass the --inspect-brk option to all tests which enables the node inspector agent. See 7 | # https://nodejs.org/de/docs/guides/debugging-getting-started/#command-line-options for more 8 | # details. 9 | # Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options 10 | run:debug -- --node_options=--inspect-brk 11 | test:debug --test_env=NODE_OPTIONS=--inspect-brk 12 | -------------------------------------------------------------------------------- /.aspect/bazelrc/performance.bazelrc: -------------------------------------------------------------------------------- 1 | # Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache. 2 | # If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where 3 | # Bazel doesn't write to the local disk cache as it treats as a remote cache. 4 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk 5 | build --incompatible_remote_results_ignore_disk 6 | 7 | # Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. 8 | # Save time on Sandbox creation and deletion when many of the same kind of action run during the 9 | # build. 10 | # No longer experimental in Bazel 6: https://github.com/bazelbuild/bazel/commit/c1a95501a5611878e5cc43a3cc531f2b9e47835b 11 | # Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories 12 | build --experimental_reuse_sandbox_directories 13 | 14 | # Do not build runfiles symlink forests for external repositories under 15 | # `.runfiles/wsname/external/repo` (in addition to `.runfiles/repo`). This reduces runfiles & 16 | # sandbox creation times & prevents accidentally depending on this feature which may flip to off by 17 | # default in the future. Note, some rules may fail under this flag, please file issues with the rule 18 | # author. 19 | # Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles 20 | build --nolegacy_external_runfiles 21 | -------------------------------------------------------------------------------- /.aspect/cli/config.yaml: -------------------------------------------------------------------------------- 1 | configure: 2 | languages: 3 | javascript: true 4 | go: true 5 | kotlin: false 6 | protobuf: true 7 | -------------------------------------------------------------------------------- /.aspect/workflows/bazelrc: -------------------------------------------------------------------------------- 1 | # build without the bytes 2 | common --remote_download_outputs=minimal 3 | 4 | # //jest/tests/fixed_args:fixed_args_test sh_test (via assert_contains) broken under coverage with 5 | # --nobuild_runfile_links due to https://github.com/bazelbuild/bazel/issues/20577. Failure on CI is: 6 | # /mnt/ephemeral/output/__main__/sandbox/linux-sandbox/845/execroot/_main/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/bazel_tools~remote_coverage_tools_extension~remote_coverage_tools/Main: Cannot locate runfiles directory. (Set $JAVA_RUNFILES to inhibit searching.) 7 | # (https://buildkite.com/aspect-build/rules-jest/builds/263#018d4c5b-da79-4dc2-a1dd-7e3e8af35d56) 8 | # TODO: reeable this flag when https://github.com/bazelbuild/bazel/issues/20577 is resolved. 9 | # common --nobuild_runfile_links 10 | 11 | # coverage 12 | common --experimental_fetch_all_coverage_outputs 13 | # https://github.com/bazelbuild/bazel/blob/e3e4d61b2c2b241d0426ea20143b8a07d6fadfcd/tools/test/collect_cc_coverage.sh#L30 14 | common --test_env=COVERAGE_GCOV_PATH=/usr/bin/gcov 15 | 16 | # remote execution 17 | common:rbe --extra_execution_platforms=//bazel/platforms:x86_64_linux_remote 18 | common:rbe --host_platform=//bazel/platforms:x86_64_linux_remote 19 | common:rbe --remote_executor=unix:///mnt/ephemeral/buildbarn/.cache/bb_clientd/grpc 20 | common:rbe --genrule_strategy=remote,local 21 | common:rbe --jobs=32 22 | common:rbe --remote_timeout=3600 23 | -------------------------------------------------------------------------------- /.aspect/workflows/config.yaml: -------------------------------------------------------------------------------- 1 | # See https://docs.aspect.build/workflows/configuration 2 | tasks: 3 | - format: 4 | queue: aspect-medium 5 | - buildifier: 6 | queue: aspect-medium 7 | - test: 8 | coverage: true 9 | - finalization: 10 | queue: aspect-small 11 | notifications: 12 | github: {} 13 | -------------------------------------------------------------------------------- /.bazelignore: -------------------------------------------------------------------------------- 1 | e2e/ 2 | node_modules 3 | example/node_modules 4 | jest/tests/node_modules 5 | -------------------------------------------------------------------------------- /.bazeliskrc: -------------------------------------------------------------------------------- 1 | BAZELISK_BASE_URL=https://static.aspect.build/aspect 2 | USE_BAZEL_VERSION=aspect/2024.51.11 -------------------------------------------------------------------------------- /.bazelrc: -------------------------------------------------------------------------------- 1 | # Import Aspect bazelrc presets 2 | try-import %workspace%/.aspect/bazelrc/bazel7.bazelrc 3 | import %workspace%/.aspect/bazelrc/convenience.bazelrc 4 | import %workspace%/.aspect/bazelrc/correctness.bazelrc 5 | import %workspace%/.aspect/bazelrc/debug.bazelrc 6 | import %workspace%/.aspect/bazelrc/javascript.bazelrc 7 | import %workspace%/.aspect/bazelrc/performance.bazelrc 8 | 9 | ### YOUR PROJECT SPECIFIC OPTIONS GO HERE ### 10 | 11 | # //example/custom_sequencer:case2_test target sets `auto_configure_test_sequencer = False` which 12 | # causes the following error on Bazel 7 unless --noincompatible_check_sharding_support is 13 | # ERROR: Testing //example/custom_sequencer:case2_test (shard 2 of 2) failed: Sharding requested, 14 | # but the test runner did not advertise support for it by touching TEST_SHARD_STATUS_FILE. Either 15 | # remove the 'shard_count' attribute, use a test runner that supports sharding or temporarily disable 16 | # this check via --noincompatible_check_sharding_support. 17 | test --noincompatible_check_sharding_support 18 | 19 | # Don’t want to push a rules author to update their deps if not needed. 20 | # https://bazel.build/reference/command-line-reference#flag--check_direct_dependencies 21 | # https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0 22 | common --check_direct_dependencies=off 23 | 24 | # Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`. 25 | # This file should appear in `.gitignore` so that settings are not shared with team members. This 26 | # should be last statement in this config so the user configuration is able to overwrite flags from 27 | # this file. See https://bazel.build/configure/best-practices#bazelrc-file. 28 | try-import %workspace%/.aspect/bazelrc/user.bazelrc 29 | -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 7.1.1 2 | -------------------------------------------------------------------------------- /.bcr/README.md: -------------------------------------------------------------------------------- 1 | # Bazel Central Registry 2 | 3 | When the ruleset is released, we want it to be published to the 4 | Bazel Central Registry automatically: 5 | 6 | 7 | This folder contains configuration files to automate the publish step. 8 | See 9 | for authoritative documentation about these files. 10 | -------------------------------------------------------------------------------- /.bcr/metadata.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "homepage": "https://docs.aspect.build/rules/aspect_rules_jest", 3 | "maintainers": [ 4 | { 5 | "name": "Alex Eagle", 6 | "email": "alex@aspect.build", 7 | "github": "alexeagle" 8 | }, 9 | { 10 | "name": "Greg Magolan", 11 | "email": "greg@aspect.build", 12 | "github": "gregmagolan" 13 | }, 14 | { 15 | "name": "Jason Bedard", 16 | "email": "jason@aspect.build", 17 | "github": "jbedard" 18 | } 19 | ], 20 | "repository": ["github:aspect-build/rules_jest"], 21 | "versions": [], 22 | "yanked_versions": {} 23 | } 24 | -------------------------------------------------------------------------------- /.bcr/presubmit.yml: -------------------------------------------------------------------------------- 1 | bcr_test_module: 2 | module_path: "e2e/smoke" 3 | matrix: 4 | bazel: ['7.x', '6.x'] 5 | platform: ["debian10", "macos", "ubuntu2004", "windows"] 6 | tasks: 7 | run_tests: 8 | name: "Run test module" 9 | bazel: ${{ bazel }} 10 | platform: ${{ platform }} 11 | test_targets: 12 | - "//..." 13 | -------------------------------------------------------------------------------- /.bcr/source.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "integrity": "**leave this alone**", 3 | "strip_prefix": "{REPO}-{VERSION}", 4 | "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_jest-{TAG}.tar.gz" 5 | } 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | docs/*.md linguist-generated=true 2 | docs/troubleshooting.md linguist-generated=false 3 | pnpm-lock.yaml linguist-generated=true 4 | -------------------------------------------------------------------------------- /.github/workflows/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets") 2 | 3 | write_aspect_bazelrc_presets( 4 | name = "update_aspect_bazelrc_presets", 5 | presets = [ 6 | "bazel6", 7 | "bazel7", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /.github/workflows/bazel6.bazelrc: -------------------------------------------------------------------------------- 1 | # Speed up all builds by not checking if external repository files have been modified. 2 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244 3 | build --noexperimental_check_external_repository_files 4 | fetch --noexperimental_check_external_repository_files 5 | query --noexperimental_check_external_repository_files 6 | 7 | # Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. 8 | # Save time on Sandbox creation and deletion when many of the same kind of action run during the 9 | # build. 10 | # Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories 11 | build --reuse_sandbox_directories 12 | 13 | # Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel 14 | # See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/ 15 | build --noexperimental_action_cache_store_output_metadata 16 | 17 | # Speed up all builds by not checking if output files have been modified. Lets you make changes to 18 | # the output tree without triggering a build for local debugging. For example, you can modify 19 | # [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree 20 | # when local debugging. 21 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185 22 | # NB: This flag is in bazel6.bazelrc as when used in Bazel 7 is has been observed to break 23 | # "build without the bytes" --remote_download_outputs=toplevel. See https://github.com/aspect-build/bazel-lib/pull/711 24 | # for more info. 25 | build --noexperimental_check_output_files 26 | fetch --noexperimental_check_output_files 27 | query --noexperimental_check_output_files 28 | -------------------------------------------------------------------------------- /.github/workflows/bazel7.bazelrc: -------------------------------------------------------------------------------- 1 | # Speed up all builds by not checking if external repository files have been modified. 2 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244 3 | build --noexperimental_check_external_repository_files 4 | fetch --noexperimental_check_external_repository_files 5 | query --noexperimental_check_external_repository_files 6 | 7 | # Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. 8 | # Save time on Sandbox creation and deletion when many of the same kind of action run during the 9 | # build. 10 | # Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories 11 | build --reuse_sandbox_directories 12 | -------------------------------------------------------------------------------- /.github/workflows/buildifier.yaml: -------------------------------------------------------------------------------- 1 | name: Buildifier 2 | 3 | # Controls when the action will run. 4 | on: 5 | # Triggers the workflow on push or pull request events but only for the main branch 6 | push: 7 | branches: [main] 8 | pull_request: 9 | branches: [main] 10 | 11 | # Allows you to run this workflow manually from the Actions tab 12 | workflow_dispatch: 13 | 14 | jobs: 15 | check: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: buildifier 20 | run: bazel run --enable_bzlmod //:buildifier.check 21 | -------------------------------------------------------------------------------- /.github/workflows/ci.bazelrc: -------------------------------------------------------------------------------- 1 | # Directories caches by GitHub actions 2 | common --disk_cache=~/.cache/bazel-disk-cache 3 | common --repository_cache=~/.cache/bazel-repository-cache 4 | 5 | # Debug where options came from 6 | common --announce_rc 7 | 8 | # Allows tests to run bazelisk-in-bazel, since this is the cache folder used 9 | common --test_env=XDG_CACHE_HOME 10 | 11 | # Still required for Windows until we upgrade to a minimum rules_js that no longer requires it 12 | common --enable_runfiles -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | # Controls when the action will run 4 | on: 5 | # Triggers the workflow on push or pull request events but only for the main branch 6 | push: 7 | branches: [main] 8 | pull_request: 9 | branches: [main] 10 | 11 | # Allows you to run this workflow manually from the Actions tab 12 | workflow_dispatch: 13 | 14 | concurrency: 15 | # Cancel previous actions from the same PR or branch except 'main' branch. 16 | # See https://docs.github.com/en/actions/using-jobs/using-concurrency and https://docs.github.com/en/actions/learn-github-actions/contexts for more info. 17 | group: concurrency-group::${{ github.workflow }}::${{ github.event.pull_request.number > 0 && format('pr-{0}', github.event.pull_request.number) || github.ref_name }}${{ github.ref_name == 'main' && format('::{0}', github.run_id) || ''}} 18 | cancel-in-progress: ${{ github.ref_name != 'main' }} 19 | 20 | jobs: 21 | # Prepares dynamic test matrix values 22 | matrix-prep: 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v4 26 | - id: bazel-version 27 | name: Prepare 'bazel-version' matrix axis 28 | run: | 29 | v=$(head -n 1 .bazelversion) 30 | m=${v::1} 31 | a=( 32 | "major:$m, version:\"$v\"" 33 | "major:6, version:\"6.5.0\"" 34 | ) 35 | printf -v j '{%s},' "${a[@]}" 36 | echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT 37 | - id: os 38 | name: Prepare 'os' matrix axis 39 | # Only run MacOS and Windows on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively) 40 | # https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes 41 | run: | 42 | a=( ubuntu ) 43 | if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"macos"* ]]; then 44 | a+=( macos ) 45 | fi 46 | if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"windows"* ]]; then 47 | a+=( windows ) 48 | fi 49 | printf -v j '"%s",' "${a[@]}" 50 | echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT 51 | outputs: 52 | bazel-version: ${{ steps.bazel-version.outputs.res }} 53 | os: ${{ steps.os.outputs.res }} 54 | 55 | test: 56 | runs-on: ${{ matrix.os }}-latest 57 | needs: 58 | - matrix-prep 59 | strategy: 60 | fail-fast: false 61 | matrix: 62 | bazel-version: ${{ fromJSON(needs.matrix-prep.outputs.bazel-version) }} 63 | bzlmod: [1, 0] 64 | os: ${{ fromJSON(needs.matrix-prep.outputs.os) }} 65 | folder: 66 | - "." 67 | - "e2e/npm_packages" 68 | - "e2e/smoke" 69 | - "e2e/swc" 70 | exclude: 71 | # Don't test MacOS and Windows against secondary bazel version to minimize minutes (billed at 10X and 2X respectively) 72 | # https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes 73 | - os: macos 74 | bazel-version: 75 | major: 6 76 | - os: windows 77 | bazel-version: 78 | major: 6 79 | # TODO: green up the following tests on Windows 80 | - os: windows 81 | folder: e2e/npm_packages 82 | - os: windows 83 | folder: . 84 | 85 | steps: 86 | - uses: actions/checkout@v4 87 | 88 | - name: Mount bazel caches 89 | uses: actions/cache@v4 90 | with: 91 | path: | 92 | ~/.cache/bazel-disk-cache 93 | ~/.cache/bazel-repository-cache 94 | ~/.cache/xdg-cache 95 | key: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel') }} 96 | restore-keys: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}- 97 | 98 | - name: Configure Bazel version 99 | working-directory: ${{ matrix.folder }} 100 | shell: bash 101 | run: | 102 | # Overwrite the .bazelversion instead of using USE_BAZEL_VERSION so that Bazelisk 103 | # still bootstraps Aspect CLI from configuration in .bazeliskrc. Aspect CLI will 104 | # then use .bazelversion to determine which Bazel version to use. 105 | echo "${{ matrix.bazel-version.version }}" > .bazelversion 106 | # Delete all the version specific bazelrc files that are used for local development 107 | # since the version we're testing against is dynamic. These are just symlinks and the 108 | # root .bazelrc brings these in with try-imports. In this CI workflows, we explicitly 109 | # bring in the version specific bazelrc file with --bazelrc when we invoke bazel. 110 | rm ${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/bazel*.bazelrc 111 | 112 | # TODO: remove this block once we have Aspect CLI Windows releases 113 | - name: Don't use Aspect CLI on Windows 114 | if: matrix.os == 'windows' 115 | working-directory: ${{ matrix.folder }} 116 | shell: bash 117 | run: rm -f .bazeliskrc 118 | 119 | - name: bazel test //... 120 | working-directory: ${{ matrix.folder }} 121 | shell: bash 122 | run: | 123 | bazel \ 124 | --bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/bazel${{ matrix.bazel-version.major }}.bazelrc \ 125 | --bazelrc=${GITHUB_WORKSPACE//\\/\/}/.aspect/bazelrc/ci.bazelrc \ 126 | --bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \ 127 | test \ 128 | --test_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \ 129 | --build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \ 130 | --enable_bzlmod=${{ matrix.bzlmod }} \ 131 | //... 132 | env: 133 | XDG_CACHE_HOME: ~/.cache/xdg-cache # bazelisk will download bazel to here 134 | 135 | test-e2e: 136 | runs-on: ubuntu-latest 137 | steps: 138 | - uses: actions/checkout@v4 139 | - name: Additional integration tests 140 | # Find all shell scripts within e2e, echo the filename, execute, fail on error 141 | run: find e2e/*.sh -maxdepth 1 -type f -exec sh -c 'echo "\n\n------------------------------- $0 -------------------------------" && "$0" || kill $PPID' \{\} \; 142 | -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | # Publish new releases to Bazel Central Registry. 2 | name: Publish 3 | on: 4 | # Run the publish workflow after a successful release 5 | # Will be triggered from the release.yaml workflow 6 | workflow_call: 7 | inputs: 8 | tag_name: 9 | required: true 10 | type: string 11 | secrets: 12 | publish_token: 13 | required: true 14 | # In case of problems, let release engineers retry by manually dispatching 15 | # the workflow from the GitHub UI 16 | workflow_dispatch: 17 | inputs: 18 | tag_name: 19 | required: true 20 | type: string 21 | jobs: 22 | publish: 23 | uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4 24 | with: 25 | tag_name: ${{ inputs.tag_name }} 26 | # GitHub repository which is a fork of the upstream where the Pull Request will be opened. 27 | registry_fork: aspect-build/bazel-central-registry 28 | permissions: 29 | attestations: write 30 | contents: write 31 | id-token: write 32 | secrets: 33 | # Necessary to push to the BCR fork, and to open a pull request against a registry 34 | publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }} 35 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*.*.*" 7 | 8 | permissions: 9 | id-token: write 10 | attestations: write 11 | contents: write 12 | jobs: 13 | release: 14 | uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.2.2 15 | with: 16 | release_files: rules_jest-*.tar.gz 17 | prerelease: false 18 | tag_name: ${{ github.ref_name }} 19 | publish: 20 | needs: release 21 | uses: ./.github/workflows/publish.yaml 22 | with: 23 | tag_name: ${{ github.ref_name }} 24 | secrets: 25 | publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }} 26 | -------------------------------------------------------------------------------- /.github/workflows/release_prep.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit -o nounset -o pipefail 4 | 5 | # Set by GH actions, see 6 | # https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables 7 | TAG=${GITHUB_REF_NAME} 8 | # The prefix is chosen to match what GitHub generates for source archives 9 | PREFIX="rules_jest-${TAG:1}" 10 | ARCHIVE="rules_jest-$TAG.tar.gz" 11 | git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip >$ARCHIVE 12 | SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') 13 | 14 | cat <