Repository: create-react-app
Issue: Debug Jest in react when module alias are defined
Labels: issue: bug

I have a react application which is create by CRA and using typescript. I define several module mapper in tsconfig.json

`tsconfig.path.json`

```
    {
      "compilerOptions": {
        "baseUrl": "./src",
        "paths": {
          "@constants/*": ["constants/*"],
          "@components/*": ["components/*"],
          "@grid/*": ["components/Grid/*"],
          "@grid-share/*": ["components/Grid/Share/*"],
          "@utils/*": ["util/*"],
          "@services/*": ["Services/*"]
        }
      },
      "extends": "../tsconfig.json"
    }
```

then I define same alias in `package.json` for `JEST`

```
     "jest": {
        "snapshotSerializers": [
          "enzyme-to-json/serializer"
        ],
        "moduleNameMapper": {
          "@constants/(.*)": "<rootDir>/src/constants/$1",
          "@utils/(.*)": "<rootDir>/src/util/$1",
          "@grid-share/(.*)": "<rootDir>/src/components/Grid/Share/$1",
          "@grid/(.*)": "<rootDir>/src/components/Grid/$1",
          "@services/(.*)": "<rootDir>/src/Services/$1",
          "@components/(.*)": "<rootDir>/src/components/$1"
        }
      },
```

when I use `yarn test` everything is okey. However, I want to debug a test in vs code my VSCode luncher config file is like the following:

```
    {
      "version": "0.2.0",
      "configurations": [{
        "name": "Debug All Tests",
        "type": "node",
        "request": "launch",
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
        "args": [
          "test",
          "--runInBand",
          "--no-cache",
          "--watchAll=false"
        ],
        "cwd": "${workspaceRoot}",
        "protocol": "inspector",
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen"
      }, {
        "name": "Debug Current Test",
        "type": "node",
        "request": "launch",
        "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
        "args": [
          "test",
          "--runInBand",
          "--no-cache",
          "${fileBasenameNoExtension}",
          "--watchAll=true"
        ],
        "cwd": "${workspaceRoot}",
        "protocol": "inspector",
        "console": "integratedTerminal",
        "internalConsoleOptions": "neverOpen"
      }]
    }
```
the problem is when I try to debug a test case in VSCode, I have following error

> Out of the box, Create React App only supports overriding these Jest options:
> 
>   • collectCoverageFrom
>   • coverageReporters
>   • coverageThreshold
>   • extraGlobals
>   • globalSetup
>   • globalTeardown
>   • resetMocks
>   • resetModules
>   • snapshotSerializers
>   • watchPathIgnorePatterns.
> 
> These options in your package.json Jest configuration are not currently supported by Create React App:
> 
>   • moduleNameMapper
> 
> If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.

is there any way to solve this problem without `ejecting`??