Paul Gschwendtner e519bef788 build: migrate @angular/pwa tests to rules_js
This commit changes the execution of `@angular/pwa` tests to `rules_js`
native `jasmine_test`.

This requires setting it up in the pnpm workspace for first-party linked
dependencies. Notably it turns out the peer dependency placeholder was
incorrect, so we are fixing it here and nicely avoid a problem where
pnpm would otherwise not find a local, or external suitable version.

As we originally tried to work without the fix for the peer dependency
range, there was supported added for extra substitutions. We are keeping
that logic as it will likely be useful in the future.
2025-01-21 09:25:54 +01:00

85 lines
1.8 KiB
Python

# Copyright Google Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at https://angular.dev/license
load("@npm2//:defs.bzl", "npm_link_all_packages")
load("//tools:defaults2.bzl", "jasmine_test", "npm_package", "ts_project")
load("//tools:ts_json_schema.bzl", "ts_json_schema")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
npm_link_all_packages()
RUNTIME_ASSETS = glob(
include = [
"pwa/*.js",
"pwa/*.mjs",
"pwa/files/**/*",
],
) + [
"package.json",
"collection.json",
"pwa/schema.json",
]
ts_project(
name = "pwa",
srcs = [
"pwa/index.ts",
"//packages/angular/pwa:pwa/schema.ts",
],
data = RUNTIME_ASSETS,
module_name = "@angular/pwa",
deps = [
":node_modules/@angular-devkit/schematics",
":node_modules/@schematics/angular",
"//:node_modules/@types/node",
"//:node_modules/parse5-html-rewriting-stream",
],
)
ts_json_schema(
name = "pwa_schema",
src = "pwa/schema.json",
)
ts_project(
name = "pwa_test_lib",
testonly = True,
srcs = glob(["pwa/**/*_spec.ts"]),
deps = [
":pwa_rjs",
"//:node_modules/@types/jasmine",
"//packages/angular_devkit/schematics/testing:testing_rjs",
],
)
jasmine_test(
name = "pwa_test",
data = [":pwa_test_lib_rjs"],
)
genrule(
name = "license",
srcs = ["//:LICENSE"],
outs = ["LICENSE"],
cmd = "cp $(execpath //:LICENSE) $@",
)
npm_package(
name = "pkg",
pkg_deps = [
"//packages/angular_devkit/schematics:package.json",
"//packages/schematics/angular:package.json",
],
tags = ["release-package"],
deps = RUNTIME_ASSETS + [
":README.md",
":license",
":pwa_rjs",
],
)