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.
jest.bzl
jest_test
@npm//jest-cli:index.bzl