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
5 changes: 3 additions & 2 deletions .github/workflows/e2e-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ jobs:
run: pnpm install --frozen-lockfile

- name: Cache Playwright browsers
if: matrix.os == 'ubuntu-latest'
uses: actions/cache@v4
id: cache-playwright
with:
Expand All @@ -171,7 +172,7 @@ jobs:
playwright-${{ runner.os }}-

- name: Install Playwright browsers
if: steps.cache-playwright.outputs.cache-hit != 'true'
if: matrix.os == 'ubuntu-latest' && steps.cache-playwright.outputs.cache-hit != 'true'
run: pnpm exec playwright install

- name: Install Playwright system dependencies
Expand All @@ -196,7 +197,7 @@ jobs:
- os: ubuntu-latest
name: Linux
timeout: 30
configuration: skip-docker
configuration: main
verdaccio: localhost
- os: macos-latest
name: macOS
Expand Down
4 changes: 2 additions & 2 deletions e2e/nx-payload-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"docker": {
"testPathPatterns": ["docker", "ui"]
},
"skip-docker": {
"testPathIgnorePatterns": ["docker", "ui"]
"main": {
"testPathPatterns": ["main"]
},
"quick": {
"testPathPatterns": ["quick"]
Expand Down
133 changes: 0 additions & 133 deletions e2e/nx-payload-e2e/src/nx-payload.legacy.spec.ts

This file was deleted.

30 changes: 0 additions & 30 deletions e2e/nx-payload-e2e/src/nx-payload.quick.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { runCommand } from '@codeware/core/testing';
import { logDebug } from '@codeware/core/utils';
import {
ensureCreateNxWorkspaceProject,
Expand Down Expand Up @@ -101,34 +100,5 @@ describe('Test plugin by starting with an empty workspace (limited test suite)',
)
).not.toThrow();
});

it('should test application', async () => {
// https://github.com/nrwl/nx/issues/32880
await runNxCommandAsync(`test ${appName} --force-exit`);
});

it('should lint application', async () => {
await runNxCommandAsync(`lint ${appName}`);
});

it('should serve application (dev target)', async () => {
await runCommand(`nx dev ${appName}`, {
doneFn: (log) => /Ready in \d/.test(log),
errorDetector: /Error:/,
verbose: process.env.CDWR_DEBUG_LOGGING === 'true'
});
});

it('should generate types', async () => {
await runNxCommandAsync(`gen ${appName}`);

expect(() =>
checkFilesExist(`${appDirectory}/src/generated/payload-types.ts`)
).not.toThrow();
});

it('should invoke payload cli', async () => {
await runNxCommandAsync(`payload ${appName} info`);
});
});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`application generator should generate docker files 1`] = `
"FROM node:20-alpine AS base
"FROM node:22-alpine AS base

FROM base AS deps
# Check the link to understand why libc6-compat might be needed
Expand Down
38 changes: 11 additions & 27 deletions packages/nx-payload/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Prevent @nx/next:init and @cdwr/nx-payload:init from calling createProjectGraphAsync,
// which hits the real filesystem even when given a virtual Tree.
jest.mock('@nx/devkit', () => ({
...jest.requireActual('@nx/devkit'),
createProjectGraphAsync: jest.fn().mockResolvedValue({
nodes: {},
dependencies: {}
})
}));

import { type Tree, readNxJson, readProjectConfiguration } from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import { lintConfigHasOverride } from '@nx/eslint/src/generators/utils/eslint-file';
Expand All @@ -7,11 +17,7 @@ import { payloadTargets } from '../../utils/definitions';
import { applicationGenerator } from './application';
import type { AppGeneratorSchema } from './schema';

// Temporary disable until we've found a way to run the tests without disabling the daemon.
// Currently the tests runs on the real filesystem which is a test anti-pattern and makes the tests slow.
// Should be fixed in COD-274.

describe.skip('application generator', () => {
describe('application generator', () => {
let tree: Tree;
const options: AppGeneratorSchema = {
directory: 'apps/test-dir',
Expand All @@ -23,25 +29,12 @@ describe.skip('application generator', () => {
console.log = jest.fn();
console.warn = jest.fn();

jest.setTimeout(60_000);

let nxDaemon: string;
beforeAll(() => {
nxDaemon = process.env['NX_DAEMON'];
process.env['NX_DAEMON'] = 'false';
});

afterAll(() => {
process.env['NX_DAEMON'] = nxDaemon;
});

beforeEach(() => {
jest.clearAllMocks();
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
});

afterEach(() => {
// TODO: Remove once Nx has fixed MaxListenersExceededWarning
process.removeAllListeners('SIGTERM');
});

Expand Down Expand Up @@ -214,15 +207,6 @@ describe.skip('application generator', () => {
);
});

it('should disable react compiler', async () => {
await applicationGenerator(tree, options);

const nextConfig = tree
.read(`${options.directory}/next.config.mjs`, 'utf-8')
.replaceAll(/(\s|\n)/g, '');
expect(nextConfig).toMatch(/experimental:.*reactCompiler:false/);
});

it('should add payload config path alias once to tsconfig.base.json', async () => {
await applicationGenerator(tree, options);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine AS base
FROM node:22-alpine AS base

FROM base AS deps
# Check the link to understand why libc6-compat might be needed
Expand Down
24 changes: 11 additions & 13 deletions packages/nx-payload/src/generators/preset/preset.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Prevent @nx/next:init and @cdwr/nx-payload:init from calling createProjectGraphAsync,
// which hits the real filesystem even when given a virtual Tree.
jest.mock('@nx/devkit', () => ({
...jest.requireActual('@nx/devkit'),
createProjectGraphAsync: jest.fn().mockResolvedValue({
nodes: {},
dependencies: {}
})
}));

import { type Tree, readProjectConfiguration } from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';

Expand All @@ -6,7 +16,7 @@ import { payloadTargets } from '../../utils/definitions';
import { presetGenerator } from './preset';
import type { PresetGeneratorSchema } from './schema';

describe.skip('preset generator', () => {
describe('preset generator', () => {
let tree: Tree;

const options: PresetGeneratorSchema = {
Expand All @@ -20,18 +30,6 @@ describe.skip('preset generator', () => {
console.log = jest.fn();
console.warn = jest.fn();

jest.setTimeout(10_000);

let nxDaemon: string;
beforeAll(() => {
nxDaemon = process.env['NX_DAEMON'];
process.env['NX_DAEMON'] = 'false';
});

afterAll(() => {
process.env['NX_DAEMON'] = nxDaemon;
});

beforeEach(() => {
jest.clearAllMocks();
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
Expand Down
Loading
Loading