26ac64526c
It looks like the templated_args change only masked the error last time; Jest seems broken on Windows with both the patched .24 version, latest stable, and the new beta version too, presumably because symlinks are being handled differently on Windows somehow. It might be possible to hack around the issue by patching the following file, but I'm not sure: https://github.com/facebook/jest/blob/master/packages/jest-haste-map/src/crawlers/node.ts
112 lines
2.2 KiB
Python
112 lines
2.2 KiB
Python
load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
|
load("//ts:prettier.bzl", "prettier_test")
|
|
load("//ts:eslint.bzl", "eslint_test")
|
|
load("//ts:protobuf.bzl", "protobufjs_library")
|
|
load("@npm//jest-cli:index.bzl", "jest_test")
|
|
|
|
# Protobuf
|
|
#############
|
|
|
|
protobufjs_library(
|
|
name = "backend_proto",
|
|
proto = "//rslib:backend_proto_lib",
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
# Translations
|
|
################
|
|
|
|
load("@rules_python//python:defs.bzl", "py_binary")
|
|
load("@py_deps//:requirements.bzl", "requirement")
|
|
|
|
py_binary(
|
|
name = "genfluent",
|
|
srcs = [
|
|
"genfluent.py",
|
|
],
|
|
deps = [
|
|
requirement("black"),
|
|
requirement("stringcase"),
|
|
],
|
|
)
|
|
|
|
genrule(
|
|
name = "fluent_gen",
|
|
outs = ["i18n.ts"],
|
|
cmd = "$(location genfluent) $(location //rslib/i18n:strings.json) $@",
|
|
tools = [
|
|
"genfluent",
|
|
"//rslib/i18n:strings.json",
|
|
],
|
|
)
|
|
|
|
# Anki Library
|
|
################
|
|
|
|
ts_library(
|
|
name = "lib",
|
|
srcs = glob(
|
|
["**/*.ts"],
|
|
exclude = ["*.test.ts"],
|
|
) + [":i18n.ts"],
|
|
data = [
|
|
"backend_proto",
|
|
],
|
|
module_name = "anki",
|
|
tsconfig = "//:tsconfig.json",
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"backend_proto",
|
|
"@npm//@fluent/bundle",
|
|
"@npm//@types/long",
|
|
"@npm//intl-pluralrules",
|
|
"@npm//tslib",
|
|
],
|
|
)
|
|
|
|
# Tests
|
|
################
|
|
|
|
prettier_test(
|
|
name = "format_check",
|
|
srcs = glob(["*.ts"]),
|
|
)
|
|
|
|
eslint_test(
|
|
name = "eslint",
|
|
srcs = glob(["*.ts"]),
|
|
)
|
|
|
|
ts_library(
|
|
name = "test_lib",
|
|
srcs = glob(["*.test.ts"]),
|
|
tsconfig = "//ts:tsconfig.json",
|
|
deps = [
|
|
":lib",
|
|
"@npm//@types/jest",
|
|
],
|
|
)
|
|
|
|
jest_test(
|
|
name = "test",
|
|
args = [
|
|
"--no-cache",
|
|
"--no-watchman",
|
|
"--ci",
|
|
"--colors",
|
|
"--config",
|
|
"$(location //ts:jest.config.js)",
|
|
],
|
|
data = [
|
|
":test_lib",
|
|
"//ts:jest.config.js",
|
|
"//ts:package.json",
|
|
"@npm//protobufjs",
|
|
],
|
|
target_compatible_with = select({
|
|
"@platforms//os:osx": [],
|
|
"@platforms//os:linux": [],
|
|
"//conditions:default": ["@platforms//os:linux"],
|
|
}),
|
|
)
|