Skip to content

Commit

Permalink
update workspace and use Jest v27
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJW34 authored and BuckyMaler committed Sep 6, 2021
1 parent 8f7a3bb commit f3a8342
Show file tree
Hide file tree
Showing 32 changed files with 1,854 additions and 1,182 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/dist
/coverage
/.github
/tmp
4 changes: 1 addition & 3 deletions apps/docusaurus-e2e/tests/docusaurus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@nrwl/nx-plugin/testing';

describe('docusaurus e2e', () => {
it('should create and build docusaurus', async (done) => {
it('should create and build docusaurus', async () => {
const appName = uniq('docusaurus');
ensureNxProject('@nx-plus/docusaurus', 'dist/libs/docusaurus');
await runNxCommandAsync(`generate @nx-plus/docusaurus:app ${appName}`);
Expand All @@ -14,7 +14,5 @@ describe('docusaurus e2e', () => {
expect(result.stdout).toContain(
`Success! Generated static files in "dist/apps/${appName}".`
);

done();
}, 100000);
});
21 changes: 6 additions & 15 deletions apps/nuxt-e2e/tests/nuxt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {
uniq,
updateFile,
} from '@nrwl/nx-plugin/testing';

describe('nuxt e2e', () => {
it('should generate app', async (done) => {
it('should generate app', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/nuxt', 'dist/libs/nuxt');
await runNxCommandAsync(`generate @nx-plus/nuxt:app ${appName}`);
Expand Down Expand Up @@ -52,11 +53,9 @@ describe('nuxt e2e', () => {
`e2e ${appName}-e2e --prod --headless`
);
expect(prodE2eResult.stdout).toContain('All specs passed!');

done();
}, 300000);

it('should report lint error in index.vue', async (done) => {
it('should report lint error in index.vue', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/nuxt', 'dist/libs/nuxt');
await runNxCommandAsync(`generate @nx-plus/nuxt:app ${appName}`);
Expand All @@ -70,11 +69,9 @@ describe('nuxt e2e', () => {
silenceError: true,
});
expect(result.stderr).toContain('Lint errors found in the listed files.');

done();
}, 300000);

it('should generate static app', async (done) => {
it('should generate static app', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/nuxt', 'dist/libs/nuxt');
await runNxCommandAsync(`generate @nx-plus/nuxt:app ${appName}`);
Expand All @@ -90,12 +87,10 @@ describe('nuxt e2e', () => {
`dist/apps/${appName}/dist/README.md`
)
).not.toThrow();

done();
}, 300000);

describe('--directory subdir', () => {
it('should generate app', async (done) => {
it('should generate app', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/nuxt', 'dist/libs/nuxt');
await runNxCommandAsync(
Expand Down Expand Up @@ -124,11 +119,9 @@ describe('nuxt e2e', () => {
`dist/apps/subdir/${appName}/.nuxt/components`
)
).not.toThrow();

done();
}, 300000);

it('should generate static app', async (done) => {
it('should generate static app', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/nuxt', 'dist/libs/nuxt');
await runNxCommandAsync(
Expand All @@ -146,8 +139,6 @@ describe('nuxt e2e', () => {
`dist/apps/subdir/${appName}/dist/README.md`
)
).not.toThrow();

done();
}, 300000);
});
});
4 changes: 1 addition & 3 deletions apps/vue-e2e/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ export async function testGeneratedApp(
// a production build. Jest sets `NODE_ENV` to `test` by default.
// This function is very similar to `runCommandAsync`.
// https://github.com/nrwl/nx/blob/9.5.1/packages/nx-plugin/src/utils/testing-utils/async-commands.ts#L10
export function runNxProdCommandAsync(
command: string
): Promise<{
export function runNxProdCommandAsync(command: string): Promise<{
stdout: string;
stderr: string;
}> {
Expand Down
48 changes: 12 additions & 36 deletions apps/vue-e2e/tests/vue-2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { runNxProdCommandAsync, testGeneratedApp } from './utils';

describe('vue 2 e2e', () => {
describe('app', () => {
it('should generate app', async (done) => {
it('should generate app', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(`generate @nx-plus/vue:app ${appName}`);
Expand All @@ -22,12 +22,10 @@ describe('vue 2 e2e', () => {
build: true,
buildProd: true,
});

done();
}, 300000);

describe('--routing', () => {
it('should generate app with routing', async (done) => {
it('should generate app with routing', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(
Expand All @@ -48,13 +46,11 @@ describe('vue 2 e2e', () => {
`dist/apps/${appName}/js/about.js.map`
)
).not.toThrow();

done();
}, 300000);
});

describe('--style', () => {
it('should generate app with scss', async (done) => {
it('should generate app with scss', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(
Expand All @@ -68,11 +64,9 @@ describe('vue 2 e2e', () => {
build: true,
buildProd: true,
});

done();
}, 300000);

it('should generate app with stylus', async (done) => {
it('should generate app with stylus', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(
Expand All @@ -86,11 +80,9 @@ describe('vue 2 e2e', () => {
build: true,
buildProd: true,
});

done();
}, 300000);

it('should generate app with less', async (done) => {
it('should generate app with less', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(
Expand All @@ -104,13 +96,11 @@ describe('vue 2 e2e', () => {
build: true,
buildProd: true,
});

done();
}, 300000);
});

describe('vuex', () => {
it('should generate app and add vuex', async (done) => {
it('should generate app and add vuex', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(`generate @nx-plus/vue:app ${appName}`);
Expand All @@ -123,12 +113,10 @@ describe('vue 2 e2e', () => {
build: true,
buildProd: true,
});

done();
}, 300000);
});

it('should generate app with routing and add vuex', async (done) => {
it('should generate app with routing and add vuex', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(`generate @nx-plus/vue:app ${appName} --routing`);
Expand All @@ -148,11 +136,9 @@ describe('vue 2 e2e', () => {
`dist/apps/${appName}/js/about.js.map`
)
).not.toThrow();

done();
}, 300000);

it('should report lint error in App.vue', async (done) => {
it('should report lint error in App.vue', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(`generate @nx-plus/vue:app ${appName}`);
Expand All @@ -166,12 +152,10 @@ describe('vue 2 e2e', () => {
silenceError: true,
});
expect(result.stderr).toContain('Lint errors found in the listed files.');

done();
}, 300000);

describe('--directory subdir', () => {
it('should generate app', async (done) => {
it('should generate app', async () => {
const appName = uniq('app');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(
Expand All @@ -188,14 +172,12 @@ describe('vue 2 e2e', () => {
`dist/apps/subdir/${appName}/img/logo.png`
)
).not.toThrow();

done();
}, 300000);
});
});

describe('library', () => {
it('should generate lib', async (done) => {
it('should generate lib', async () => {
const lib = uniq('lib');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(`generate @nx-plus/vue:lib ${lib}`);
Expand All @@ -209,11 +191,9 @@ describe('vue 2 e2e', () => {
Tests: 1 passed, 1 total
Snapshots: 0 total
`);

done();
}, 300000);

it('should generate publishable lib', async (done) => {
it('should generate publishable lib', async () => {
const lib = uniq('lib');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(`generate @nx-plus/vue:lib ${lib} --publishable`);
Expand Down Expand Up @@ -263,12 +243,10 @@ describe('vue 2 e2e', () => {
`dist/libs/${lib}/${lib}.umd.min.js.map`
)
).toThrow();

done();
}, 300000);

describe('--directory subdir', () => {
it('should generate publishable lib', async (done) => {
it('should generate publishable lib', async () => {
const lib = uniq('lib');
ensureNxProject('@nx-plus/vue', 'dist/libs/vue');
await runNxCommandAsync(
Expand All @@ -290,8 +268,6 @@ describe('vue 2 e2e', () => {
`dist/libs/subdir/${lib}/package.json`
)
).not.toThrow();

done();
}, 300000);
});
});
Expand Down
Loading

0 comments on commit f3a8342

Please sign in to comment.