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

Test errors out at first use of typescript syntax #205

Open
BoilerTom90 opened this issue Apr 22, 2023 · 1 comment
Open

Test errors out at first use of typescript syntax #205

BoilerTom90 opened this issue Apr 22, 2023 · 1 comment

Comments

@BoilerTom90
Copy link

I'm trying to use jest-dynamodb, and my jest scripts are written in typescript.
Prior to trying this package, I was testing against a real dynamodb table on AWS and the scripts worked.
I've switched to this package and the instructions say to change the preset from ts-jest to @shelf/jest-dynamodb. I've done that:

import type { Config } from '@jest/types';
import { baseJestConfig } from '../../jest.config.base';
const config: Config.InitialOptions = {
   ...baseJestConfig,
   preset: '@shelf/jest-dynamodb',  // 'ts-jest',
   projects: ['./'],
   moduleNameMapper: {
      '^uuid$': require.resolve('uuid')
   },
   setupFilesAfterEnv: ['./tests/common-mocks.js']
};
export default config;

But, when I try to run the test, at the first encounter of typescript syntax, the test errors out.

const x: number = 1;

describe('Env Test', () => {
   test('Environment works', () => {
      expect(true).toBe(true);
   })
});

image

Does this package support tests written in typescript?

@erikerikson
Copy link

I had to add the following to my jest config to use this on my typescript:

    "transform": {
      "^.+\\.tsx?$": "@swc/jest"
    }

obvs: npm i -D @swc/jest and so on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants