tree: 8f4558563b8278621bc5fd0a2dff2737b62489f0 [path history] [tgz]
  1. __snapshots__/
  2. ts/
  3. .bazelignore
  4. .bazelrc
  5. babel.config.js
  6. BUILD.bazel
  7. dummy_test.sh
  8. extra.js
  9. index.js
  10. index.test.js
  11. index2.test.js
  12. jest-reporter.js
  13. jest.bzl
  14. jest.config.js
  15. jest.ts.config.js
  16. package.json
  17. README.md
  18. tsconfig.json
  19. WORKSPACE
  20. yarn.lock
examples/jest/README.md

Jest example

This example shows how you might use the Jest testing framework

It has a utility macro in jest.bzl which makes a more ergonomic API for calling the jest_test rule in @npm//jest-cli:index.bzl. We suggest copying that to your repo.

Running on Windows

To make the tests running on windows as well you have to add the --enable_runfiles flag to your .bazelrc. This requires running under elevated privileges (Admin rights), Windows 10 Creators Update (1703) or later system version, and enabling developer mode.

build --enable_runfiles
run --enable_runfiles
test --enable_runfiles

Jest typescript example

Under ts/ there's an example of using jest with typescript directly with generated rule from @npm//jest-cli:index.bzl