Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using npx create-nx-workspace --preset=react does not setup the app with babel-jest #8354

Closed
ChrisSargent opened this issue Jan 3, 2022 · 1 comment · Fixed by #8626
Closed
Assignees
Labels
outdated scope: react Issues related to React support for Nx scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@ChrisSargent
Copy link

Current Behavior

Running npx create-nx-workspace --preset=react results in a jest.config.ts file like so:

module.exports = {
  displayName: 'myapp',
  preset: '../../jest.preset.js',
  globals: {
    'ts-jest': {
      tsconfig: '<rootDir>/tsconfig.spec.json',
    },
  },
  transform: {
    '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
    '^.+\\.[tj]sx?$': 'ts-jest',
  },
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
  coverageDirectory: '../../coverage/apps/myapp',
};

Expected Behavior

It would use the same scaffold as if using nx g @nrwl/react:application ..., which would result in:

module.exports = {
  displayName: 'mynewapp',
  preset: '../../jest.preset.js',
  transform: {
    '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
    '^.+\\.[tj]sx?$': 'babel-jest',
  },
  moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
  coverageDirectory: '../../coverage/apps/mynewapp',
};

Steps to Reproduce

Run: npx create-nx-workspace --preset=react

Repo: https://github.com/ChrisSargent/csnxreact

Environment

Node : 14.18.2
OS : darwin x64
yarn : 1.22.17

nx : 13.4.2
@nrwl/angular : undefined
@nrwl/cli : 13.4.2
@nrwl/cypress : 13.4.2
@nrwl/devkit : 13.4.2
@nrwl/eslint-plugin-nx : 13.4.2
@nrwl/express : undefined
@nrwl/jest : 13.4.2
@nrwl/linter : 13.4.2
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : 13.4.2
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/tao : 13.4.2
@nrwl/web : 13.4.2
@nrwl/workspace : 13.4.2
@nrwl/storybook : 13.4.2
@nrwl/gatsby : undefined
typescript : 4.4.4
rxjs : 6.6.7

@FrozenPandaz FrozenPandaz added scope: react Issues related to React support for Nx scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx labels Jan 14, 2022
@philipjfulcher philipjfulcher self-assigned this Jan 20, 2022
philipjfulcher added a commit to philipjfulcher/nx that referenced this issue Jan 20, 2022
philipjfulcher added a commit to philipjfulcher/nx that referenced this issue Jan 21, 2022
philipjfulcher added a commit to philipjfulcher/nx that referenced this issue Jan 21, 2022
philipjfulcher added a commit to philipjfulcher/nx that referenced this issue Jan 21, 2022
philipjfulcher added a commit that referenced this issue Jan 21, 2022
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react Issues related to React support for Nx scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants