sourcegraph/client/common/BUILD.bazel
Jason Bedard 10aefc4bb7
bazel: add bazel build,tests for client/* (#46193)
Webpack bundles compile but need further testing. Jest + mocha tests
compile but are marked as `manual` until further work is done to get them
passing. The four jest tests are green and enabled now, though.

## Test plan

`bazel build //client/...` and `bazel test //client/...`
2023-02-28 20:46:03 -08:00

116 lines
3.3 KiB
Python

load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("//dev:defs.bzl", "jest_test", "npm_package", "ts_project")
npm_link_all_packages(name = "node_modules")
ts_config(
name = "tsconfig",
src = "tsconfig.json",
visibility = ["//client:__subpackages__"],
deps = [
"//:tsconfig",
"//client/extension-api-types:tsconfig",
],
)
ts_project(
name = "common_lib",
srcs = [
"src/errors/constants.ts",
"src/errors/errors.ts",
"src/errors/index.ts",
"src/errors/types.ts",
"src/errors/utils.ts",
"src/index.ts",
"src/types/highlight.js/lib/core.d.ts",
"src/types/highlightjs-graphql/index.d.ts",
"src/types/index.ts",
"src/types/utils.ts",
"src/util/LocalStorageSubject.ts",
"src/util/browserDetection.ts",
"src/util/compatNavigate.ts",
"src/util/fetchCache.ts",
"src/util/hashCode.ts",
"src/util/highlightNode.ts",
"src/util/index.ts",
"src/util/isEncodedImage.ts",
"src/util/jsonc.ts",
"src/util/logger.ts",
"src/util/markdown/contributions.ts",
"src/util/markdown/index.ts",
"src/util/markdown/markdown.ts",
"src/util/rxjs/asObservable.ts",
"src/util/rxjs/combineLatestOrDefault.ts",
"src/util/rxjs/index.ts",
"src/util/rxjs/memoizeObservable.ts",
"src/util/rxjs/repeatUntil.ts",
"src/util/strings.ts",
"src/util/types.ts",
"src/util/url.ts",
],
tsconfig = ":tsconfig",
# TODO(bazel): "#keep"s required for type-only imports
deps = [
":node_modules/@sourcegraph/extension-api-types", #keep
"//:node_modules/@types/highlight.js",
"//:node_modules/@types/history", #keep
"//:node_modules/@types/lodash",
"//:node_modules/@types/marked",
"//:node_modules/@types/node", #keep
"//:node_modules/@types/sanitize-html",
"//:node_modules/highlight.js",
"//:node_modules/highlightjs-graphql",
"//:node_modules/history", #keep
"//:node_modules/jsonc-parser",
"//:node_modules/lodash",
"//:node_modules/marked",
"//:node_modules/react-router-dom", #keep
"//:node_modules/rxjs",
"//:node_modules/sanitize-html",
"//:node_modules/utility-types", #keep
],
)
ts_project(
name = "common_tests",
testonly = True,
srcs = [
"src/errors/errors.test.ts",
"src/util/fetchCache.test.ts",
"src/util/hashCode.test.ts",
"src/util/highlightNode.test.ts",
"src/util/jsonc.test.ts",
"src/util/markdown/markdown.test.ts",
"src/util/rxjs/asObservable.test.ts",
"src/util/rxjs/combineLatestOrDefault.test.ts",
"src/util/rxjs/repeatUntil.test.ts",
"src/util/string.test.ts",
"src/util/url.test.ts",
],
tsconfig = ":tsconfig",
deps = [
":common_lib",
"//:node_modules/@types/mockdate",
"//:node_modules/@types/node",
"//:node_modules/jest-fetch-mock",
"//:node_modules/mockdate",
"//:node_modules/rxjs",
],
)
npm_package(
name = "common_pkg",
srcs = [
"package.json",
":common_lib",
],
)
jest_test(
name = "test",
data = [
":common_tests",
],
)