refactor(benchpress): added tsconfig to ts_library rules and awaited floating promises (#35147)

* Note: we specify our own tsconfig bc the default tsconfig we provide for ts_library disables the must-use-promises rule

PR Close #35147
This commit is contained in:
Wagner Maciel 2020-02-05 09:39:29 -08:00 committed by Kara Erickson
parent 5efe9be051
commit 60471c092f
12 changed files with 26 additions and 15 deletions

View File

@ -23,6 +23,7 @@ ts_library(
name = "perf_lib",
testonly = 1,
srcs = ["class_bindings.perf-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
"//modules/e2e_util",
"@npm//protractor",

View File

@ -13,7 +13,7 @@ describe('class bindings perf', () => {
it('should work for update', async() => {
browser.rootEl = '#root';
runBenchmark({
await runBenchmark({
id: 'create',
url: '',
ignoreBrowserSynchronization: true,
@ -25,7 +25,7 @@ describe('class bindings perf', () => {
it('should work for update', async() => {
browser.rootEl = '#root';
runBenchmark({
await runBenchmark({
id: 'update',
url: '',
ignoreBrowserSynchronization: true,

View File

@ -24,6 +24,7 @@ ts_library(
name = "perf_lib",
testonly = 1,
srcs = ["expanding_rows.perf-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
"//modules/e2e_util",
"@npm//protractor",

View File

@ -13,7 +13,7 @@ describe('benchmarks', () => {
it('should work for create', async() => {
browser.rootEl = '#root';
runBenchmark({
await runBenchmark({
id: 'create',
url: '',
ignoreBrowserSynchronization: true,

View File

@ -6,6 +6,7 @@ ts_library(
name = "perf_lib",
testonly = True,
srcs = ["js-web-frameworks.perf-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
"//modules/e2e_util",
"@npm//protractor",

View File

@ -54,7 +54,7 @@ describe('js-web-frameworks benchmark perf', () => {
[Create1KWorker, Delete1KWorker, UpdateWorker, SwapWorker].forEach((worker) => {
describe(worker.id, () => {
it(`should run benchmark for ${testPackageName}`, async() => {
runTableBenchmark({
await runTableBenchmark({
id: `js-web-frameworks.${testPackageName}.${worker.id}`,
url: '/',
ignoreBrowserSynchronization: true,

View File

@ -5,6 +5,7 @@ package(default_visibility = ["//visibility:public"])
ts_library(
name = "util_lib",
srcs = ["util.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = ["//modules/benchmarks/src:util_lib"],
)
@ -12,6 +13,7 @@ ts_library(
name = "perf_tests_lib",
testonly = 1,
srcs = ["largetable.perf-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
"//modules/e2e_util",
"@npm//protractor",

View File

@ -49,7 +49,7 @@ describe('largetable benchmark perf', () => {
[CreateOnlyWorker, CreateAndDestroyWorker, UpdateWorker].forEach((worker) => {
describe(worker.id, () => {
it(`should run benchmark for ${testPackageName}`, async() => {
runTableBenchmark({
await runTableBenchmark({
id: `largeTable.${testPackageName}.${worker.id}`,
url: '/',
ignoreBrowserSynchronization: true,

View File

@ -5,6 +5,7 @@ package(default_visibility = ["//visibility:public"])
ts_library(
name = "util_lib",
srcs = ["util.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = ["//modules/benchmarks/src:util_lib"],
)
@ -12,6 +13,7 @@ ts_library(
name = "test_utils_lib",
testonly = 1,
srcs = ["test_utils.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
"//modules/e2e_util",
"@npm//protractor",
@ -22,6 +24,7 @@ ts_library(
name = "perf_tests_lib",
testonly = 1,
srcs = ["tree.perf-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
":test_utils_lib",
"@npm//protractor",
@ -32,6 +35,7 @@ ts_library(
name = "e2e_tests_lib",
testonly = 1,
srcs = ["tree.e2e-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
":test_utils_lib",
"@npm//protractor",
@ -42,6 +46,7 @@ ts_library(
name = "detect_changes_perf_tests_lib",
testonly = 1,
srcs = ["tree_detect_changes.perf-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
":test_utils_lib",
"@npm//protractor",
@ -52,6 +57,7 @@ ts_library(
name = "detect_changes_e2e_tests_lib",
testonly = 1,
srcs = ["tree_detect_changes.e2e-spec.ts"],
tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [
":test_utils_lib",
"@npm//protractor",

View File

@ -13,16 +13,16 @@ import {openTreeBenchmark} from './test_utils';
describe('tree benchmark', () => {
it('should work for createDestroy', async() => {
openTreeBenchmark();
$('#createDom').click();
await $('#createDom').click();
expect($('#root').getText()).toContain('1');
$('#destroyDom').click();
expect($('#root').getText() as any).toEqual('');
await $('#destroyDom').click();
expect(await $('#root').getText()).toEqual('');
});
it('should work for update', async() => {
openTreeBenchmark();
$('#createDom').click();
$('#createDom').click();
await $('#createDom').click();
await $('#createDom').click();
expect($('#root').getText()).toContain('A');
});
});

View File

@ -11,7 +11,7 @@ import {runTreeBenchmark} from './test_utils';
describe('tree benchmark perf', () => {
it('should work for createOnly', async() => {
runTreeBenchmark({
await runTreeBenchmark({
// This cannot be called "createOnly" because the actual destroy benchmark
// has the "createOnly" id already. See: https://github.com/angular/angular/pull/21503
id: 'createOnlyForReal',
@ -21,7 +21,7 @@ describe('tree benchmark perf', () => {
});
it('should work for destroy', async() => {
runTreeBenchmark({
await runTreeBenchmark({
// This is actually a benchmark for destroying the dom, but it has been accidentally
// named "createOnly". See https://github.com/angular/angular/pull/21503.
id: 'createOnly',
@ -31,7 +31,7 @@ describe('tree benchmark perf', () => {
});
it('should work for createDestroy', async() => {
runTreeBenchmark({
await runTreeBenchmark({
id: 'createDestroy',
work: () => {
$('#destroyDom').click();
@ -41,7 +41,7 @@ describe('tree benchmark perf', () => {
});
it('should work for update', async() => {
runTreeBenchmark({
await runTreeBenchmark({
id: 'update',
work: () => $('#createDom').click(),
});

View File

@ -13,7 +13,7 @@ import {openTreeBenchmark} from './test_utils';
describe('tree benchmark detect changes', () => {
it('should work for detectChanges', async() => {
openTreeBenchmark();
$('#detectChanges').click();
await $('#detectChanges').click();
expect($('#numberOfChecks').getText()).toContain('10');
});
});