mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
support jsdom tests
Alternative would be to switch to jsdom for everything, but TextEncoder is currently missing from jsdom, and jsdom mode is slower IIRC.
This commit is contained in:
parent
297150a1b6
commit
f2029b8ba8
2 changed files with 4 additions and 2 deletions
|
@ -5,17 +5,18 @@ load("//ts:eslint.bzl", "eslint_test")
|
|||
|
||||
ts_library(
|
||||
name = "html-filter",
|
||||
module_name = "html-filter",
|
||||
srcs = glob(
|
||||
["*.ts"],
|
||||
exclude = ["*.test.ts"],
|
||||
),
|
||||
module_name = "html-filter",
|
||||
tsconfig = "//ts:tsconfig.json",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [],
|
||||
)
|
||||
|
||||
jest_test(
|
||||
env = "jsdom",
|
||||
deps = [
|
||||
"html-filter",
|
||||
],
|
||||
|
|
|
@ -2,7 +2,7 @@ load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
|||
load("@esbuild_toolchain//:esbuild.bzl", esbuild = "esbuild_macro")
|
||||
load("@npm//jest-cli:index.bzl", _jest_test = "jest_test")
|
||||
|
||||
def jest_test(deps, name = "jest", protobuf = False):
|
||||
def jest_test(deps, name = "jest", protobuf = False, env = "node"):
|
||||
"Build *.test.ts into a library, then test it with Jest."
|
||||
|
||||
ts_sources = native.glob(["*.test.ts"])
|
||||
|
@ -61,6 +61,7 @@ def jest_test(deps, name = "jest", protobuf = False):
|
|||
"--colors",
|
||||
"--config",
|
||||
"$(location //ts:jest.config.js)",
|
||||
"--env=" + env,
|
||||
],
|
||||
data = bundled_srcs + [
|
||||
"//ts:jest.config.js",
|
||||
|
|
Loading…
Reference in a new issue