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

React-native based library generator does not include test-setup.ts in tsconfig.spec.json #22198

Closed
1 of 4 tasks
jsve opened this issue Mar 7, 2024 · 1 comment
Closed
1 of 4 tasks
Assignees
Labels
scope: react-native Issues relating to React Native type: bug

Comments

@jsve
Copy link

jsve commented Mar 7, 2024

Current Behavior

In a generated a react-native library, there are typescript errors when using functions from @testing-library/jest-native/extend-expect in .spec files.

The reason is likely that ./test-setup.ts is not included here:

The issue is the same for the expo-generator.

Expected Behavior

Since the generator includes test-setup.ts and includes it in jest.config, typescript should also be configured to use this.

GitHub Repo

No response

Steps to Reproduce

  1. nx generate @nx/react-native:library --name=test --projectNameAndRootFormat=as-provided --no-interactive
  2. use one of the features from @testing-library/jest-native/extend-expect
  3. see typescript complaining about the function not existing

Nx Report

Node   : 18.18.2
OS     : darwin-arm64
yarn   : 4.1.0
   
nx                 : 18.0.4
@nx/js             : 18.0.4
@nx/jest           : 18.0.4
@nx/linter         : 18.0.4
@nx/eslint         : 18.0.4
@nx/workspace      : 18.0.4
@nx/cypress        : 18.0.4
@nx/detox          : 18.0.4
@nx/devkit         : 18.0.4
@nx/eslint-plugin  : 18.0.4
@nx/expo           : 18.0.4
@nx/next           : 18.0.4
@nx/react          : 18.0.4
@nx/react-native   : 18.0.4
@nrwl/tao          : 18.0.4
@nx/vite           : 18.0.4
@nx/web            : 18.0.4
@nx/webpack        : 18.0.4
typescript         : 5.3.2

Failure Logs

No response

Package Manager Version

yarn 4.1.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@jsve jsve added the type: bug label Mar 7, 2024
@FrozenPandaz FrozenPandaz added the scope: react-native Issues relating to React Native label Mar 15, 2024
xiongemi added a commit that referenced this issue May 17, 2024
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23027
#22198
@xiongemi
Copy link
Collaborator

FrozenPandaz pushed a commit that referenced this issue May 21, 2024
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23027
#22198

(cherry picked from commit a53fee8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: react-native Issues relating to React Native type: bug
Projects
None yet
Development

No branches or pull requests

3 participants