Skip to content

Commit 8973971

Browse files
crisbetojosephperrott
authored andcommitted
build: e2e and test init files not being linted (#12221)
1 parent 51bded7 commit 8973971

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

e2e/components/tabs-e2e.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@ import {
33
by,
44
element,
55
ElementArrayFinder,
6-
ElementFinder,
76
Key,
87
ExpectedConditions
98
} from 'protractor';
109
import {pressKeys} from '../util/index';
1110

1211
describe('tabs', () => {
1312
describe('basic behavior', () => {
14-
let tabGroup: ElementFinder;
1513
let tabLabels: ElementArrayFinder;
1614
let tabBodies: ElementArrayFinder;
1715

1816
beforeEach(() => {
1917
browser.get('/tabs');
20-
tabGroup = element(by.css('mat-tab-group'));
2118
tabLabels = element.all(by.css('.mat-tab-label'));
2219
tabBodies = element.all(by.css('mat-tab-body'));
2320
});
@@ -39,8 +36,8 @@ describe('tabs', () => {
3936
});
4037

4138
it('should change focus with keyboard interaction', async () => {
42-
let right = Key.RIGHT;
43-
let left = Key.LEFT;
39+
const right = Key.RIGHT;
40+
const left = Key.LEFT;
4441

4542
tabLabels.get(0).click();
4643
expect(await getFocusStates(tabLabels)).toEqual([true, false, false]);
@@ -71,8 +68,8 @@ describe('tabs', () => {
7168
*/
7269
async function getFocusStates(elements: ElementArrayFinder) {
7370
return elements.map(async el => {
74-
let elementText = await el!.getText();
75-
let activeText = await browser.driver.switchTo().activeElement().getText();
71+
const elementText = await el!.getText();
72+
const activeText = await browser.driver.switchTo().activeElement().getText();
7673

7774
return activeText === elementText;
7875
});
@@ -94,7 +91,7 @@ function getBodyActiveStates(elements: ElementArrayFinder) {
9491
*/
9592
async function getClassStates(elements: ElementArrayFinder, className: string) {
9693
return elements.map(async el => {
97-
let classes = await el!.getAttribute('class');
98-
return classes.split(/ +/g).indexOf(className) >= 0;
94+
const classes = await el!.getAttribute('class');
95+
return classes.split(/ +/g).indexOf(className) > -1;
9996
});
10097
}

test/angular-test-init-spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ patchTestBedToDestroyFixturesAfterEveryTest(testBed);
3131
* aforementioned errors were thrown, they would be reported for the wrong test (the test that's
3232
* about to start, not the test that just finished).
3333
*/
34-
function patchTestBedToDestroyFixturesAfterEveryTest(testBed) {
34+
function patchTestBedToDestroyFixturesAfterEveryTest(testBedInstance) {
3535
// Original resetTestingModule function of the TestBed.
36-
const _resetTestingModule = testBed.resetTestingModule;
36+
const _resetTestingModule = testBedInstance.resetTestingModule;
3737

3838
// Monkey-patch the resetTestingModule to destroy fixtures outside of a try/catch block.
3939
// With https://github.com/angular/angular/commit/2c5a67134198a090a24f6671dcdb7b102fea6eba
4040
// errors when destroying components are no longer causing Jasmine to fail.
41-
testBed.resetTestingModule = function() {
41+
testBedInstance.resetTestingModule = function() {
4242
try {
4343
this._activeFixtures.forEach(fixture => fixture.destroy());
4444
} finally {
@@ -52,5 +52,5 @@ function patchTestBedToDestroyFixturesAfterEveryTest(testBed) {
5252
// for us because it doesn't allow developers to see what test actually failed.
5353
// Fixing this by resetting the testing module after each test.
5454
// https://github.com/angular/angular/blob/master/packages/core/testing/src/before_each.ts#L25
55-
afterEach(() => testBed.resetTestingModule());
55+
afterEach(() => testBedInstance.resetTestingModule());
5656
}

tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// TypeScript config file that matches all source files in the project. This file is read by
1+
// TypeScript config file that matches all source files in the project. This file is read by
22
// IDEs and TSLint. For IDEs it ensures that `experimentalDecorator` warnings are not showing up.
33
{
44
"compilerOptions": {
@@ -15,6 +15,8 @@
1515
},
1616
"include": [
1717
"src/**/*.ts",
18+
"e2e/**/*.ts",
19+
"test/**/*.ts",
1820
"tools/**/*.ts"
1921
],
2022
"exclude": [

0 commit comments

Comments
 (0)