Skip to content

Instantly share code, notes, and snippets.

@longht021189
Created April 16, 2024 02:19
Show Gist options
  • Save longht021189/0219f5d21cc1c45e42d1bc9035c44e63 to your computer and use it in GitHub Desktop.
Save longht021189/0219f5d21cc1c45e42d1bc9035c44e63 to your computer and use it in GitHub Desktop.
Use jest to test typescript
  1. Add devDependencies: @babel/preset-env, @babel/preset-typescript, @types/jest, jest
  2. Create babel.config.js file:
module.exports = {
  presets: [
    [
      '@babel/preset-env', { targets: { node: 'current' } }
    ],
    '@babel/preset-typescript',
  ],
};
  1. Add scripts: "test": "jest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment