Skip to content

How to support JSX? #24

@aralroca

Description

@aralroca

package.json

{
 "scripts": {
    "test": "jest ./tests",
    "test:ts": "jest -c jest.tsc.config.js"
  },
 "jest-runner-tsc": {
    "tsconfigPath": "./tsconfig.json"
  }
}

jest: 27.4.7
jest-runner-tsc: 1.6.0

jest.tsc.config.js

module.exports = {
  runner: 'jest-runner-tsc',
  displayName: 'tsc',
  moduleFileExtensions: ['js', 'jsx','ts', 'tsx'],
  testMatch: ['<rootDir>/tests/*.tsx'],
};

tsconfig.json

{
  "compileOnSave": false,
  "module": "ESNext",
  "target": "ESNext",
  "compilerOptions": {
    "strict": true,
    "noEmit": true,
    "declaration": true,
      "moduleResolution": "node",
      "esModuleInterop": true
    },
  "include": ["package/*.ts", "test/*.tsx"]
}

Running yarn test is working fine!!!

However running yarn test:ts an error is fired: Cannot use JSX unless the '--jsx' flag is provided.. When do I need to add this --jsx flag?

image

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions