Skip to content

Commit

Permalink
build: update to latest Angular and fix test failures
Browse files Browse the repository at this point in the history
Updates to the latest version of Angular and fixes some tests that were broken by the CLI switching to generating standalone apps by default.
  • Loading branch information
crisbeto committed Sep 29, 2023
1 parent cc3428e commit 85a9e21
Show file tree
Hide file tree
Showing 12 changed files with 347 additions and 282 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@
},
"version": "17.0.0-next.5",
"dependencies": {
"@angular/animations": "^17.0.0-next.4",
"@angular/common": "^17.0.0-next.4",
"@angular/compiler": "^17.0.0-next.4",
"@angular/core": "^17.0.0-next.4",
"@angular/forms": "^17.0.0-next.4",
"@angular/platform-browser": "^17.0.0-next.4",
"@angular/animations": "^17.0.0-next.6",
"@angular/common": "^17.0.0-next.6",
"@angular/compiler": "^17.0.0-next.6",
"@angular/core": "^17.0.0-next.6",
"@angular/forms": "^17.0.0-next.6",
"@angular/platform-browser": "^17.0.0-next.6",
"@types/google.maps": "^3.52.4",
"@types/youtube": "^0.0.46",
"rxjs": "^6.6.7",
Expand All @@ -71,18 +71,18 @@
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.0.0-next.4",
"@angular-devkit/core": "^17.0.0-next.4",
"@angular-devkit/schematics": "^17.0.0-next.4",
"@angular-devkit/build-angular": "^17.0.0-next.6",
"@angular-devkit/core": "^17.0.0-next.6",
"@angular-devkit/schematics": "^17.0.0-next.6",
"@angular/bazel": "https://github.com/angular/bazel-builds.git#bac9c1abe1e6ac1801fbbccb53353a1ed7126469",
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#22a9a75114d5e80907054f01b9fa360972de1c05",
"@angular/cli": "^17.0.0-next.4",
"@angular/compiler-cli": "^17.0.0-next.4",
"@angular/localize": "^17.0.0-next.4",
"@angular/cli": "^17.0.0-next.6",
"@angular/compiler-cli": "^17.0.0-next.6",
"@angular/localize": "^17.0.0-next.6",
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#2c4d983ef0f1f000a8554b3b7fbf7f1061c877d3",
"@angular/platform-browser-dynamic": "^17.0.0-next.4",
"@angular/platform-server": "^17.0.0-next.4",
"@angular/router": "^17.0.0-next.4",
"@angular/platform-browser-dynamic": "^17.0.0-next.6",
"@angular/platform-server": "^17.0.0-next.6",
"@angular/router": "^17.0.0-next.6",
"@babel/core": "^7.16.12",
"@babel/helper-explode-assignable-expression": "^7.18.6",
"@babel/helper-string-parser": "^7.22.5",
Expand Down Expand Up @@ -148,7 +148,7 @@
"@octokit/rest": "18.3.5",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@schematics/angular": "^17.0.0-next.4",
"@schematics/angular": "^17.0.0-next.6",
"@types/babel__core": "^7.1.18",
"@types/browser-sync": "^2.26.3",
"@types/fs-extra": "^9.0.13",
Expand Down
10 changes: 5 additions & 5 deletions src/cdk/schematics/ng-generate/drag-drop/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('CDK drag-drop schematic', () => {
});

it('should create drag-drop files and add them to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('drag-drop', baseOptions, app);
const moduleContent = getFileContent(tree, '/projects/material/src/app/app.module.ts');
const files = tree.files;
Expand All @@ -34,7 +34,7 @@ describe('CDK drag-drop schematic', () => {
});

it('should add drag-drop module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('drag-drop', baseOptions, app);
const moduleContent = getFileContent(tree, '/projects/material/src/app/app.module.ts');

Expand All @@ -43,7 +43,7 @@ describe('CDK drag-drop schematic', () => {

describe('standalone option', () => {
it('should generate a standalone component', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('drag-drop', {...baseOptions, standalone: true}, app);
const module = getFileContent(tree, '/projects/material/src/app/app.module.ts');
const component = getFileContent(tree, '/projects/material/src/app/foo/foo.component.ts');
Expand Down Expand Up @@ -83,7 +83,7 @@ describe('CDK drag-drop schematic', () => {
});

it('should respect the deprecated "styleext" option value', async () => {
let tree = await createTestApp(runner);
let tree = await createTestApp(runner, {standalone: false});
tree.overwrite(
'angular.json',
JSON.stringify({
Expand Down Expand Up @@ -185,7 +185,7 @@ describe('CDK drag-drop schematic', () => {
});

it('should respect the deprecated global "spec" option value', async () => {
let tree = await createTestApp(runner);
let tree = await createTestApp(runner, {standalone: false});
tree.overwrite(
'angular.json',
JSON.stringify({
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 @@ -26,7 +26,7 @@ describe('ng-add schematic', () => {

beforeEach(async () => {
runner = new SchematicTestRunner('schematics', COLLECTION_PATH);
appTree = await createTestApp(runner);
appTree = await createTestApp(runner, {standalone: false});

errorOutput = [];
warnOutput = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Material address-form schematic', () => {
});

it('should create address-form files and add them to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('address-form', baseOptions, app);
const files = tree.files;

Expand All @@ -31,7 +31,7 @@ describe('Material address-form schematic', () => {
});

it('should add address-form imports to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('address-form', baseOptions, app);
const moduleContent = getFileContent(tree, '/projects/material/src/app/app.module.ts');

Expand All @@ -52,7 +52,7 @@ describe('Material address-form schematic', () => {

describe('standalone option', () => {
it('should generate a standalone component', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic(
'address-form',
{...baseOptions, standalone: true},
Expand Down
6 changes: 3 additions & 3 deletions src/material/schematics/ng-generate/dashboard/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('material-dashboard-schematic', () => {
});

it('should create dashboard files and add them to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('dashboard', baseOptions, app);
const files = tree.files;

Expand All @@ -31,7 +31,7 @@ describe('material-dashboard-schematic', () => {
});

it('should add dashboard imports to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('dashboard', baseOptions, app);
const moduleContent = getFileContent(tree, '/projects/material/src/app/app.module.ts');

Expand Down Expand Up @@ -60,7 +60,7 @@ describe('material-dashboard-schematic', () => {

describe('standalone option', () => {
it('should generate a standalone component', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('dashboard', {...baseOptions, standalone: true}, app);
const module = getFileContent(tree, '/projects/material/src/app/app.module.ts');
const component = getFileContent(tree, '/projects/material/src/app/foo/foo.component.ts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ describe('card styles', () => {

beforeEach(async () => {
runner = createNewTestRunner();
cliAppTree = patchDevkitTreeToExposeTypeScript(await createTestApp(runner));
cliAppTree = patchDevkitTreeToExposeTypeScript(
await createTestApp(runner, {standalone: false}),
);
});

describe('mixin migrations', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ describe('card template migrator', () => {

beforeEach(async () => {
runner = createNewTestRunner();
cliAppTree = patchDevkitTreeToExposeTypeScript(await createTestApp(runner));
cliAppTree = patchDevkitTreeToExposeTypeScript(
await createTestApp(runner, {standalone: false}),
);
});

it('should not update other elements', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ describe('runtime code migration', () => {

beforeEach(async () => {
runner = createNewTestRunner();
cliAppTree = patchDevkitTreeToExposeTypeScript(await createTestApp(runner));
cliAppTree = patchDevkitTreeToExposeTypeScript(
await createTestApp(runner, {standalone: false}),
);
});

async function runMigrationTest(oldFileContent: string, newFileContent: string) {
Expand Down
8 changes: 4 additions & 4 deletions src/material/schematics/ng-generate/navigation/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('material-navigation-schematic', () => {
}

it('should create navigation files and add them to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('navigation', baseOptions, app);
const files = tree.files;

Expand All @@ -50,13 +50,13 @@ describe('material-navigation-schematic', () => {
});

it('should add navigation imports to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('navigation', baseOptions, app);
expectNavigationSchematicModuleImports(tree);
});

it('should support `nav` as schematic alias', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('nav', baseOptions, app);
expectNavigationSchematicModuleImports(tree);
});
Expand All @@ -71,7 +71,7 @@ describe('material-navigation-schematic', () => {

describe('standalone option', () => {
it('should generate a standalone component', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('navigation', {...baseOptions, standalone: true}, app);
const module = getFileContent(tree, '/projects/material/src/app/app.module.ts');
const component = getFileContent(tree, '/projects/material/src/app/foo/foo.component.ts');
Expand Down
6 changes: 3 additions & 3 deletions src/material/schematics/ng-generate/table/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('material-table-schematic', () => {
});

it('should create table files and add them to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('table', baseOptions, app);
const files = tree.files;

Expand Down Expand Up @@ -47,7 +47,7 @@ describe('material-table-schematic', () => {
});

it('should add table imports to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('table', baseOptions, app);
const moduleContent = getFileContent(tree, '/projects/material/src/app/app.module.ts');

Expand All @@ -72,7 +72,7 @@ describe('material-table-schematic', () => {

describe('standalone option', () => {
it('should generate a standalone component', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('table', {...baseOptions, standalone: true}, app);
const module = getFileContent(tree, '/projects/material/src/app/app.module.ts');
const component = getFileContent(tree, '/projects/material/src/app/foo/foo.component.ts');
Expand Down
6 changes: 3 additions & 3 deletions src/material/schematics/ng-generate/tree/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Material tree schematic', () => {
});

it('should create tree component files and add them to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('tree', baseOptions, app);
const files = tree.files;

Expand All @@ -31,7 +31,7 @@ describe('Material tree schematic', () => {
});

it('should add tree imports to module', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('tree', baseOptions, app);
const moduleContent = getFileContent(tree, '/projects/material/src/app/app.module.ts');

Expand All @@ -50,7 +50,7 @@ describe('Material tree schematic', () => {

describe('standalone option', () => {
it('should generate a standalone component', async () => {
const app = await createTestApp(runner);
const app = await createTestApp(runner, {standalone: false});
const tree = await runner.runSchematic('tree', {...baseOptions, standalone: true}, app);
const module = getFileContent(tree, '/projects/material/src/app/app.module.ts');
const component = getFileContent(tree, '/projects/material/src/app/foo/foo.component.ts');
Expand Down
Loading

0 comments on commit 85a9e21

Please sign in to comment.