mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-14 17:43:52 +08:00
build: migrate @angular-devkit/architect/node
tests to rules_js
Migrates the sub-entry point tests for architect/node to `rules_js`.
This commit is contained in:
parent
e01b4f6f89
commit
397ea00552
@ -3,8 +3,7 @@
|
||||
# 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("@npm//@bazel/jasmine:index.bzl", "jasmine_node_test")
|
||||
load("//tools:interop.bzl", "ts_project")
|
||||
load("//tools:defaults2.bzl", "jasmine_test", "ts_project")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
@ -21,8 +20,7 @@ ts_project(
|
||||
"//:node_modules/@types/node",
|
||||
"//:node_modules/rxjs",
|
||||
"//packages/angular_devkit/architect:architect_rjs",
|
||||
"//packages/angular_devkit/core:core_rjs",
|
||||
"//packages/angular_devkit/core/node:node_rjs",
|
||||
"//packages/angular_devkit/architect:node_modules/@angular-devkit/core",
|
||||
],
|
||||
)
|
||||
|
||||
@ -39,11 +37,11 @@ ts_project(
|
||||
"//:node_modules/@types/jasmine",
|
||||
"//:node_modules/rxjs",
|
||||
"//packages/angular_devkit/architect:architect_rjs",
|
||||
"//tests/angular_devkit/architect/node/jobs:jobs_test_lib_rjs",
|
||||
"//packages/angular_devkit/architect/node/test:test_lib_rjs",
|
||||
],
|
||||
)
|
||||
|
||||
jasmine_node_test(
|
||||
jasmine_test(
|
||||
name = "node_test",
|
||||
srcs = [":node_test_lib"],
|
||||
data = [":node_test_lib_rjs"],
|
||||
)
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import { jobs } from '@angular-devkit/architect';
|
||||
import { jobs } from '../../src';
|
||||
import { JsonValue, schema } from '@angular-devkit/core';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
|
@ -6,12 +6,12 @@
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import { jobs } from '@angular-devkit/architect';
|
||||
import * as path from 'path';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { NodeModuleJobRegistry } from './job-registry';
|
||||
import { jobs } from '../../src';
|
||||
|
||||
const root = path.join(__dirname, '../../../../../tests/angular_devkit/architect/node/jobs');
|
||||
const root = path.join(__dirname, '../test/jobs');
|
||||
|
||||
describe('NodeModuleJobScheduler', () => {
|
||||
it('works', async () => {
|
||||
|
11
packages/angular_devkit/architect/node/test/BUILD.bazel
Normal file
11
packages/angular_devkit/architect/node/test/BUILD.bazel
Normal file
@ -0,0 +1,11 @@
|
||||
load("//tools:interop.bzl", "ts_project")
|
||||
|
||||
ts_project(
|
||||
name = "test_lib",
|
||||
srcs = glob(["**/*.ts"]),
|
||||
visibility = ["//packages/angular_devkit/architect/node:__pkg__"],
|
||||
deps = [
|
||||
"//:node_modules/@types/node",
|
||||
"//packages/angular_devkit/architect:architect_rjs",
|
||||
],
|
||||
)
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.dev/license
|
||||
*/
|
||||
|
||||
import { jobs } from '@angular-devkit/architect';
|
||||
import { jobs } from '../../../index';
|
||||
|
||||
// Export the job using a createJob. We use our own spec file here to do the job.
|
||||
export default jobs.createJobHandler<number[], null, number>(
|
@ -1,22 +0,0 @@
|
||||
load("//tools:interop.bzl", "ts_project")
|
||||
|
||||
# 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
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
ts_project(
|
||||
name = "jobs_test_lib",
|
||||
srcs = glob(
|
||||
include = [
|
||||
"**/*.ts",
|
||||
],
|
||||
),
|
||||
deps = [
|
||||
"//:node_modules/@types/node",
|
||||
"//packages/angular_devkit/architect:architect_rjs",
|
||||
],
|
||||
)
|
@ -97,7 +97,14 @@ ts_project_module = rule(
|
||||
},
|
||||
)
|
||||
|
||||
def ts_project(name, module_name = None, deps = [], tsconfig = None, testonly = False, **kwargs):
|
||||
def ts_project(
|
||||
name,
|
||||
module_name = None,
|
||||
deps = [],
|
||||
tsconfig = None,
|
||||
testonly = False,
|
||||
visibility = None,
|
||||
**kwargs):
|
||||
interop_deps = []
|
||||
|
||||
# Pull in the `rules_nodejs` variants of dependencies we know are "hybrid". This
|
||||
@ -118,6 +125,7 @@ def ts_project(name, module_name = None, deps = [], tsconfig = None, testonly =
|
||||
ts_deps_interop(
|
||||
name = "%s_interop_deps" % name,
|
||||
deps = [] + interop_deps + rjs_modules_to_rnjs,
|
||||
visibility = visibility,
|
||||
testonly = testonly,
|
||||
)
|
||||
|
||||
@ -126,6 +134,7 @@ def ts_project(name, module_name = None, deps = [], tsconfig = None, testonly =
|
||||
testonly = testonly,
|
||||
declaration = True,
|
||||
tsconfig = tsconfig,
|
||||
visibility = visibility,
|
||||
# Use the worker from our own Angular rules, as the default worker
|
||||
# from `rules_ts` is incompatible with TS5+ and abandoned. We need
|
||||
# worker for efficient, fast DX and avoiding Windows no-sandbox issues.
|
||||
@ -138,6 +147,7 @@ def ts_project(name, module_name = None, deps = [], tsconfig = None, testonly =
|
||||
ts_project_module(
|
||||
name = name,
|
||||
testonly = testonly,
|
||||
visibility = visibility,
|
||||
dep = "%s_rjs" % name,
|
||||
# Forwarded dependencies for linker module mapping aspect.
|
||||
# RJS deps can also transitively pull in module mappings from their `interop_deps`.
|
||||
|
Loading…
x
Reference in New Issue
Block a user