Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ runs:
shell: bash
run: npx nx affected --target=test --base=last-release

# - name: E2E Tests
# shell: bash
# run: npx nx affected --target=e2e --base=last-release
- name: E2E Tests
shell: bash
run: npx nx affected --target=e2e --base=last-release

# - name: Codecov upload
# uses: codecov/codecov-action@v2
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
save-exact = true
save-exact=true
auto-install-peers=true
60 changes: 36 additions & 24 deletions e2e/qwik-nx-e2e/tests/qwik-nx.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import {
checkFilesExist,
ensureNxProject,
readJson,
runNxCommandAsync,
uniq,
} from '@nrwl/nx-plugin/testing';

import {
runCommandUntil,
promisifiedTreeKill,
killPort,
} from '@qwikifiers/e2e/utils';

describe('qwik-nx e2e', () => {
// Setting up individual workspaces per
// test can cause e2e runs to take a long time.
Expand All @@ -23,34 +28,41 @@ describe('qwik-nx e2e', () => {
runNxCommandAsync('reset');
});

it('should create qwik-nx', async () => {
const project = uniq('qwik-nx');
await runNxCommandAsync(`generate qwik-nx:app ${project}`);
const result = await runNxCommandAsync(`build ${project}`);
expect(result.stdout).toContain('Executor ran');
}, 120000);

describe('--directory', () => {
it('should create src in the specified directory', async () => {
const project = uniq('qwik-nx');
describe('Basic behavior', () => {
let project: string;
beforeAll(async () => {
project = uniq('qwik-nx');
await runNxCommandAsync(
`generate qwik-nx:app ${project} --directory subdir`
`generate qwik-nx:app ${project} --no-interactive`
);
}, 200000);
it('should create qwik-nx', async () => {
const result = await runNxCommandAsync(`build-ssr ${project}`);
expect(result.stdout).toContain(
`Successfully ran target build-ssr for project ${project}`
);
expect(() =>
checkFilesExist(`libs/subdir/${project}/src/index.ts`)
checkFilesExist(`dist/apps/${project}/client/q-manifest.json`)
).not.toThrow();
}, 120000);
});
expect(() =>
checkFilesExist(`dist/apps/${project}/server/entry.preview.mjs`)
).not.toThrow();
}, 200000);

describe('--tags', () => {
it('should add tags to the project', async () => {
const projectName = uniq('qwik-nx');
ensureNxProject('qwik-nx', 'dist/packages/qwik-nx');
await runNxCommandAsync(
`generate qwik-nx:app ${projectName} --tags e2etag,e2ePackage`
it('should serve application in dev mode with custom port', async () => {
const port = 4212;
const p = await runCommandUntil(
`run ${project}:serve --port=${port}`,
(output) => {
return output.includes('Local:') && output.includes(`:${port}`);
}
);
const project = readJson(`libs/${projectName}/project.json`);
expect(project.tags).toEqual(['e2etag', 'e2ePackage']);
}, 120000);
try {
await promisifiedTreeKill(p.pid, 'SIGKILL');
await killPort(port);
} catch {
// ignore
}
}, 200000);
});
});
Loading