Skip to content

Commit

Permalink
chore(repo): replace references to @nrwl in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz committed Apr 24, 2023
1 parent a2b1176 commit d5c4c1e
Show file tree
Hide file tree
Showing 69 changed files with 545 additions and 567 deletions.
14 changes: 7 additions & 7 deletions e2e/angular-core/src/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {
runCLI,
uniq,
updateFile,
} from '@nrwl/e2e/utils';
} from '@nx/e2e/utils';

describe('angular.json v1 config', () => {
const app1 = uniq('app1');

beforeAll(() => {
newProject();
runCLI(`generate @nrwl/angular:app ${app1} --no-interactive`);
runCLI(`generate @nx/angular:app ${app1} --no-interactive`);
// reset workspace to use v1 config
updateFile(`angular.json`, angularV1Json(app1));
removeFile(`apps/${app1}/project.json`);
Expand All @@ -31,7 +31,7 @@ describe('angular.json v1 config', () => {
it('should generate new app with project.json and keep the existing in angular.json', async () => {
// create new app
const app2 = uniq('app2');
runCLI(`generate @nrwl/angular:app ${app2} --no-interactive`);
runCLI(`generate @nx/angular:app ${app2} --no-interactive`);

// should generate project.json for new projects
checkFilesExist(`apps/${app2}/project.json`);
Expand Down Expand Up @@ -116,7 +116,7 @@ const angularV1Json = (appName: string) => `{
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"builder": "@nx/linter:eslint",
"options": {
"lintFilePatterns": [
"apps/${appName}/src/**/*.ts",
Expand All @@ -125,7 +125,7 @@ const angularV1Json = (appName: string) => `{
}
},
"test": {
"builder": "@nrwl/jest:jest",
"builder": "@nx/jest:jest",
"outputs": ["coverage/apps/${appName}"],
"options": {
"jestConfig": "apps/${appName}/jest.config.ts",
Expand All @@ -141,7 +141,7 @@ const angularV1Json = (appName: string) => `{
"projectType": "application",
"architect": {
"e2e": {
"builder": "@nrwl/cypress:cypress",
"builder": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/${appName}-e2e/cypress.json",
"devServerTarget": "${appName}:serve:development",
Expand All @@ -154,7 +154,7 @@ const angularV1Json = (appName: string) => `{
}
},
"lint": {
"builder": "@nrwl/linter:eslint",
"builder": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/${appName}-e2e/**/*.{js,ts}"]
Expand Down
22 changes: 10 additions & 12 deletions e2e/angular-core/src/module-federation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
runCommandUntil,
uniq,
updateFile,
} from '@nrwl/e2e/utils';
} from '@nx/e2e/utils';

describe('Angular Module Federation', () => {
let proj: string;
Expand All @@ -33,12 +33,10 @@ describe('Angular Module Federation', () => {
const remotePort = 4301;

// generate host app
runCLI(
`generate @nrwl/angular:host ${hostApp} --style=css --no-interactive`
);
runCLI(`generate @nx/angular:host ${hostApp} --style=css --no-interactive`);
// generate remote app
runCLI(
`generate @nrwl/angular:remote ${remoteApp1} --host=${hostApp} --port=${remotePort} --style=css --no-interactive`
`generate @nx/angular:remote ${remoteApp1} --host=${hostApp} --port=${remotePort} --style=css --no-interactive`
);

// check default generated host is built successfully
Expand All @@ -47,10 +45,10 @@ describe('Angular Module Federation', () => {

// generate a shared lib with a seconary entry point
runCLI(
`generate @nrwl/angular:library ${sharedLib} --buildable --no-interactive`
`generate @nx/angular:library ${sharedLib} --buildable --no-interactive`
);
runCLI(
`generate @nrwl/angular:library-secondary-entry-point --library=${sharedLib} --name=${secondaryEntry} --no-interactive`
`generate @nx/angular:library-secondary-entry-point --library=${sharedLib} --name=${secondaryEntry} --no-interactive`
);
// update host & remote files to use shared library
updateFile(
Expand Down Expand Up @@ -139,16 +137,16 @@ describe('Angular Module Federation', () => {

// generate apps
runCLI(
`generate @nrwl/angular:application ${app1} --routing --no-interactive`
`generate @nx/angular:application ${app1} --routing --no-interactive`
);
runCLI(`generate @nrwl/angular:application ${app2} --no-interactive`);
runCLI(`generate @nx/angular:application ${app2} --no-interactive`);

// convert apps
runCLI(
`generate @nrwl/angular:setup-mf ${app1} --mfType=host --port=${app1Port} --no-interactive`
`generate @nx/angular:setup-mf ${app1} --mfType=host --port=${app1Port} --no-interactive`
);
runCLI(
`generate @nrwl/angular:setup-mf ${app2} --mfType=remote --host=${app1} --port=${app2Port} --no-interactive`
`generate @nx/angular:setup-mf ${app2} --mfType=remote --host=${app1} --port=${app2Port} --no-interactive`
);

const process = await runCommandUntil(
Expand All @@ -170,7 +168,7 @@ describe('Angular Module Federation', () => {

// generate remote apps
runCLI(
`generate @nrwl/angular:host ${host} --ssr --remotes=${remote1},${remote2} --no-interactive`
`generate @nx/angular:host ${host} --ssr --remotes=${remote1},${remote2} --no-interactive`
);

// ports
Expand Down
18 changes: 9 additions & 9 deletions e2e/angular-core/src/ng-add.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
runNgNew,
uniq,
updateFile,
} from '@nrwl/e2e/utils';
} from '@nx/e2e/utils';
import { PackageManager } from 'nx/src/utils/package-manager';

describe('convert Angular CLI workspace to an Nx workspace', () => {
Expand Down Expand Up @@ -101,11 +101,11 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
];
updateFile('angular.json', JSON.stringify(angularJson, null, 2));

// confirm that @nrwl dependencies do not exist yet
// confirm that @nx dependencies do not exist yet
expect(packageJson.devDependencies['@nx/workspace']).not.toBeDefined();

// run ng add
runNgAdd('@nrwl/angular', '--npm-scope projscope --default-base main');
runNgAdd('@nx/angular', '--npm-scope projscope --default-base main');

// check that prettier config exits and that files have been moved
checkFilesExist(
Expand Down Expand Up @@ -268,7 +268,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
it('should handle a workspace with cypress v9', () => {
addCypress9();

runNgAdd('@nrwl/angular', '--npm-scope projscope --skip-install');
runNgAdd('@nx/angular', '--npm-scope projscope --skip-install');

const e2eProject = `${project}-e2e`;
//check e2e project files
Expand Down Expand Up @@ -335,7 +335,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
it('should handle a workspace with cypress v10', () => {
addCypress10();

runNgAdd('@nrwl/angular', '--npm-scope projscope --skip-install');
runNgAdd('@nx/angular', '--npm-scope projscope --skip-install');

const e2eProject = `${project}-e2e`;
//check e2e project files
Expand Down Expand Up @@ -400,12 +400,12 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
});

// TODO(leo): The current Verdaccio setup fails to resolve older versions
// of @nrwl/* packages, the @angular-eslint/builder package depends on an
// older version of @nrwl/devkit so we skip this test for now.
// of @nx/* packages, the @angular-eslint/builder package depends on an
// older version of @nx/devkit so we skip this test for now.
it.skip('should handle a workspace with ESLint', () => {
addEsLint();

runNgAdd('@nrwl/angular', '--npm-scope projscope');
runNgAdd('@nx/angular', '--npm-scope projscope');

checkFilesExist(`apps/${project}/.eslintrc.json`, `.eslintrc.json`);

Expand Down Expand Up @@ -442,7 +442,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
runCommand(`ng g @schematics/angular:application ${app1}`);
runCommand(`ng g @schematics/angular:library ${lib1}`);

runNgAdd('@nrwl/angular', '--npm-scope projscope');
runNgAdd('@nx/angular', '--npm-scope projscope');

// check angular.json does not exist
checkFilesDoNotExist('angular.json');
Expand Down
22 changes: 11 additions & 11 deletions e2e/angular-core/src/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
uniq,
updateFile,
updateProjectConfig,
} from '@nrwl/e2e/utils';
} from '@nx/e2e/utils';
import { normalize } from 'path';

describe('Angular Projects', () => {
Expand All @@ -27,9 +27,9 @@ describe('Angular Projects', () => {

beforeAll(() => {
proj = newProject();
runCLI(`generate @nrwl/angular:app ${app1} --no-interactive`);
runCLI(`generate @nx/angular:app ${app1} --no-interactive`);
runCLI(
`generate @nrwl/angular:lib ${lib1} --add-module-spec --no-interactive`
`generate @nx/angular:lib ${lib1} --add-module-spec --no-interactive`
);
app1DefaultModule = readFile(`apps/${app1}/src/app/app.module.ts`);
app1DefaultComponentTemplate = readFile(
Expand All @@ -50,7 +50,7 @@ describe('Angular Projects', () => {
it('should successfully generate apps and libs and work correctly', async () => {
const standaloneApp = uniq('standalone-app');
runCLI(
`generate @nrwl/angular:app ${standaloneApp} --directory=myDir --standalone=true --no-interactive`
`generate @nx/angular:app ${standaloneApp} --directory=myDir --standalone=true --no-interactive`
);

updateFile(
Expand Down Expand Up @@ -162,10 +162,10 @@ describe('Angular Projects', () => {
const buildableChildLib = uniq('buildlib2');

runCLI(
`generate @nrwl/angular:library ${buildableLib} --buildable=true --no-interactive`
`generate @nx/angular:library ${buildableLib} --buildable=true --no-interactive`
);
runCLI(
`generate @nrwl/angular:library ${buildableChildLib} --buildable=true --no-interactive`
`generate @nx/angular:library ${buildableChildLib} --buildable=true --no-interactive`
);

// update the app module to include a ref to the buildable lib
Expand Down Expand Up @@ -211,7 +211,7 @@ describe('Angular Projects', () => {

// update the angular.json
updateProjectConfig(app1, (config) => {
config.targets.build.executor = '@nrwl/angular:webpack-browser';
config.targets.build.executor = '@nx/angular:webpack-browser';
config.targets.build.options = {
...config.targets.build.options,
buildLibsFromSource: false,
Expand Down Expand Up @@ -241,17 +241,17 @@ describe('Angular Projects', () => {
const entryPoint = uniq('entrypoint');

runCLI(
`generate @nrwl/angular:lib ${lib} --publishable --importPath=@${proj}/${lib} --no-interactive`
`generate @nx/angular:lib ${lib} --publishable --importPath=@${proj}/${lib} --no-interactive`
);
runCLI(
`generate @nrwl/angular:secondary-entry-point --name=${entryPoint} --library=${lib} --no-interactive`
`generate @nx/angular:secondary-entry-point --name=${entryPoint} --library=${lib} --no-interactive`
);

runCLI(
`generate @nrwl/angular:library ${childLib} --publishable=true --importPath=@${proj}/${childLib} --no-interactive`
`generate @nx/angular:library ${childLib} --publishable=true --importPath=@${proj}/${childLib} --no-interactive`
);
runCLI(
`generate @nrwl/angular:secondary-entry-point --name=sub --library=${childLib} --no-interactive`
`generate @nx/angular:secondary-entry-point --name=sub --library=${childLib} --no-interactive`
);

const moduleContent = `
Expand Down
28 changes: 13 additions & 15 deletions e2e/angular-extensions/src/cypress-component-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Angular Cypress Component Tests', () => {

it('should test app', () => {
runCLI(
`generate @nrwl/angular:cypress-component-configuration --project=${appName} --generate-tests --no-interactive`
`generate @nx/angular:cypress-component-configuration --project=${appName} --generate-tests --no-interactive`
);
if (runCypressTests()) {
expect(runCLI(`component-test ${appName} --no-watch`)).toContain(
Expand All @@ -48,7 +48,7 @@ describe('Angular Cypress Component Tests', () => {

it('should successfully component test lib being used in app', () => {
runCLI(
`generate @nrwl/angular:cypress-component-configuration --project=${usedInAppLibName} --generate-tests --no-interactive`
`generate @nx/angular:cypress-component-configuration --project=${usedInAppLibName} --generate-tests --no-interactive`
);
if (runCypressTests()) {
expect(runCLI(`component-test ${usedInAppLibName} --no-watch`)).toContain(
Expand All @@ -61,24 +61,22 @@ describe('Angular Cypress Component Tests', () => {
expect(() => {
// should error since no edge in graph between lib and app
runCLI(
`generate @nrwl/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests --no-interactive`
`generate @nx/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests --no-interactive`
);
}).toThrow();

updateTestToAssertTailwindIsNotApplied(buildableLibName);

runCLI(
`generate @nrwl/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests --build-target=${appName}:build --no-interactive`
`generate @nx/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests --build-target=${appName}:build --no-interactive`
);
if (runCypressTests()) {
expect(runCLI(`component-test ${buildableLibName} --no-watch`)).toContain(
'All specs passed!'
);
}
// add tailwind
runCLI(
`generate @nrwl/angular:setup-tailwind --project=${buildableLibName}`
);
runCLI(`generate @nx/angular:setup-tailwind --project=${buildableLibName}`);
updateFile(
`libs/${buildableLibName}/src/lib/input/input.component.cy.ts`,
(content) => {
Expand Down Expand Up @@ -133,19 +131,19 @@ describe('Angular Cypress Component Tests', () => {
});

function createApp(appName: string) {
runCLI(`generate @nrwl/angular:app ${appName} --no-interactive`);
runCLI(`generate @nx/angular:app ${appName} --no-interactive`);
runCLI(
`generate @nrwl/angular:component fancy-component --project=${appName} --no-interactive`
`generate @nx/angular:component fancy-component --project=${appName} --no-interactive`
);
}

function createLib(projectName: string, appName: string, libName: string) {
runCLI(`generate @nrwl/angular:lib ${libName} --no-interactive`);
runCLI(`generate @nx/angular:lib ${libName} --no-interactive`);
runCLI(
`generate @nrwl/angular:component btn --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
`generate @nx/angular:component btn --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
);
runCLI(
`generate @nrwl/angular:component btn-standalone --project=${libName} --inlineTemplate --inlineStyle --export --standalone --no-interactive`
`generate @nx/angular:component btn-standalone --project=${libName} --inlineTemplate --inlineStyle --export --standalone --no-interactive`
);
updateFile(
`libs/${libName}/src/lib/btn/btn.component.ts`,
Expand Down Expand Up @@ -183,14 +181,14 @@ export class BtnStandaloneComponent {

function createBuildableLib(projectName: string, libName: string) {
// create lib
runCLI(`generate @nrwl/angular:lib ${libName} --buildable --no-interactive`);
runCLI(`generate @nx/angular:lib ${libName} --buildable --no-interactive`);
// create cmp for lib
runCLI(
`generate @nrwl/angular:component input --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
`generate @nx/angular:component input --project=${libName} --inlineTemplate --inlineStyle --export --no-interactive`
);
// create standlone cmp for lib
runCLI(
`generate @nrwl/angular:component input-standalone --project=${libName} --inlineTemplate --inlineStyle --export --standalone --no-interactive`
`generate @nx/angular:component input-standalone --project=${libName} --inlineTemplate --inlineStyle --export --standalone --no-interactive`
);
// update cmp implmentation to use tailwind clasasserting in tests
updateFile(
Expand Down
Loading

0 comments on commit d5c4c1e

Please sign in to comment.