mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
test: delete bazel_ngtsc_plugin integration test (#47584)
This does not provide any added value. PR Close #47584
This commit is contained in:
committed by
Andrew Kushnir
parent
b2aa9ce3e5
commit
ce59f1a14d
@@ -11,7 +11,6 @@ aio/tools/examples/shared/node_modules
|
||||
packages/bazel/node_modules
|
||||
|
||||
# All integration test node_modules folders
|
||||
integration/bazel_workspace_tests/bazel_ngtsc_plugin/node_modules
|
||||
integration/cli-elements-universal/node_modules
|
||||
integration/cli-hello-world/node_modules
|
||||
integration/cli-hello-world-ivy-compat/node_modules
|
||||
@@ -41,7 +40,6 @@ integration/typings_test_ts36/node_modules
|
||||
integration/typings_test_ts37/node_modules
|
||||
|
||||
# All integration test .yarn_local_cache folders
|
||||
integration/bazel_workspace_tests/bazel_ngtsc_plugin/.yarn_local_cache
|
||||
integration/cli-elements-universal/.yarn_local_cache
|
||||
integration/cli-hello-world/.yarn_local_cache
|
||||
integration/cli-hello-world-ivy-compat/.yarn_local_cache
|
||||
|
||||
@@ -125,16 +125,6 @@ test:saucelabs --flaky_test_attempts=1
|
||||
# --ng_perf will ask the Ivy compiler to produce performance results for each build.
|
||||
build --flag_alias=ng_perf=//packages/compiler-cli:ng_perf
|
||||
|
||||
#####################################################################
|
||||
# Folders to ignore for integration tests (nested Bazel workspaces) #
|
||||
#####################################################################
|
||||
|
||||
# The nested Bazel integration test workspace should not be analysed as part of
|
||||
# Skyframe, but should also not be ignored in order to be able to glob for its files.
|
||||
# TODO: Simplify this once https://github.com/bazelbuild/bazel/issues/12034 is fixed
|
||||
build --deleted_packages=integration/bazel_workspace_tests/bazel_ngtsc_plugin,integration/bazel_workspace_tests/bazel_ngtsc_plugin/src,integration/bazel_workspace_tests/bazel_ngtsc_plugin/src/hello-world,integration/bazel_workspace_tests/bazel_ngtsc_plugin/test,integration/bazel_workspace_tests/bazel_ngtsc_plugin/test/e2e,integration/bazel_workspace_tests/bazel_ngtsc_plugin/tools,integration/bazel_workspace_tests/bazel_ngtsc_plugin/tools/angular
|
||||
query --deleted_packages=integration/bazel_workspace_tests/bazel_ngtsc_plugin,integration/bazel_workspace_tests/bazel_ngtsc_plugin/src,integration/bazel_workspace_tests/bazel_ngtsc_plugin/src/hello-world,integration/bazel_workspace_tests/bazel_ngtsc_plugin/test,integration/bazel_workspace_tests/bazel_ngtsc_plugin/test/e2e,integration/bazel_workspace_tests/bazel_ngtsc_plugin/tools,integration/bazel_workspace_tests/bazel_ngtsc_plugin/tools/angular
|
||||
|
||||
####################################################
|
||||
# User bazel configuration
|
||||
# NOTE: This needs to be the *last* entry in the config.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
load("//integration:index.bzl", "ng_integration_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ng_integration_test(
|
||||
name = "bazel_ngtsc_plugin_test",
|
||||
srcs = glob(["bazel_ngtsc_plugin/**"]),
|
||||
environment = {
|
||||
# Setup a HOME directory so that Bazelisk can work, both Linux/macOS and Windows variants
|
||||
# are configured to provide a fake home directory so that Bazelisk can download Bazel.
|
||||
"HOME": "<TMP>",
|
||||
"LOCALAPPDATA": "<TMP>",
|
||||
},
|
||||
tags = [
|
||||
# Bazel-in-bazel tests are resource intensive and should not be over-parallelized
|
||||
# as they will compete for the resources of other parallel tests slowing
|
||||
# everything down. Ask Bazel to allocate multiple CPUs for these tests with "cpu:n" tag.
|
||||
"cpu:3",
|
||||
],
|
||||
# Nested bazel workspace tests need to be declared at a higher-level because the test
|
||||
# cannot be wired up within the `BUILD.bazel` file as part of the actual test workspace.
|
||||
working_dir = "bazel_ngtsc_plugin/",
|
||||
)
|
||||
@@ -1,2 +0,0 @@
|
||||
node_modules
|
||||
.yarn_local_cache
|
||||
@@ -1,20 +0,0 @@
|
||||
# Make TypeScript and Angular compilation fast, by keeping a few copies of the
|
||||
# compiler running as daemons, and cache SourceFile AST's to reduce parse time.
|
||||
build --strategy=TypeScriptCompile=worker
|
||||
build --strategy=AngularTemplateCompile=worker
|
||||
|
||||
test --test_output=errors
|
||||
|
||||
# Workaround https://github.com/bazelbuild/bazel/issues/3645
|
||||
# Bazel doesn't calculate the memory ceiling correctly when running under Docker.
|
||||
# Limit Bazel to consuming resources that fit in CircleCI "xlarge" class
|
||||
# https://circleci.com/docs/2.0/configuration-reference/#resource_class
|
||||
build --local_ram_resources=14336
|
||||
build --local_cpu_resources=8
|
||||
|
||||
# Temporary define while angular depends on the legacy rollup_bundle rule.
|
||||
# TODO: remove this setting after https://github.com/angular/angular/pull/33201 lands.
|
||||
build --define=enable_legacy_rollup_rule=1
|
||||
|
||||
# Don't create symlinks
|
||||
build --symlink_prefix=/
|
||||
@@ -1 +0,0 @@
|
||||
4.0.0
|
||||
@@ -1,14 +0,0 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
exports_files([
|
||||
"protractor.conf.js",
|
||||
"angular-metadata.tsconfig.json",
|
||||
])
|
||||
|
||||
# ts_library and ng_module use the `//:tsconfig.json` target
|
||||
# by default. This alias allows omitting explicit tsconfig
|
||||
# attribute.
|
||||
alias(
|
||||
name = "tsconfig.json",
|
||||
actual = "//src:tsconfig.json",
|
||||
)
|
||||
@@ -1,74 +0,0 @@
|
||||
workspace(name = "bazel_ngtsc_plugin")
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
# Fetch rules_nodejs so we can install our npm dependencies
|
||||
http_archive(
|
||||
name = "build_bazel_rules_nodejs",
|
||||
sha256 = "2b2004784358655f334925e7eadc7ba80f701144363df949b3293e1ae7a2fb7b",
|
||||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.4.0/rules_nodejs-5.4.0.tar.gz"],
|
||||
)
|
||||
|
||||
# Fetch sass rules for compiling sass files
|
||||
http_archive(
|
||||
name = "io_bazel_rules_sass",
|
||||
sha256 = "2f239bf002419ee904e61b4fda278aefdf93bae29257f50052a515f2d100b6a3",
|
||||
strip_prefix = "rules_sass-1.54.9",
|
||||
urls = [
|
||||
"https://github.com/bazelbuild/rules_sass/archive/1.54.9.zip",
|
||||
],
|
||||
)
|
||||
|
||||
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
|
||||
|
||||
build_bazel_rules_nodejs_dependencies()
|
||||
|
||||
# Setup the Node.js toolchain.
|
||||
load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
|
||||
|
||||
nodejs_register_toolchains(
|
||||
name = "nodejs",
|
||||
node_version = "16.10.0",
|
||||
)
|
||||
|
||||
# Install our NPM dependencies
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
|
||||
|
||||
yarn_install(
|
||||
name = "npm",
|
||||
# Currently disabled due to:
|
||||
# 1. Missing Windows support currently.
|
||||
# 2. Incompatibilites with the `ts_library` rule.
|
||||
exports_directories_only = False,
|
||||
frozen_lockfile = False,
|
||||
package_json = "//:package.json",
|
||||
yarn_lock = "//:yarn.lock",
|
||||
)
|
||||
|
||||
# Load protractor dependencies
|
||||
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")
|
||||
|
||||
npm_bazel_protractor_dependencies()
|
||||
|
||||
# Setup the rules_webtesting toolchain
|
||||
load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories")
|
||||
|
||||
web_test_repositories()
|
||||
|
||||
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories")
|
||||
|
||||
browser_repositories(
|
||||
chromium = True,
|
||||
firefox = True,
|
||||
)
|
||||
|
||||
# Setup the rules_sass toolchain
|
||||
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
|
||||
|
||||
sass_repositories()
|
||||
|
||||
load("@build_bazel_rules_nodejs//toolchains/esbuild:esbuild_repositories.bzl", "esbuild_repositories")
|
||||
|
||||
esbuild_repositories(
|
||||
npm_repository = "npm",
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
{
|
||||
"name": "angular-bazel",
|
||||
"description": "example and integration test for building Angular apps with Bazel",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@angular/animations": "file:../../../dist/packages-dist/animations",
|
||||
"@angular/cdk": "13.0.0",
|
||||
"@angular/common": "file:../../../dist/packages-dist/common",
|
||||
"@angular/core": "file:../../../dist/packages-dist/core",
|
||||
"@angular/forms": "file:../../../dist/packages-dist/forms",
|
||||
"@angular/material": "13.0.0",
|
||||
"@angular/platform-browser": "file:../../../dist/packages-dist/platform-browser",
|
||||
"@angular/platform-browser-dynamic": "file:../../../dist/packages-dist/platform-browser-dynamic",
|
||||
"@angular/router": "file:../../../dist/packages-dist/router",
|
||||
"reflect-metadata": "0.1.12",
|
||||
"rxjs": "file:../../../node_modules/rxjs",
|
||||
"tslib": "file:../../../node_modules/tslib",
|
||||
"zone.js": "file:../../../dist/zone.js-dist/archive/zone.js.tgz"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/bazel": "file:../../../dist/packages-dist/bazel",
|
||||
"@angular/compiler": "file:../../../dist/packages-dist/compiler",
|
||||
"@angular/compiler-cli": "file:../../../dist/packages-dist/compiler-cli",
|
||||
"@babel/core": "^7.16.0",
|
||||
"@bazel/bazelisk": "file:../../../node_modules/@bazel/bazelisk",
|
||||
"@bazel/concatjs": "5.4.1",
|
||||
"@bazel/esbuild": "5.4.1",
|
||||
"@bazel/protractor": "5.4.1",
|
||||
"@bazel/rollup": "5.4.1",
|
||||
"@bazel/terser": "5.4.1",
|
||||
"@rollup/plugin-commonjs": "file:../../../node_modules/@rollup/plugin-commonjs",
|
||||
"@rollup/plugin-node-resolve": "file:../../../node_modules/@rollup/plugin-node-resolve",
|
||||
"@types/jasmine": "2.8.8",
|
||||
"@types/node": "^12.11.1",
|
||||
"http-server": "0.12.0",
|
||||
"jasmine": "^3.5.0",
|
||||
"karma": "4.4.1",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-firefox-launcher": "1.2.0",
|
||||
"karma-jasmine": "2.0.1",
|
||||
"karma-requirejs": "1.1.0",
|
||||
"karma-sourcemap-loader": "0.3.7",
|
||||
"protractor": "file:../../../node_modules/protractor",
|
||||
"requirejs": "2.3.6",
|
||||
"rollup": "file:../../../node_modules/rollup",
|
||||
"rollup-plugin-sourcemaps": "file:../../../node_modules/rollup-plugin-sourcemaps",
|
||||
"terser": "file:../../../node_modules/terser",
|
||||
"typescript": "file:../../../node_modules/typescript"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "bazelisk build ... --noshow_progress && bazelisk test ..."
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
ANGULAR_PACKAGES_CONFIG = [
|
||||
("@angular/animations", struct(entry_points = ["browser"])),
|
||||
("@angular/common", struct(entry_points = ["http/testing", "http", "testing"])),
|
||||
("@angular/compiler", struct(entry_points = ["testing"])),
|
||||
("@angular/core", struct(entry_points = ["testing"])),
|
||||
("@angular/forms", struct(entry_points = [])),
|
||||
("@angular/platform-browser", struct(entry_points = ["testing", "animations"])),
|
||||
("@angular/platform-browser-dynamic", struct(entry_points = ["testing"])),
|
||||
("@angular/router", struct(entry_points = [])),
|
||||
]
|
||||
|
||||
ANGULAR_PACKAGES = [
|
||||
struct(
|
||||
name = name[len("@angular/"):],
|
||||
entry_points = config.entry_points,
|
||||
platform = config.platform if hasattr(config, "platform") else "browser",
|
||||
module_name = name,
|
||||
)
|
||||
for name, config in ANGULAR_PACKAGES_CONFIG
|
||||
]
|
||||
@@ -1,4 +0,0 @@
|
||||
exports.config = {
|
||||
getPageTimeout: 60 * 1000,
|
||||
allScriptsTimeout: 60 * 1000,
|
||||
};
|
||||
@@ -1,64 +0,0 @@
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
|
||||
load("@npm//http-server:index.bzl", "http_server")
|
||||
load("@npm//@angular/bazel:index.bzl", "ng_module")
|
||||
load("@npm//@bazel/esbuild:index.bzl", "esbuild", "esbuild_config")
|
||||
load("@npm//@bazel/terser:index.bzl", "terser_minified")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# Allow targets under sub-packages to reference the tsconfig.json file
|
||||
exports_files(["tsconfig.json"])
|
||||
|
||||
ng_module(
|
||||
name = "src",
|
||||
srcs = glob(["*.ts"]),
|
||||
generate_ve_shims = True,
|
||||
deps = [
|
||||
"//src/hello-world",
|
||||
"@npm//@angular/common",
|
||||
"@npm//@angular/core",
|
||||
"@npm//@angular/platform-browser",
|
||||
"@npm//@angular/router",
|
||||
"@npm//@types",
|
||||
"@npm//rxjs",
|
||||
"@npm//tslib",
|
||||
],
|
||||
)
|
||||
|
||||
esbuild_config(
|
||||
name = "bundle_esbuild_config",
|
||||
config_file = "bundle-esbuild.config.mjs",
|
||||
deps = [
|
||||
"@npm//@angular/compiler-cli",
|
||||
"@npm//@babel/core",
|
||||
],
|
||||
)
|
||||
|
||||
esbuild(
|
||||
name = "bundle",
|
||||
config = ":bundle_esbuild_config",
|
||||
entry_point = ":main.ts",
|
||||
deps = [
|
||||
"//src",
|
||||
],
|
||||
)
|
||||
|
||||
terser_minified(
|
||||
name = "bundle.min",
|
||||
src = ":bundle",
|
||||
)
|
||||
|
||||
pkg_web(
|
||||
name = "prodapp",
|
||||
srcs = [
|
||||
"index.html",
|
||||
":bundle.min",
|
||||
"@npm//:node_modules/zone.js/bundles/zone.umd.min.js",
|
||||
],
|
||||
)
|
||||
|
||||
http_server(
|
||||
name = "prodserver",
|
||||
data = [":prodapp"],
|
||||
templated_args = ["src/prodapp"],
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
// TODO(kyliau): Empty routes is enough for now to expose the bug in
|
||||
// https://github.com/angular/angular/issues/29454.
|
||||
// Consider adding non-lazy loaded routes.
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
@@ -1,20 +0,0 @@
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Component} from '@angular/core';
|
||||
import {Observable} from 'rxjs';
|
||||
import {map, startWith} from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-component',
|
||||
template: `
|
||||
<hello-world-app></hello-world-app>
|
||||
<div>The current time is {{ time$ | async }}</div>
|
||||
<router-outlet></router-outlet>
|
||||
`
|
||||
})
|
||||
export class AppComponent {
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
time$: Observable<string> =
|
||||
this.http.get('https://worldtimeapi.org/api/timezone/America/Los_Angeles.json')
|
||||
.pipe(map((result: any) => result.datetime), startWith(['...']));
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
|
||||
import {AppRoutingModule} from './app-routing.module';
|
||||
import {AppComponent} from './app.component';
|
||||
import {HelloWorldModule} from './hello-world/hello-world.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
AppRoutingModule,
|
||||
CommonModule,
|
||||
BrowserModule,
|
||||
HttpClientModule,
|
||||
HelloWorldModule,
|
||||
],
|
||||
declarations: [AppComponent],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
import {NodeJSFileSystem, ConsoleLogger, LogLevel} from '@angular/compiler-cli';
|
||||
import {createEs2015LinkerPlugin} from '@angular/compiler-cli/linker/babel';
|
||||
import babel from '@babel/core';
|
||||
import fs from 'fs';
|
||||
|
||||
const linkerBabelPlugin = createEs2015LinkerPlugin({
|
||||
fileSystem: new NodeJSFileSystem(),
|
||||
logger: new ConsoleLogger(LogLevel.warn),
|
||||
linkerJitMode: false,
|
||||
});
|
||||
|
||||
const linkerEsbuildPlugin = {
|
||||
name: 'ng-linker-esbuild',
|
||||
setup: build => {
|
||||
build.onLoad({filter: /fesm2020/}, async args => {
|
||||
const filePath = args.path;
|
||||
const content = await fs.promises.readFile(filePath, 'utf8');
|
||||
const {code} = await babel.transformAsync(content, {
|
||||
filename: filePath,
|
||||
filenameRelative: filePath,
|
||||
plugins: [linkerBabelPlugin],
|
||||
sourceMaps: 'inline',
|
||||
compact: false,
|
||||
});
|
||||
|
||||
return {contents: code};
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
// Prefer `.mjs` files over `.js` files. Otherwise the devmode ES5 CommonJS
|
||||
// files might get picked up by ESBuild.
|
||||
resolveExtensions: ['.mjs', '.js'],
|
||||
// `tslib` sets the `module` condition to resolve to ESM.
|
||||
conditions: ['es2020', 'es2015', 'module'],
|
||||
// This ensures that we prioritize ES2020. RxJS would otherwise use the ESM5 output.
|
||||
mainFields: ['es2020', 'es2015', 'module', 'main'],
|
||||
format: 'iife',
|
||||
plugins: [linkerEsbuildPlugin],
|
||||
};
|
||||
@@ -1,68 +0,0 @@
|
||||
load("@npm//@bazel/concatjs:index.bzl", "karma_web_test_suite")
|
||||
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
|
||||
load("@npm//@angular/bazel:index.bzl", "ng_package")
|
||||
load("//tools:ng_ts_library.bzl", "ng_ts_library")
|
||||
load("//tools/angular:index.bzl", "FRAMEWORK_AMD_FILES")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
sass_binary(
|
||||
name = "hello-world-styles",
|
||||
src = "hello-world.component.scss",
|
||||
)
|
||||
|
||||
ng_ts_library(
|
||||
name = "hello-world",
|
||||
srcs = glob(
|
||||
["*.ts"],
|
||||
exclude = ["*.spec.ts"],
|
||||
),
|
||||
assets = [":hello-world-styles"],
|
||||
deps = [
|
||||
"@npm//@angular/core",
|
||||
"@npm//@types",
|
||||
"@npm//tslib",
|
||||
],
|
||||
)
|
||||
|
||||
ng_package(
|
||||
name = "npm_package",
|
||||
deps = [":hello-world"],
|
||||
)
|
||||
|
||||
ng_ts_library(
|
||||
name = "test_lib",
|
||||
testonly = 1,
|
||||
srcs = glob(["*.spec.ts"]),
|
||||
deps = [
|
||||
":hello-world",
|
||||
"@npm//@angular/core",
|
||||
"@npm//@angular/platform-browser",
|
||||
"@npm//@angular/platform-browser-dynamic",
|
||||
"@npm//@types",
|
||||
"@npm//jasmine",
|
||||
"@npm//tslib",
|
||||
],
|
||||
)
|
||||
|
||||
karma_web_test_suite(
|
||||
name = "test",
|
||||
bootstrap = [
|
||||
"@npm//:node_modules/zone.js/bundles/zone-testing-bundle.umd.js",
|
||||
"@npm//:node_modules/reflect-metadata/Reflect.js",
|
||||
],
|
||||
browsers = [
|
||||
"@io_bazel_rules_webtesting//browsers:chromium-local",
|
||||
# TODO(gregmagolan): re-enable firefox testing once fixed
|
||||
# See https://github.com/bazelbuild/rules_typescript/issues/296
|
||||
# "@io_bazel_rules_webtesting//browsers:firefox-local",
|
||||
],
|
||||
# rules_webtesting has a required_tag "native" for `chromium-local` browser
|
||||
tags = ["native"],
|
||||
deps = FRAMEWORK_AMD_FILES + [
|
||||
"@npm//:node_modules/tslib/tslib.js",
|
||||
"//test:angular_test_init",
|
||||
"//tools:rxjs_umd_files",
|
||||
":test_lib",
|
||||
],
|
||||
)
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
$example-red: #ff0000;
|
||||
|
||||
h1 {
|
||||
color: $example-red;
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {By} from '@angular/platform-browser';
|
||||
|
||||
import {HelloWorldComponent} from './hello-world.component';
|
||||
|
||||
describe('BannerComponent (inline template)', () => {
|
||||
let comp: HelloWorldComponent;
|
||||
let fixture: ComponentFixture<HelloWorldComponent>;
|
||||
let el: HTMLElement;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [HelloWorldComponent], // declare the test component
|
||||
});
|
||||
TestBed.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HelloWorldComponent);
|
||||
comp = fixture.componentInstance;
|
||||
el = fixture.debugElement.query(By.css('div')).nativeElement;
|
||||
});
|
||||
|
||||
it('should display original title', () => {
|
||||
fixture.detectChanges();
|
||||
expect(el.textContent).toContain(comp.name);
|
||||
});
|
||||
|
||||
it('should display a different test title', () => {
|
||||
comp.name = 'Test';
|
||||
fixture.detectChanges();
|
||||
expect(el.textContent).toContain('Test');
|
||||
});
|
||||
});
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'hello-world-app',
|
||||
template: `
|
||||
<div>Hello {{ name }}!</div>
|
||||
<input type="text" [value]="name" (input)="name = $event.target.value"/>
|
||||
`,
|
||||
styleUrls: ['./hello-world.component.scss'],
|
||||
})
|
||||
export class HelloWorldComponent {
|
||||
name: string = 'world';
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
import {HelloWorldComponent} from './hello-world.component';
|
||||
import {NgModule} from '@angular/core';
|
||||
|
||||
@NgModule({
|
||||
declarations: [HelloWorldComponent],
|
||||
exports: [HelloWorldComponent],
|
||||
})
|
||||
export class HelloWorldModule {}
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './hello-world.component';
|
||||
export * from './hello-world.module';
|
||||
@@ -1,15 +0,0 @@
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Bazel Integration Test</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
<!-- The Angular application will be bootstrapped into this element. -->
|
||||
<app-component></app-component>
|
||||
<script src="/npm/node_modules/zone.js/bundles/zone.umd.min.js"></script>
|
||||
<script src="/bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +0,0 @@
|
||||
import {platformBrowser} from '@angular/platform-browser';
|
||||
import {AppModule} from './app.module';
|
||||
|
||||
platformBrowser().bootstrapModule(AppModule);
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"importHelpers": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es5",
|
||||
"es2015.collection",
|
||||
"es2015.iterable",
|
||||
"es2015.promise"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
load("@npm//@bazel/concatjs:index.bzl", "ts_library")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
ts_library(
|
||||
name = "angular_test_init",
|
||||
testonly = True,
|
||||
srcs = ["angular_test_init.spec.ts"],
|
||||
deps = [
|
||||
"@npm//@angular/compiler",
|
||||
"@npm//@angular/core",
|
||||
"@npm//@angular/platform-browser-dynamic",
|
||||
],
|
||||
)
|
||||
@@ -1,10 +0,0 @@
|
||||
// Tests will compile framework declarations in JIT.
|
||||
import '@angular/compiler';
|
||||
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
TestBed.initTestEnvironment([BrowserDynamicTestingModule], platformBrowserDynamicTesting());
|
||||
@@ -1,33 +0,0 @@
|
||||
load("@npm//@bazel/concatjs:index.bzl", "ts_library")
|
||||
load("@npm//@bazel/protractor:index.bzl", "protractor_web_test_suite")
|
||||
|
||||
ts_library(
|
||||
name = "e2e",
|
||||
testonly = 1,
|
||||
srcs = ["app.spec.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = [
|
||||
"@npm//@types/jasmine",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
ts_library(
|
||||
name = "ts_on_prepare",
|
||||
testonly = 1,
|
||||
srcs = ["on-prepare.ts"],
|
||||
tsconfig = ":tsconfig.json",
|
||||
deps = [
|
||||
"@npm//@bazel/protractor",
|
||||
"@npm//@types/node",
|
||||
"@npm//protractor",
|
||||
],
|
||||
)
|
||||
|
||||
protractor_web_test_suite(
|
||||
name = "test",
|
||||
configuration = "//:protractor.conf.js",
|
||||
on_prepare = ":ts_on_prepare",
|
||||
server = "//src:prodserver",
|
||||
deps = [":e2e"],
|
||||
)
|
||||
@@ -1,14 +0,0 @@
|
||||
import {browser, by, element} from 'protractor';
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000;
|
||||
|
||||
describe('angular example application', () => {
|
||||
it('should display: Hello World!', (done) => {
|
||||
browser.get('');
|
||||
const div = element(by.css('div'));
|
||||
div.getText().then(t => expect(t).toEqual(`Hello world!`));
|
||||
element(by.css('input')).sendKeys('!');
|
||||
div.getText().then(t => expect(t).toEqual(`Hello world!!`));
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
import { browser } from 'protractor';
|
||||
import {OnPrepareConfig, runServer} from '@bazel/protractor/protractor-utils';
|
||||
import * as path from 'path';
|
||||
|
||||
export = function(config: OnPrepareConfig) {
|
||||
const isProdserver = path.basename(config.server, path.extname(config.server)) === 'prodserver';
|
||||
return runServer(config.workspace, config.server, isProdserver ? '-p' : '-port', [])
|
||||
.then(serverSpec => {
|
||||
const serverUrl = `http://localhost:${serverSpec.port}`;
|
||||
console.log(`Server has been started, starting tests against ${serverUrl}`);
|
||||
browser.baseUrl = serverUrl;
|
||||
});
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2015"]
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
# Custom ts_library compiler that runs tsc_wrapped with angular/compiler-cli statically linked
|
||||
# This can be used with worker mode because we don't need the linker at runtime to make
|
||||
# the angular plugin loadable
|
||||
# Just a clone of @npm//@bazel/typescript/bin:tsc_wrapped with added deps
|
||||
nodejs_binary(
|
||||
name = "tsc_wrapped_with_angular",
|
||||
data = [
|
||||
"@npm//@angular/compiler-cli",
|
||||
"@npm//@bazel/concatjs",
|
||||
],
|
||||
entry_point = "@npm//:node_modules/@bazel/concatjs/internal/tsc_wrapped/tsc_wrapped.js",
|
||||
# Disable the linker and rely on patched resolution which works better on Windows
|
||||
# and is less prone to race conditions when targets build concurrently.
|
||||
templated_args = ["--nobazel_run_linker"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "rxjs_umd_files",
|
||||
srcs = [
|
||||
# do not sort
|
||||
"@npm//:node_modules/rxjs/bundles/rxjs.umd.js",
|
||||
":rxjs_shims.js",
|
||||
],
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
load(":index.bzl", "create_angular_bundle_targets")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
create_angular_bundle_targets()
|
||||
@@ -1,42 +0,0 @@
|
||||
load("//:packages.bzl", "ANGULAR_PACKAGES")
|
||||
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
|
||||
|
||||
"""
|
||||
Starlark file exposing a definition for generating Angular UMD bundles
|
||||
for all entry-points the Angular framework packages expose.
|
||||
|
||||
This is useful for running Karma tests which rely on AMD modules currently.
|
||||
In the future, this could be removed if Karma tests can run with ESM, or the
|
||||
logic could be simplified by running a bundler like ESBuild for tests. ESBuild
|
||||
does not support generating UMD bundles at time of writing though.
|
||||
"""
|
||||
|
||||
def _get_target_name_base(pkg, entry_point):
|
||||
return "%s%s" % (pkg.name, "_%s" % entry_point if entry_point else "")
|
||||
|
||||
def _create_bundle_targets(pkg, entry_point, module_name):
|
||||
target_name_base = _get_target_name_base(pkg, entry_point)
|
||||
fesm_bundle_path = "fesm2020/%s.mjs" % (entry_point if entry_point else pkg.name)
|
||||
|
||||
# Note: No dependencies are added here so that cross-package imports, or imports to
|
||||
# RxJS are not bundled.
|
||||
rollup_bundle(
|
||||
name = "%s_bundle" % target_name_base,
|
||||
entry_point = "@npm//:node_modules/@angular/%s/%s" % (pkg.name, fesm_bundle_path),
|
||||
args = ["--amd.id", module_name],
|
||||
silent = True,
|
||||
format = "amd",
|
||||
)
|
||||
|
||||
def create_angular_bundle_targets():
|
||||
for pkg in ANGULAR_PACKAGES:
|
||||
_create_bundle_targets(pkg, None, pkg.module_name)
|
||||
|
||||
for entry_point in pkg.entry_points:
|
||||
_create_bundle_targets(pkg, entry_point, "%s/%s" % (pkg.module_name, entry_point))
|
||||
|
||||
FRAMEWORK_AMD_FILES = [
|
||||
"//tools/angular:%s_bundle" % _get_target_name_base(pkg, entry_point)
|
||||
for pkg in ANGULAR_PACKAGES
|
||||
for entry_point in [None] + pkg.entry_points
|
||||
]
|
||||
@@ -1,13 +0,0 @@
|
||||
"Shows how to enable both worker mode and use_angular_plugin to make a drop-in replacement for ng_module"
|
||||
|
||||
load("@npm//@bazel/concatjs:index.bzl", "ts_library")
|
||||
|
||||
def ng_ts_library(**kwargs):
|
||||
angular_assets = kwargs.pop("assets", []) + kwargs.pop("angular_assets", [])
|
||||
ts_library(
|
||||
compiler = "//tools:tsc_wrapped_with_angular",
|
||||
supports_workers = True,
|
||||
use_angular_plugin = True,
|
||||
angular_assets = angular_assets,
|
||||
**kwargs
|
||||
)
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* @license
|
||||
* 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.io/license
|
||||
*/
|
||||
|
||||
// rxjs/operators
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define('rxjs/operators', ['exports', 'rxjs'], factory);
|
||||
}
|
||||
})(function(exports, rxjs) {
|
||||
'use strict';
|
||||
Object.keys(rxjs.operators).forEach(function(key) { exports[key] = rxjs.operators[key]; });
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
});
|
||||
|
||||
// rxjs/testing
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define('rxjs/testing', ['exports', 'rxjs'], factory);
|
||||
}
|
||||
})(function(exports, rxjs) {
|
||||
'use strict';
|
||||
Object.keys(rxjs.testing).forEach(function(key) { exports[key] = rxjs.testing[key]; });
|
||||
Object.defineProperty(exports, '__esModule', {value: true});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
+1
-2
@@ -98,7 +98,6 @@
|
||||
|
||||
{"matchCurrentVersion": "0.0.0-PLACEHOLDER", "enabled": false},
|
||||
|
||||
{"matchPaths": ["integration/**"], "enabled": false},
|
||||
{"matchPaths": ["integration/bazel_workspace_tests/**/WORKSPACE"], "enabled": true}
|
||||
{"matchPaths": ["integration/**"], "enabled": false}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user