Skip to content

Commit

Permalink
fix(remix): do not rename root jest.preset.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Feb 8, 2024
1 parent db4c617 commit d7d01e4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
32 changes: 30 additions & 2 deletions e2e/remix/tests/nx-remix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
listFiles,
} from '@nx/e2e/utils';

describe('remix e2e', () => {
describe('remix e2e standalone', () => {
let proj: string;

beforeAll(() => {
proj = newProject({ packages: ['@nx/remix'] });
proj = newProject({ packages: ['@nx/remix', '@nx/react'] });
});

afterAll(() => {
Expand Down Expand Up @@ -44,6 +44,19 @@ describe('remix e2e', () => {
const result = runCLI(`build ${appName}`);
expect(result).toContain('Successfully ran target build');
}, 120_000);
});

describe('remix e2e', () => {
let proj: string;

beforeAll(() => {
proj = newProject({ packages: ['@nx/remix'] });
});

afterAll(() => {
killPorts();
cleanupProject();
});

it('should create app', async () => {
const plugin = uniq('remix');
Expand Down Expand Up @@ -110,6 +123,21 @@ describe('remix e2e', () => {
const result = runCLI(`test ${plugin}`);
expect(result).toContain(`Successfully ran target test`);
}, 120_000);

it('should generate a library with jest and test correctly', async () => {
const reactapp = uniq('react');
runCLI(
`generate @nx/react:application ${reactapp} --unitTestRunner=jest`
);
const plugin = uniq('remix');
runCLI(`generate @nx/remix:application ${plugin} --unitTestRunner=jest`);

const result = runCLI(`test ${plugin}`);
expect(result).toContain(`Successfully ran target test`);

const reactResult = runCLI(`test ${reactapp}`);
expect(result).toContain(`Successfully ran target test`);
}, 120_000);
});

describe('error checking', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function updateUnitTestConfig(
updateVitestTestSetup(tree, pathToViteConfig, 'test-setup.ts');
} else if (unitTestRunner === 'jest') {
const pathToJestConfig = joinPathFragments(pathToRoot, 'jest.config.ts');
tree.rename('jest.preset.js', 'jest.preset.cjs');
tree.write('jest.preset.cjs', tree.read('jest.preset.js', 'utf-8'));
updateJestTestSetup(tree, pathToJestConfig, `<rootDir>/test-setup.ts`);
tree.write(
pathToJestConfig,
Expand Down

0 comments on commit d7d01e4

Please sign in to comment.