Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active July 13, 2019 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/8652390facc3740f519c7574c12731d2 to your computer and use it in GitHub Desktop.
Save miguelmota/8652390facc3740f519c7574c12731d2 to your computer and use it in GitHub Desktop.
TypeScript tests using jest
import * as lib from './'
test('test', async () => {
expect(await lib.hello()).toBe('world')
})
export const hello = async ():string => {
return 'world'
}
npm i jest @types/jest ts-jest -D
module.exports = {
"roots": [
"src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
}
{
"scripts": {
"test": "jest"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment