Skip to content

Commit

Permalink
fix(cli-e2e): make it great again (#885)
Browse files Browse the repository at this point in the history
Co-authored-by: Shai Reznik <[email protected]>
Co-authored-by: maiieul <[email protected]>
  • Loading branch information
3 people authored Nov 4, 2024
1 parent 50c61ba commit 4424bfd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ runs:
# shell: bash
# run: npx nx affected:build --base=last-release --exclude=website

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

# - name: Codecov upload
# uses: codecov/codecov-action@v2
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"engines": {
"node": ">=16.0.0"
},
"private": false,
"private": true,
"type": "module",
"scripts": {
"build.changelog-formatter": "tsc .changeset/changelog-github-custom.ts && mv .changeset/changelog-github-custom.js .changeset/changelog-github-custom.cjs",
Expand All @@ -29,6 +29,7 @@
"release": "pnpm release.prepare && pnpm release.setroot && pnpm release.publish && pnpm release.resetroot",
"release.publish": "changeset publish",
"release.resetroot": "cp dist/pnpm-workspace.yaml pnpm-workspace.yaml",
"release.e2e": "pnpm release.prepare && pnpm release.setroot && pnpm -r exec pnpm version patch && pnpm -r publish --tag e2e --no-git-checks && pnpm release.resetroot",
"test.cli": "NODE_OPTIONS=--experimental-vm-modules nx test cli",
"test.headless": "nx component-test headless --skip-nx-cache",
"test.visual.headless": "nx visual-test headless",
Expand Down
11 changes: 8 additions & 3 deletions packages/cli-e2e/src/cli.smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ describe('Qwik UI CLI Smoke test', () => {

it('should be installed and add the button file', () => {
execSync(
'npx -y qwik-ui@0.0.0-e2e init --e2e --projectRoot / --uiComponentsPath "src/components/ui" --rootCssPath "src/global.css" --installTailwind --style "simple" --borderRadius "0" --primaryColor "cyan-600" --components=button',
'npx -y qwik-ui@e2e init --e2e --projectRoot / --uiComponentsPath "src/components/ui" --rootCssPath "src/global.css" --installTailwind --style "simple" --components=button',
{
cwd: projectDirectory,
stdio: 'inherit',
env: process.env,
stdio: 'inherit',
},
);
execSync('npx -y qwik-ui@e2e add button', {
cwd: projectDirectory,
env: process.env,
stdio: 'inherit',
});
const buttonIsInTheRightPlace = existsSync(
join(projectDirectory, 'src/components/ui/button/button.tsx'),
);
Expand All @@ -54,7 +59,7 @@ function createTestQwikProject() {
recursive: true,
});

execSync(`pnpm create qwik@latest basic ${projectName}`, {
execSync(`pnpm create qwik@latest empty ${projectName}`, {
cwd: tempDir,
stdio: 'inherit',
env: process.env,
Expand Down
20 changes: 5 additions & 15 deletions tools/scripts/start-local-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* It is meant to be called in jest's globalSetup.
*/
import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry';
import { execFileSync } from 'child_process';
import { execSync } from 'child_process';

export default async () => {
// local registry target to run
Expand All @@ -16,18 +16,8 @@ export default async () => {
storage,
verbose: false,
});
const nx = require.resolve('nx');
execFileSync(
nx,
[
'run-many',
'--targets',
'publish',
'--package-version',
'0.0.0-e2e',
'--tag',
'e2e',
],
{ env: process.env, stdio: 'inherit' },
);
execSync('pnpm run release.e2e', {
env: process.env,
stdio: 'inherit',
});
};

0 comments on commit 4424bfd

Please sign in to comment.