{"id":19656642,"url":"https://github.com/daggerok/jest-typescrip-tests","last_synced_at":"2026-04-29T10:02:04.526Z","repository":{"id":151041772,"uuid":"262150739","full_name":"daggerok/jest-typescrip-tests","owner":"daggerok","description":"Testing TypeScript code using jest","archived":false,"fork":false,"pushed_at":"2020-05-07T20:23:28.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T02:23:24.150Z","etag":null,"topics":["jest","jest-tests","jest-typescript","ts-jest","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daggerok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-07T20:23:13.000Z","updated_at":"2020-05-07T20:24:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea514c47-2bd7-4392-a878-c4e4ee650739","html_url":"https://github.com/daggerok/jest-typescrip-tests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/daggerok/jest-typescrip-tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fjest-typescrip-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fjest-typescrip-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fjest-typescrip-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fjest-typescrip-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daggerok","download_url":"https://codeload.github.com/daggerok/jest-typescrip-tests/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daggerok%2Fjest-typescrip-tests/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261792262,"owners_count":23210285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jest","jest-tests","jest-typescript","ts-jest","typescript"],"created_at":"2024-11-11T15:28:28.613Z","updated_at":"2026-04-29T10:01:59.492Z","avatar_url":"https://github.com/daggerok.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jest typescript [![Build Status](https://travis-ci.org/daggerok/jest-typescrip-tests.svg?branch=master)](https://travis-ci.org/daggerok/jest-typescrip-tests)\nTesting TypeScript code using jest...\n\n## jest es++ typescript..\n\n```bash\nmkdir app \u0026\u0026 cd $_\nnpm init -y\nnpm i -ED jest @jest/core @jest/globals @jest/types @types/node @babel/preset-env core-js @babel/preset-typescript typescript ts-jest @types/jest\n```\n\n_package.json_\n\n```json\n{\n  \"scripts\": {\n    \"dev\": \"npm run test -- --watchAll\",\n    \"test\": \"jest --preset=ts-jest --testEnvironment=node ...\",\n    \"test-js-with-ts\": \"jest --preset=ts-jest/presets/js-with-ts ...\",\n    \"test-js-with-babel\": \"jest --preset=jest --preset=ts-jest/presets/js-with-babel ...\"\n  },\n  \"babel\": {\n    \"presets\": [\n      [\n        \"@babel/preset-env\",\n        {\n          \"targets\": {\n            \"node\": \"current\"\n          }\n        }\n      ],\n      \"@babel/preset-typescript\"\n    ]\n  }\n}\n```\n\n## jest reporters\n\n```bash\nnpm i -ED @jest/reporters jest-junit \n```\n\n_package.json_\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"jest --reporters=default --reporters=jest-junit --collect-coverage ...\"\n  }\n}\n```\n\n## testing\n\nadd _src/dynamic-module.ts_ file:\n\n```ts\nexport const sum = (...args): number =\u003e\n  args.reduce((prev, curr) =\u003e prev + curr, 0);\n```\n\nadd _test/dynamic-import.test.ts_ file:\n\n```ts\nimport { expect, it } from '@jest/globals';\n\nit('should import dynamic lazy module', async () =\u003e {\n  const dynamicModule: any = await import('../src/dynamic-module');\n  const total: any = await dynamicModule.sum(1, 2, 3);\n  await expect(total).toBe(6);\n});\n```\n\n## finally, execute\n\n```bash\nnpm t\nnpm run test-js-with-ts\nnpm run test-js-with-babel\n```\n\nor simply use quick one liner for github repo starter:\n              \n```bash\ngit clone --depth=1 --no-single-branch https://github.com/daggerok/jest-typescrip-tests app \u0026\u0026 cd $_ \u0026\u0026 npm i \u0026\u0026 npm t\n```\n\n## resources\n\n* https://kulshekhar.github.io/ts-jest/user/config/\n* https://kulshekhar.github.io/ts-jest/user/install\n* https://jestjs.io/docs/en/next/getting-started#using-typescript\n* https://jestjs.io/docs/en/tutorial-async#asyncawait\n* https://github.com/facebook/jest/blob/master/examples/async/.babelrc.js\n* https://jestjs.io/docs/en/cli\n* https://www.freecodecamp.org/news/javascript-new-features-es2020/\n* https://medium.com/@dtkatz/use-the-blazing-fast-parcel-bundler-to-build-and-test-a-react-app-e6972a2587e1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaggerok%2Fjest-typescrip-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaggerok%2Fjest-typescrip-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaggerok%2Fjest-typescrip-tests/lists"}