refactor(benchpress): added tsconfig and fixed ts errors (#35127)

PR Close #35127
This commit is contained in:
Wagner Maciel 2020-02-03 10:59:39 -08:00 committed by Miško Hevery
parent 6ddf5508db
commit e210715958
6 changed files with 49 additions and 16 deletions

View File

@ -20,7 +20,6 @@ ts_library(
tsconfig = "//modules/benchmarks:tsconfig-e2e.json", tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [ deps = [
"//modules/e2e_util", "//modules/e2e_util",
"@npm//@types/jasminewd2",
"@npm//protractor", "@npm//protractor",
], ],
) )

View File

@ -14,16 +14,16 @@ describe('largeform benchmark', () => {
afterEach(verifyNoBrowserErrors); afterEach(verifyNoBrowserErrors);
it('should work for ng2', () => { it('should work for ng2', async () => {
openBrowser({ openBrowser({
url: '/', url: '/',
params: [{name: 'copies', value: 1}], params: [{name: 'copies', value: 1}],
ignoreBrowserSynchronization: true, ignoreBrowserSynchronization: true,
}); });
$('#createDom').click(); await $('#createDom').click();
expect(element.all(By.css('input[name=value0]')).get(0).getAttribute('value')) expect(await element.all(By.css('input[name=value0]')).get(0).getAttribute('value'))
.toBe('someValue0'); .toBe('someValue0');
$('#destroyDom').click(); await $('#destroyDom').click();
expect(element.all(By.css('input[name=value0]')).count()).toBe(0); expect(await element.all(By.css('input[name=value0]')).count()).toBe(0);
}); });
}); });

View File

@ -9,7 +9,6 @@ ts_library(
tsconfig = "//modules/benchmarks:tsconfig-e2e.json", tsconfig = "//modules/benchmarks:tsconfig-e2e.json",
deps = [ deps = [
"//modules/e2e_util", "//modules/e2e_util",
"@npm//@types/jasminewd2",
"@npm//protractor", "@npm//protractor",
], ],
) )

View File

@ -28,24 +28,24 @@ const SCENARIOS = [
describe('styling benchmark spec', () => { describe('styling benchmark spec', () => {
afterEach(verifyNoBrowserErrors); afterEach(verifyNoBrowserErrors);
it('should render and interact to update and detect changes', () => { it('should render and interact to update and detect changes', async () => {
openBrowser({url: '/', ignoreBrowserSynchronization: true}); openBrowser({url: '/', ignoreBrowserSynchronization: true});
create(); create();
const items = element.all(by.css('styling-bindings button')); const items = element.all(by.css('styling-bindings button'));
expect(items.count()).toBe(2000); expect(await items.count()).toBe(2000);
expect(items.first().getAttribute('title')).toBe('bar'); expect(await items.first().getAttribute('title')).toBe('bar');
update(); update();
expect(items.first().getAttribute('title')).toBe('baz'); expect(await items.first().getAttribute('title')).toBe('baz');
}); });
it('should render and run noop change detection', () => { it('should render and run noop change detection', async () => {
openBrowser({url: '/', ignoreBrowserSynchronization: true}); openBrowser({url: '/', ignoreBrowserSynchronization: true});
create(); create();
const items = element.all(by.css('styling-bindings button')); const items = element.all(by.css('styling-bindings button'));
expect(items.count()).toBe(2000); expect(await items.count()).toBe(2000);
expect(items.first().getAttribute('title')).toBe('bar'); expect(await items.first().getAttribute('title')).toBe('bar');
detectChanges(); detectChanges();
expect(items.first().getAttribute('title')).toBe('bar'); expect(await items.first().getAttribute('title')).toBe('bar');
}); });
// Create benchmarks for each possible test scenario. // Create benchmarks for each possible test scenario.

View File

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"lib": ["es2015"], "lib": ["es2015"],
"types": ["node", "jasminewd2"] "types": ["node", "jasmine"]
} }
} }

View File

@ -0,0 +1,35 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/all/",
"noImplicitAny": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"selenium-webdriver": ["../../node_modules/@types/selenium-webdriver/index.d.ts"],
"rxjs/*": ["../../node_modules/rxjs/*"],
"@angular/*": ["../../packages/*"],
"zone.js/*": ["../../packages/zone.js/*"],
"e2e_util/*": ["../e2e_util/*"]
},
"rootDir": ".",
"inlineSourceMap": true,
"lib": ["es5", "DOM", "ScriptHost"],
"skipDefaultLibCheck": true,
"skipLibCheck": true,
"target": "es5",
"types": ["angular", "jasmine"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true
},
"rules": {
"no-floating-promises": true,
"no-unused-expression": true,
"no-unused-variable": true
}
}