Skip to content

Commit

Permalink
chore(angular): fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez committed Feb 25, 2022
1 parent b22a609 commit a4ee567
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 4 additions & 4 deletions e2e/angular-core/src/ng-add.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
updateFile('tsconfig.json', JSON.stringify(tsConfig, null, 2));

// add an extra script file
updateFile('src/scripts.ts', 'const x = 1;');
updateFile('src/scripts.js', 'const x = 1;');

// update angular.json
const angularJson = readJson('angular.json');
angularJson.projects[project].architect.build.options.scripts =
angularJson.projects[project].architect.test.options.scripts = [
'src/scripts.ts',
'src/scripts.js',
];
angularJson.projects[project].architect.test.options.styles = [
'src/styles.css',
Expand Down Expand Up @@ -181,7 +181,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
`apps/${project}/src/assets`,
],
styles: [`apps/${project}/src/styles.css`],
scripts: [`apps/${project}/src/scripts.ts`],
scripts: [`apps/${project}/src/scripts.js`],
},
configurations: {
production: {
Expand Down Expand Up @@ -236,7 +236,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
`apps/${project}/src/assets`,
],
styles: [`apps/${project}/src/styles.css`],
scripts: [`apps/${project}/src/scripts.ts`],
scripts: [`apps/${project}/src/scripts.js`],
},
});

Expand Down
6 changes: 1 addition & 5 deletions e2e/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,10 @@ export function runNgNew(
): string {
projName = projectName;

// Use the latest version of the currently supported @angular/cli major version
// to cover existing usage out there while avoiding the tests to fail when a new
// major comes out and is still not supported
const ngCliMajorVersion = coerce(angularCliVersion).major;
const npmMajorVersion = getNpmMajorVersion();
const command = `npx ${
+npmMajorVersion >= 7 ? '--yes' : ''
} @angular/cli@${ngCliMajorVersion} new ${projectName} --package-manager=${packageManager}`;
} @angular/cli@${angularCliVersion} new ${projectName} --package-manager=${packageManager}`;

return execSync(command, {
cwd: e2eCwd,
Expand Down

0 comments on commit a4ee567

Please sign in to comment.