Skip to content

Commit

Permalink
fix(core): Update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham committed Sep 26, 2024
1 parent ca68a72 commit 0112af8
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 36 deletions.
10 changes: 5 additions & 5 deletions e2e/angular/src/cypress-component-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function createApp(appName: string) {
`generate @nx/angular:app ${appName} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(
`generate @nx/angular:component fancy-component --directory=${appName}/src/lib/fancy-component --no-interactive`
`generate @nx/angular:component ${appName}/src/lib/fancy-component/fancy-component --no-interactive`
);
}

Expand All @@ -145,10 +145,10 @@ function createLib(projectName: string, appName: string, libName: string) {
`generate @nx/angular:lib ${libName} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(
`generate @nx/angular:component btn --directory=${libName}/src/lib/btn --inlineTemplate --inlineStyle --export --no-interactive`
`generate @nx/angular:component ${libName}/src/lib/btn/btn --inlineTemplate --inlineStyle --export --no-interactive`
);
runCLI(
`generate @nx/angular:component btn-standalone --directory=${libName}/src/lib/btn-standalone --inlineTemplate --inlineStyle --export --standalone --no-interactive`
`generate @nx/angular:component ${libName}/src/lib/btn-standalone/btn-standalone --inlineTemplate --inlineStyle --export --standalone --no-interactive`
);
updateFile(
`${libName}/src/lib/btn/btn.component.ts`,
Expand Down Expand Up @@ -191,11 +191,11 @@ function createBuildableLib(projectName: string, libName: string) {
);
// create cmp for lib
runCLI(
`generate @nx/angular:component input --directory=${libName}/src/lib/input --inlineTemplate --inlineStyle --export --no-interactive`
`generate @nx/angular:component ${libName}/src/lib/input/input --inlineTemplate --inlineStyle --export --no-interactive`
);
// create standlone cmp for lib
runCLI(
`generate @nx/angular:component input-standalone --directory=${libName}/src/lib/input-standalone --inlineTemplate --inlineStyle --export --standalone --no-interactive`
`generate @nx/angular:component ${libName}/src/lib/input-standalone/input-standalone --inlineTemplate --inlineStyle --export --standalone --no-interactive`
);
// update cmp implmentation to use tailwind clasasserting in tests
updateFile(
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/src/cypress-legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Cypress E2E Test runner (legacy)', () => {
{ env: { NX_ADD_PLUGINS: 'false' } }
);
runCLI(
`generate @nx/react:component btn --directory=${appName}/src/app/btn --no-interactive`,
`generate @nx/react:component ${appName}/src/app/btn/btn --no-interactive`,
{ env: { NX_ADD_PLUGINS: 'false' } }
);
runCLI(
Expand Down
4 changes: 2 additions & 2 deletions e2e/cypress/src/cypress.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default defineConfig({
`generate @nx/next:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive --projectNameAndRootFormat=as-provided`
);
runCLI(
`generate @nx/next:component btn --project=${appName} --directory=apps/${appName}/components --nameAndDirectoryFormat=as-provided --no-interactive`
`generate @nx/next:component apps/${appName}/components/btn --no-interactive`
);
runCLI(
`generate @nx/next:cypress-component-configuration --project=${appName} --generate-tests --no-interactive`
Expand Down Expand Up @@ -186,7 +186,7 @@ export default defineConfig({
`generate @nx/angular:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive --bundler=webpack`
);
runCLI(
`generate @nx/angular:component btn --directory=apps/${appName}/src/app/btn --no-interactive`
`generate @nx/angular:component apps/${appName}/src/app/btn/btn --no-interactive`
);
runCLI(
`generate @nx/angular:cypress-component-configuration --project=${appName} --generate-tests --no-interactive`
Expand Down
2 changes: 1 addition & 1 deletion e2e/expo/src/expo-legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('@nx/expo (legacy)', () => {
const componentName = uniq('Component');

runCLI(
`generate @nx/expo:component ${componentName} --directory=libs/${libName}/src/${componentName} --export --no-interactive`
`generate @nx/expo:component libs/${libName}/src/${componentName} --name ${componentName} --export --no-interactive`
);

updateFile(`apps/${appName}/src/app/App.tsx`, (content) => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/next/src/next-component-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function createAppWithCt(appName: string) {
`generate @nx/next:app ${appName} --directory=apps/${appName} --no-interactive --appDir=false --src=false --projectNameAndRootFormat=as-provided`
);
runCLI(
`generate @nx/next:component button --project=${appName} --directory=apps/${appName}/components --nameAndDirectoryFormat=as-provided --no-interactive`
`generate @nx/next:component apps/${appName}/components/button --no-interactive`
);
createFile(
`apps/${appName}/public/data.json`,
Expand Down Expand Up @@ -191,7 +191,7 @@ function createLibWithCt(libName: string, buildable: boolean) {
);

runCLI(
`generate @nx/next:component button --directory=libs/${libName}/src/lib --export --no-interactive`
`generate @nx/next:component libs/${libName}/src/lib/button --export --no-interactive`
);
updateFile(`libs/${libName}/src/lib/button.tsx`, (content) => {
return `import { useEffect, useState } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion e2e/nuxt/src/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Nuxt Plugin', () => {
`generate @nx/nuxt:app ${app} --unitTestRunner=vitest --projectNameAndRootFormat=as-provided --e2eTestRunner=cypress`
);
runCLI(
`generate @nx/nuxt:component --directory=${app}/src/components/one --name=one --nameAndDirectoryFormat=as-provided --unitTestRunner=vitest`
`generate @nx/nuxt:component ${app}/src/components/one/one --name=one --unitTestRunner=vitest`
);
});

Expand Down
26 changes: 13 additions & 13 deletions e2e/plugin/src/nx-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Nx Plugin', () => {

runCLI(`generate @nx/plugin:plugin ${plugin} --linter=eslint`);
runCLI(
`generate @nx/plugin:migration --directory=${plugin}/src/migrations/update-${version} --packageVersion=${version} --packageJsonUpdates=false`
`generate @nx/plugin:migration --path=${plugin}/src/migrations/update-${version} --packageVersion=${version} --packageJsonUpdates=false`
);

const lintResults = runCLI(`lint ${plugin}`);
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('Nx Plugin', () => {

runCLI(`generate @nx/plugin:plugin ${plugin} --linter=eslint`);
runCLI(
`generate @nx/plugin:generator ${generator} --directory=${plugin}/src/generators/${generator}`
`generate @nx/plugin:generator ${plugin}/src/generators/${generator} --name ${generator}`
);

const lintResults = runCLI(`lint ${plugin}`);
Expand Down Expand Up @@ -129,7 +129,7 @@ describe('Nx Plugin', () => {

runCLI(`generate @nx/plugin:plugin ${plugin} --linter=eslint`);
runCLI(
`generate @nx/plugin:executor ${executor} --directory=${plugin}/src/executors/${executor} --includeHasher`
`generate @nx/plugin:executor --name ${executor} --path=${plugin}/src/executors/${executor} --includeHasher`
);

const lintResults = runCLI(`lint ${plugin}`);
Expand Down Expand Up @@ -178,31 +178,31 @@ describe('Nx Plugin', () => {
runCLI(`generate @nx/plugin:plugin ${plugin} --linter=eslint`);

runCLI(
`generate @nx/plugin:generator ${goodGenerator} --directory=${plugin}/src/generators/${goodGenerator}`
`generate @nx/plugin:generator --name=${goodGenerator} --path=${plugin}/src/generators/${goodGenerator}`
);

runCLI(
`generate @nx/plugin:generator ${badFactoryPath} --directory=${plugin}/src/generators/${badFactoryPath}`
`generate @nx/plugin:generator --name=${badFactoryPath} --path=${plugin}/src/generators/${badFactoryPath}`
);

runCLI(
`generate @nx/plugin:executor ${goodExecutor} --directory=${plugin}/src/executors/${goodExecutor}`
`generate @nx/plugin:executor --name=${goodExecutor} --path=${plugin}/src/executors/${goodExecutor}`
);

runCLI(
`generate @nx/plugin:executor ${badExecutorBadImplPath} --directory=${plugin}/src/executors/${badExecutorBadImplPath}`
`generate @nx/plugin:executor --name=${badExecutorBadImplPath} --path=${plugin}/src/executors/${badExecutorBadImplPath}`
);

runCLI(
`generate @nx/plugin:migration ${badMigrationVersion} --directory=${plugin} --packageVersion="invalid"`
`generate @nx/plugin:migration --name=${badMigrationVersion} --path=${plugin}/src/migrations --packageVersion="invalid"`
);

runCLI(
`generate @nx/plugin:migration ${missingMigrationVersion} --directory=${plugin}/migrations/0.1.0 --packageVersion="0.1.0"`
`generate @nx/plugin:migration --name=${missingMigrationVersion} --path=${plugin}/migrations/0.1.0 --packageVersion="0.1.0"`
);

runCLI(
`generate @nx/plugin:migration ${goodMigration} --directory=${plugin}/migrations/0.1.0 --packageVersion="0.1.0"`
`generate @nx/plugin:migration --name=${goodMigration} --path=${plugin}/migrations/0.1.0 --packageVersion="0.1.0"`
);

updateFile(`${plugin}/generators.json`, (f) => {
Expand Down Expand Up @@ -348,11 +348,11 @@ describe('Nx Plugin', () => {
const generatedProject = uniq('project');

runCLI(
`generate @nx/plugin:generator ${generator} --directory=${plugin}/src/generators/${generator}`
`generate @nx/plugin:generator --name ${generator} --path ${plugin}/src/generators/${generator}`
);

runCLI(
`generate @nx/plugin:executor ${executor} --directory=${plugin}/src/executors/${executor}`
`generate @nx/plugin:executor --name ${executor} --path ${plugin}/src/executors/${executor}`
);

updateFile(
Expand Down Expand Up @@ -389,7 +389,7 @@ describe('Nx Plugin', () => {

expect(() => {
runCLI(
`generate @nx/plugin:generator ${generator} --directory=${plugin}/src/generators/${generator}`
`generate @nx/plugin:generator ${plugin}/src/generators/${generator} --name ${generator}`
);

runCLI(
Expand Down
2 changes: 1 addition & 1 deletion e2e/react-native/src/react-native-legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('@nx/react-native (legacy)', () => {
it('should test and lint', async () => {
const componentName = uniq('Component');
runCLI(
`generate @nx/react-native:component ${componentName} --directory=libs/${libName}/src/lib/${componentName} --export --no-interactive`
`generate @nx/react-native:component libs/${libName}/src/lib/${componentName}/${componentName} --export --no-interactive`
);

updateFile(`apps/${appName}/src/app/App.tsx`, (content) => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/react/src/cypress-component-tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ describe('React Cypress Component Tests', () => {
}));

runCLI(
`generate @nx/react:component fancy-cmp --directory=apps/${appName}/src/app/fancy-cmp --no-interactive`
`generate @nx/react:component apps/${appName}/src/app/fancy-cmp/fancy-cmp --no-interactive`
);
runCLI(
`generate @nx/react:lib ${usedInAppLibName} --directory=libs/${usedInAppLibName} --no-interactive --unitTestRunner=jest`
);
runCLI(
`generate @nx/react:component btn --directory=libs/${usedInAppLibName}/src/lib/btn --export --no-interactive`
`generate @nx/react:component libs/${usedInAppLibName}/src/lib/btn/btn --export --no-interactive`
);
// makes sure custom webpack is loading
createFile(
Expand Down
4 changes: 2 additions & 2 deletions e2e/react/src/react-vite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ describe('Build React applications and libraries with Vite', () => {
}).toThrow();

runCLI(
`generate @nx/react:component comp1 --inSourceTests --export --directory=libs/${viteLib}/src/lib/comp1 --no-interactive`
`generate @nx/react:component libs/${viteLib}/src/lib/comp1/comp1 --inSourceTests --export --no-interactive`
);
expect(() => {
checkFilesExist(`libs/${viteLib}/src/lib/comp1/comp1.spec.tsx`);
}).toThrow();

runCLI(
`generate @nx/react:component comp2 --export --directory=libs/${viteLib}/src/lib/comp2 --no-interactive`
`generate @nx/react:component libs/${viteLib}/src/lib/comp2/comp2 --export --no-interactive`
);
checkFilesExist(`libs/${viteLib}/src/lib/comp2/comp2.spec.tsx`);

Expand Down
6 changes: 3 additions & 3 deletions e2e/react/src/react.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('React Applications', () => {
`generate @nx/react:lib ${libName} --directory=libs${libName} --style=css --no-interactive --unit-test-runner=jest --skipFormat`
);
runCLI(
`generate @nx/react:lib ${libWithNoComponents} --directory=libs${libWithNoComponents} --no-interactive --no-component --unit-test-runner=jest --skipFormat`
`generate @nx/react:lib ${libWithNoComponents} --directory=libs/${libWithNoComponents} --no-interactive --no-component --unit-test-runner=jest --skipFormat`
);

// Libs should not include package.json by default
Expand Down Expand Up @@ -184,13 +184,13 @@ describe('React Applications', () => {
`g @nx/react:app ${appName} --directory=apps/${appName} --bundler=webpack --no-interactive --skipFormat`
);
runCLI(
`g @nx/react:redux lemon --directory=apps/${appName}/src/app/lemon --skipFormat`
`g @nx/react:redux apps/${appName}/src/app/lemon/lemon --skipFormat`
);
runCLI(
`g @nx/react:lib ${libName} --directory=libs/${libName} --unit-test-runner=jest --no-interactive --skipFormat`
);
runCLI(
`g @nx/react:redux orange --directory=libs/${libName}/src/lib/orange --skipFormat`
`g @nx/react:redux libs/${libName}/src/lib/orange/orange --skipFormat`
);

let lintResults = runCLI(`lint ${appName}`);
Expand Down
4 changes: 2 additions & 2 deletions e2e/workspace-create/src/create-nx-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ describe('create-nx-plugin', () => {
);

runCLI(
`generate @nx/plugin:generator ${generatorName} --directory=${pluginName}/src/generators/${generatorName}`
`generate @nx/plugin:generator ${pluginName}/src/generators/${generatorName} --name ${generatorName}`
);
runCLI(
`generate @nx/plugin:executor ${executorName} --directory=${pluginName}/src/executors/${executorName}`
`generate @nx/plugin:executor ${pluginName}/src/executors/${executorName} --name ${executorName}`
);

runCLI(`build ${pluginName}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/generators/redux/redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ async function normalizeOptions(
...options,
...extraNames,
fileName,
constantName: names(options.name).constantName.toUpperCase(),
constantName: names(name).constantName.toUpperCase(),
projectDirectory: directory,
projectType,
projectSourcePath: sourceRoot,
Expand Down

0 comments on commit 0112af8

Please sign in to comment.