Skip to content

Commit

Permalink
test(@angular/cli): fix failing LTS e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 committed Nov 23, 2021
1 parent d6582d4 commit d0924da
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
18 changes: 9 additions & 9 deletions tests/legacy-cli/e2e/assets/webpack/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "test",
"license": "MIT",
"dependencies": {
"@angular/common": "9.0.0",
"@angular/compiler": "9.0.0",
"@angular/compiler-cli": "9.0.0",
"@angular/core": "9.0.0",
"@angular/platform-browser": "9.0.0",
"@angular/platform-browser-dynamic": "9.0.0",
"@angular/platform-server": "9.0.0",
"@angular/router": "9.0.0",
"@angular/common": "^10.0.0",
"@angular/compiler": "^10.0.0",
"@angular/compiler-cli": "^10.0.0",
"@angular/core": "^10.0.0",
"@angular/platform-browser": "^10.0.0",
"@angular/platform-browser-dynamic": "^10.0.0",
"@angular/platform-server": "^10.0.0",
"@angular/router": "^10.0.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^3.0.0",
"rxjs": "^6.4.0",
Expand All @@ -20,7 +20,7 @@
"performance-now": "^0.2.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.0",
"typescript": "~3.6.4",
"typescript": "~4.0.2",
"webpack": "~4.0.1",
"webpack-cli": "~2.0.9"
}
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/tests/build/material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default async function () {

await silentNpm('install');
} else {
await silentNpm('install', '@angular/material-moment-adapter');
await silentNpm('install', '@angular/material-moment-adapter@10');
}

await silentNpm('install', 'moment');
Expand Down
35 changes: 19 additions & 16 deletions tests/legacy-cli/e2e/tests/commands/add/add-pwa-yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@ import { expectFileToExist, readFile, rimraf } from '../../../utils/fs';
import { ng, npm } from '../../../utils/process';

export default async function () {
// forcibly remove in case another test doesn't clean itself up
await rimraf('node_modules/@angular/pwa');
// forcibly remove in case another test doesn't clean itself up
await rimraf('node_modules/@angular/pwa');

// set yarn as package manager
await ng('config', 'cli.packageManager', 'yarn');
await ng('add', '@angular/pwa');
await expectFileToExist(join(process.cwd(), 'src/manifest.webmanifest'));
// set yarn as package manager
await ng('config', 'cli.packageManager', 'yarn');
await ng('add', '@angular/pwa', '--registry=http://localhost:4873');
await expectFileToExist(join(process.cwd(), 'src/manifest.webmanifest'));

// Angular PWA doesn't install as a dependency
const { dependencies, devDependencies } = JSON.parse(await readFile(join(process.cwd(), 'package.json')));
const hasPWADep = Object.keys({ ...dependencies, ...devDependencies })
.some(d => d === '@angular/pwa');
if (hasPWADep) {
throw new Error(`Expected 'package.json' not to contain a dependency on '@angular/pwa'.`);
}
// Angular PWA doesn't install as a dependency
const { dependencies, devDependencies } = JSON.parse(
await readFile(join(process.cwd(), 'package.json')),
);
const hasPWADep = Object.keys({ ...dependencies, ...devDependencies }).some(
(d) => d === '@angular/pwa',
);
if (hasPWADep) {
throw new Error(`Expected 'package.json' not to contain a dependency on '@angular/pwa'.`);
}

// 'yarn' will nuke the entire node_modules when it is triggered during the above tests.
await rimraf('node_modules');
await npm('install');
// 'yarn' will nuke the entire node_modules when it is triggered during the above tests.
await rimraf('node_modules');
await npm('install');
}

0 comments on commit d0924da

Please sign in to comment.