Skip to content

Commit

Permalink
build: update to latest jasmine and resolve errors
Browse files Browse the repository at this point in the history
Updates to the latest version of Jasmine and removes some unnecessary `await` statements.
  • Loading branch information
crisbeto committed Feb 8, 2021
1 parent 51f5924 commit 068ced2
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 34 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"@types/glob": "^7.1.3",
"@types/gulp": "4.0.8",
"@types/inquirer": "^7.3.1",
"@types/jasmine": "^3.5.4",
"@types/jasmine": "^3.6.3",
"@types/marked": "^1.2.1",
"@types/merge2": "^0.3.30",
"@types/minimist": "^1.2.0",
Expand All @@ -127,8 +127,8 @@
"highlight.js": "^10.4.0",
"husky": "5.0.6",
"inquirer": "^7.1.0",
"jasmine": "^3.5.0",
"jasmine-core": "^3.5.0",
"jasmine": "^3.6.0",
"jasmine-core": "^3.6.0",
"kagekiri": "^1.0.18",
"karma": "^4.4.1",
"karma-browserstack-launcher": "^1.6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('global stylesheets migration', () => {
writeFile('/sub_project/assets/test.css', subProjectStylesheet);

// Run the fixers and expect no error to be thrown.
await expectAsync(runFixers()).not.toBeRejected();
expectAsync(runFixers()).not.toBeRejected();

// if the external stylesheet that is not of a project target would have been checked
// by accident, the stylesheet would differ from the original file content.
Expand Down
2 changes: 1 addition & 1 deletion src/material/autocomplete/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export function runHarnessTests(
it('should throw when selecting an option that is not available', async () => {
const input = await loader.getHarness(autocompleteHarness.with({selector: '#plain'}));
await input.enterText('New');
await expectAsync(input.selectOption({text: 'Texas'})).toBeRejectedWithError(
expectAsync(input.selectOption({text: 'Texas'})).toBeRejectedWithError(
/Could not find a mat-option matching {"text":"Texas"}/);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/material/grid-list/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function runHarnessTests(
]);
expect(await tiles[0].getHeaderText()).toBe('Three');
expect(await tiles[1].getHeaderText()).toBe('Three');
await expectAsync(gridList.getTileAtPosition({row: 2, column: 0}))
expectAsync(gridList.getTileAtPosition({row: 2, column: 0}))
.toBeRejectedWithError(/Could not find tile/);

// Update the fourth tile to span over two rows. The previous position
Expand Down
2 changes: 1 addition & 1 deletion src/material/list/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function runBaseListFunctionalityTests<
const items = await simpleListHarness.getItems();
expect(items.length).toBe(3);
const loader = await items[1].getChildLoader(selectors.content as MatListItemSection);
await expectAsync(loader.getHarness(TestItemContentHarness)).toBeResolved();
expectAsync(loader.getHarness(TestItemContentHarness)).toBeResolved();
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/material/menu/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function runHarnessTests(

it('should throw when item is not found', async () => {
const menu1 = await loader.getHarness(menuHarness.with({triggerText: 'Menu 1'}));
await expectAsync(menu1.clickItem({text: 'Fake Item'})).toBeRejectedWithError(
expectAsync(menu1.clickItem({text: 'Fake Item'})).toBeRejectedWithError(
/Could not find item matching {"text":"Fake Item"}/);
});

Expand All @@ -166,7 +166,7 @@ export function runHarnessTests(

it('should throw when intermediate item does not have submenu', async () => {
const menu1 = await loader.getHarness(menuHarness.with({triggerText: 'Menu 1'}));
await expectAsync(menu1.clickItem({text: 'Leaf Item 1'}, {})).toBeRejectedWithError(
expectAsync(menu1.clickItem({text: 'Leaf Item 1'}, {})).toBeRejectedWithError(
/Item matching {"text":"Leaf Item 1"} does not have a submenu/);
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/material/paginator/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function runHarnessTests(
instance.showFirstLastButtons = false;
fixture.detectChanges();

await expectAsync(paginator.goToFirstPage()).toBeRejectedWithError(
expectAsync(paginator.goToFirstPage()).toBeRejectedWithError(
/Could not find first page button inside paginator/);
});

Expand All @@ -100,7 +100,7 @@ export function runHarnessTests(
instance.showFirstLastButtons = false;
fixture.detectChanges();

await expectAsync(paginator.goToLastPage()).toBeRejectedWithError(
expectAsync(paginator.goToLastPage()).toBeRejectedWithError(
/Could not find last page button inside paginator/);
});

Expand All @@ -110,7 +110,7 @@ export function runHarnessTests(
instance.pageSizeOptions = [];
fixture.detectChanges();

await expectAsync(paginator.setPageSize(10)).toBeRejectedWithError(
expectAsync(paginator.setPageSize(10)).toBeRejectedWithError(
/Cannot find page size selector in paginator/);
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/material/radio/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function runHarnessTests(radioModule: typeof MatRadioModule,
fixture.componentInstance.thirdGroupButtonName = 'other-name';
fixture.detectChanges();

await expectAsync(
expectAsync(
loader.getAllHarnesses(radioGroupHarness.with({name: 'third-group-name'})))
.toBeRejectedWithError(
/locator found a radio-group with name "third-group-name".*have mismatching names/);
Expand All @@ -78,7 +78,7 @@ export function runHarnessTests(radioModule: typeof MatRadioModule,
fixture.componentInstance.thirdGroupButtonName = 'other-button-name';
fixture.detectChanges();

await expectAsync(groups[2].getName())
expectAsync(groups[2].getName())
.toBeRejectedWithError(/Radio buttons in radio-group have mismatching names./);
});

Expand Down Expand Up @@ -138,7 +138,7 @@ export function runHarnessTests(radioModule: typeof MatRadioModule,

it('should throw error when checking invalid radio button', async () => {
const group = await loader.getHarness(radioGroupHarness.with({name: 'my-group-1-name'}));
await expectAsync(group.checkRadioButton({label: 'opt4'})).toBeRejectedWithError(
expectAsync(group.checkRadioButton({label: 'opt4'})).toBeRejectedWithError(
/Could not find radio button matching {"label":"opt4"}/);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/material/schematics/ng-add/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ describe('ng-add schematic', () => {

it('should throw an error if the "build" target has been changed', async () => {
overwriteTargetBuilder(appTree, 'build', 'thirdparty-builder');
await expectAsync(runner.runSchematicAsync('ng-add-setup-project', {}, appTree).toPromise())
expectAsync(runner.runSchematicAsync('ng-add-setup-project', {}, appTree).toPromise())
.toBeRejectedWithError(/not using the default builders.*build/);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Material address-form schematic', () => {
it('should throw if no name has been specified', async () => {
const appTree = await createTestApp(runner);

await expectAsync(
expectAsync(
runner.runSchematicAsync('address-form', {project: 'material'}, appTree).toPromise())
.toBeRejectedWithError(/required property 'name'/);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('material-dashboard-schematic', () => {
it('should throw if no name has been specified', async () => {
const appTree = await createTestApp(runner);

await expectAsync(
expectAsync(
runner.runSchematicAsync('dashboard', {project: 'material'}, appTree).toPromise())
.toBeRejectedWithError(/required property 'name'/);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('material-navigation-schematic', () => {
it('should throw if no name has been specified', async () => {
const appTree = await createTestApp(runner);

await expectAsync(
expectAsync(
runner.runSchematicAsync('navigation', {project: 'material'}, appTree).toPromise())
.toBeRejectedWithError(/required property 'name'/);
});
Expand Down
2 changes: 1 addition & 1 deletion src/material/schematics/ng-generate/table/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('material-table-schematic', () => {
it('should throw if no name has been specified', async () => {
const appTree = await createTestApp(runner);

await expectAsync(
expectAsync(
runner.runSchematicAsync('table', {project: 'material'}, appTree).toPromise())
.toBeRejectedWithError(/required property 'name'/);
});
Expand Down
2 changes: 1 addition & 1 deletion src/material/schematics/ng-generate/tree/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Material tree schematic', () => {
it('should throw if no name has been specified', async () => {
const appTree = await createTestApp(runner);

await expectAsync(runner.runSchematicAsync('tree', {project: 'material'}, appTree).toPromise())
expectAsync(runner.runSchematicAsync('tree', {project: 'material'}, appTree).toPromise())
.toBeRejectedWithError(/required property 'name'/);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('v9 HammerJS removal', () => {
}}
));
addPackageToPackageJson(tree, 'hammerjs', '0.0.0');
await expectAsync(runMigration()).not.toBeRejected();
expectAsync(runMigration()).not.toBeRejected();
});

describe('hammerjs not used', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/material/snack-bar/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function runHarnessTests(
// retrieved. We expect an error to be thrown.
fixture.componentInstance.openCustom();
snackBar = await loader.getHarness(snackBarHarness);
await expectAsync(snackBar.getMessage()).toBeRejectedWithError(/custom content/);
expectAsync(snackBar.getMessage()).toBeRejectedWithError(/custom content/);
});

it('should be able to get action description of simple snack-bar', async () => {
Expand All @@ -119,7 +119,7 @@ export function runHarnessTests(
// cannot be retrieved. We expect an error to be thrown.
fixture.componentInstance.openCustom();
snackBar = await loader.getHarness(snackBarHarness);
await expectAsync(snackBar.getActionDescription()).toBeRejectedWithError(/custom content/);
expectAsync(snackBar.getActionDescription()).toBeRejectedWithError(/custom content/);
});

it('should be able to check whether simple snack-bar has action', async () => {
Expand All @@ -135,7 +135,7 @@ export function runHarnessTests(
// be found. We expect an error to be thrown.
fixture.componentInstance.openCustom();
snackBar = await loader.getHarness(snackBarHarness);
await expectAsync(snackBar.hasAction()).toBeRejectedWithError(/custom content/);
expectAsync(snackBar.hasAction()).toBeRejectedWithError(/custom content/);
});

it('should be able to dismiss simple snack-bar with action', async () => {
Expand All @@ -154,7 +154,7 @@ export function runHarnessTests(

fixture.componentInstance.openSimple('No action');
snackBar = await loader.getHarness(snackBarHarness);
await expectAsync(snackBar.dismissWithAction()).toBeRejectedWithError(/without action/);
expectAsync(snackBar.dismissWithAction()).toBeRejectedWithError(/without action/);
});

@Component({
Expand Down
2 changes: 1 addition & 1 deletion src/material/tabs/testing/tab-group-shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function runTabGroupHarnessTests(

it('should throw error when attempting to select invalid tab', async () => {
const tabGroup = await loader.getHarness(tabGroupHarness);
await expectAsync(tabGroup.selectTab({label: 'Fake'})).toBeRejectedWithError(
expectAsync(tabGroup.selectTab({label: 'Fake'})).toBeRejectedWithError(
/Cannot find mat-tab matching filter {"label":"Fake"}/);
});

Expand Down
2 changes: 1 addition & 1 deletion src/material/tabs/testing/tab-nav-bar-shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function runTabNavBarHarnessTests(

it('should throw error when attempting to click invalid link', async () => {
const navBar = await loader.getHarness(tabNavBarHarness);
await expectAsync(navBar.clickLink({label: 'Fake'})).toBeRejectedWithError(
expectAsync(navBar.clickLink({label: 'Fake'})).toBeRejectedWithError(
/Cannot find mat-tab-link matching filter {"label":"Fake"}/);
});

Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1959,10 +1959,10 @@
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762"
integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==

"@types/jasmine@^3.5.4":
version "3.5.4"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-3.5.4.tgz#8f9b7b03cc6204d2048b08128dac1f341bfe0591"
integrity sha512-Uc/obv/lRh1t6RMOV6wkiAfYSZ0AOSTJqVl0Th8bHFcDhw4rQ0L60sxVnmOJj+RXbVboAE1Fd/mBclQWARRAsQ==
"@types/jasmine@^3.6.3":
version "3.6.3"
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-3.6.3.tgz#824df555b8a5114f91619e78d8f59624d6f23050"
integrity sha512-5QKAG8WfC9XrOgYLXPrxv1G2IIUE6zDyzTWamhNWJO0LqPRUbZ0q0zGHDhDJ7MpFloUuyME/jpBIdPjq3/P3jA==

"@types/lodash.debounce@^4.0.6":
version "4.0.6"
Expand Down Expand Up @@ -7734,7 +7734,7 @@ istanbul@^0.4.5:
which "^1.1.1"
wordwrap "^1.0.0"

jasmine-core@^3.5.0, jasmine-core@^3.6.0, jasmine-core@~3.6.0:
jasmine-core@^3.6.0, jasmine-core@~3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.6.0.tgz#491f3bb23941799c353ceb7a45b38a950ebc5a20"
integrity sha512-8uQYa7zJN8hq9z+g8z1bqCfdC8eoDAeVnM5sfqs7KHv9/ifoJ500m018fpFc7RDaO6SWCLCXwo/wPSNcdYTgcw==
Expand All @@ -7761,7 +7761,7 @@ jasmine@2.8.0:
glob "^7.0.6"
jasmine-core "~2.8.0"

jasmine@^3.5.0:
jasmine@^3.6.0:
version "3.6.4"
resolved "https://registry.yarnpkg.com/jasmine/-/jasmine-3.6.4.tgz#1f8e4a0d5028a2dc66942b73b9fef4c32be97ad5"
integrity sha512-hIeOou6y0BgCOKYgXYveQvlY+PTHgDPajFf+vLCYbMTQ+VjAP9+EQv0nuC9+gyCAAWISRFauB1XUb9kFuOKtcQ==
Expand Down

0 comments on commit 068ced2

Please sign in to comment.