{"name":"ts-jest","version":"23.10.0-beta.2","main":"dist/index.js","types":"dist/index.d.ts","description":"A preprocessor with sourcemap support to help use Typescript with Jest","scripts":{"prebuild":"node scripts/clean-dist.js","build":"tsc -p tsconfig.build.json","build:watch":"tsc -p tsconfig.build.json -w","clean":"node scripts/clean.js","pretest":"npm run lint","test":"run-s -s test:e2e \"test:unit -- {@}\" --","test:prepare":"npm run test:e2e -- --prepareOnly","test:e2e":"node scripts/e2e.js","test:unit":"jest","test:external":"node scripts/test-external-project.js","lint":"tslint --project .","doc":"cd docs && bundle exec jekyll serve","doc:link":"git worktree add docs/_site gh-pages","doc:unlink":"git worktree prune","doc:build":"cd docs && bundle exec jekyll build","doc:build-commit":"npm run doc:build && cd docs/_site && git add --all && git commit --","prepare":"npm run build","prepublishOnly":"npm run test","precommit":"lint-staged","postcommit":"git reset"},"repository":{"type":"git","url":"git+https://github.com/kulshekhar/ts-jest.git"},"keywords":["jest","typescript","sourcemap","react","testing"],"author":{"name":"Kulshekhar Kabra","email":"kulshekhar@users.noreply.github.com","url":"https://github.com/kulshekhar"},"contributors":[{"name":"Huafu Gandon","email":"huafu.gandon@gmail.com","url":"https://github.com/huafu"}],"license":"MIT","bugs":{"url":"https://github.com/kulshekhar/ts-jest/issues"},"homepage":"https://github.com/kulshekhar/ts-jest#readme","dependencies":{"bs-logger":"^0.2.3","buffer-from":"^1.1.1","fast-json-stable-stringify":"^2.0.0","make-error":"^1.3.5","mkdirp":"^0.5.1","semver":"^5.5.1","tslib":"^1.9.3"},"peerDependencies":{"babel-jest":">=22 <24","jest":">=22 <24","typescript":">=2.7.0 <4.0.0"},"devDependencies":{"@types/babel__core":"^7.0.1","@types/buffer-from":"^1.1.0","@types/cross-spawn":"^6.0.0","@types/fs-extra":"5.0.4","@types/jest":"^23.3.1","@types/js-yaml":"^3.11.2","@types/json5":"0.0.29","@types/lodash.memoize":"^4.1.4","@types/lodash.merge":"^4.6.4","@types/lodash.set":"^4.3.4","@types/mkdirp":"^0.5.2","@types/node":"^10.9.4","@types/semver":"^5.5.0","cross-spawn":"^6.0.5","doctoc":"^1.3.1","eslint":"^5.4.0","fs-extra":"^7.0.0","glob-gitignore":"^1.0.9","husky":"^0.14.3","jest":"^23.4.1","js-yaml":"^3.12.0","json5":"^2.0.1","lint-staged":"^7.2.2","lodash.memoize":"^4.1.2","lodash.merge":"^4.6.1","lodash.set":"^4.3.2","npm-run-all":"^4.1.3","prettier":"^1.14.2","source-map":"^0.7.3","tslint":"^5.11.0","typescript":"^3.0.3"},"lint-staged":{"linters":{"*.{js,ts,tsx,jsx}":["prettier --write","git add"]}},"engines":{"node":">= 6"},"gitHead":"16f125a30d1293ab8ac2e5c24f7aeaa45e335547","readme":"# ts-jest  [![npm version](https://badge.fury.io/js/ts-jest.svg)](https://badge.fury.io/js/ts-jest) [![NPM downloads](https://img.shields.io/npm/dm/ts-jest.svg?style=flat)](https://npmjs.org/package/ts-jest) [![Greenkeeper badge](https://badges.greenkeeper.io/kulshekhar/ts-jest.svg)](https://greenkeeper.io/) [![Build Status for linux](https://travis-ci.org/kulshekhar/ts-jest.svg?branch=master)](https://travis-ci.org/kulshekhar/ts-jest) [![Build Status for Windows](https://ci.appveyor.com/api/projects/status/g8tt9qd7usv0tolb/branch/master?svg=true)](https://ci.appveyor.com/project/kulshekhar/ts-jest/branch/master) <img align=\"right\" src=\"./logo.png\" height=\"48\">\n\n\n**ts-jest** is a TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript.\n\n---\n\n[<img src=\"./docs/assets/troubleshooting.png\" align=\"left\" height=\"24\"> Before reporting any issue, be sure to check the troubleshooting page](https://github.com/kulshekhar/ts-jest/wiki/Troubleshooting)\n\n[<img src=\"./docs/assets/slack.png\" align=\"left\" height=\"24\"> You can also find help on the ts-jest community on Slack](https://join.slack.com/t/ts-jest/shared_invite/enQtNDE1ODQ0OTEzMTczLWU2ZTk5YTMzYTE1YjBkZTk5ODI1NWU3NWU0NzhlOWJlZDNkYTRlM2Y3NWQ1YWVjMjc5Mjg1NmY1NTdkNWQ3MTA)\n\n[<img src=\"./docs/assets/pull-request.png\" align=\"left\" height=\"24\"> Looking for collaborators. Want to help improve ts-jest?](https://github.com/kulshekhar/ts-jest/issues/223)\n\n---\n\n# Table of Contents\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n\n- [Usage](#usage)\n  - [Versioning](#versioning)\n  - [Coverage](#coverage)\n- [Default Setup](#default-setup)\n  - [Sourcemap support](#sourcemap-support)\n  - [Automatically finds tsconfig.json](#automatically-finds-tsconfigjson)\n  - [Supports synthetic modules](#supports-synthetic-modules)\n  - [Supports automatic of jest.mock() calls](#supports-automatic-of-jestmock-calls)\n- [Configuration](#configuration)\n  - [TypeScript configuration](#typescript-configuration)\n  - [Module path mapping](#module-path-mapping)\n  - [Using `babel-jest`](#using-babel-jest)\n  - [TS compiler & error reporting](#ts-compiler--error-reporting)\n  - [Ignore coverage on decorators](#ignore-coverage-on-decorators)\n  - [extending](#extending)\n- [Use cases](#use-cases)\n  - [React Native](#react-native)\n- [Angular 2](#angular-2)\n- [Tips](#tips)\n  - [Importing packages written in TypeScript](#importing-packages-written-in-typescript)\n  - [Logging](#logging)\n- [Known Limitations](#known-limitations)\n  - [Known limitations for TS compiler options](#known-limitations-for-ts-compiler-options)\n  - [`const enum` is not supported if `isolatedModules` is enabled](#const-enum-is-not-supported-if-isolatedmodules-is-enabled)\n- [How to Contribute](#how-to-contribute)\n  - [Quickstart to run tests (only if you're working on this package)](#quickstart-to-run-tests-only-if-youre-working-on-this-package)\n- [License](#license)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n## Usage\n\nTo use this in your project, run:\n```sh\nnpm install --save-dev ts-jest @types/jest\n```\nIf you don't already have jest installed,\n```sh\nnpm install --save-dev jest ts-jest @types/jest\n```\nModify your project's `package.json` so that the `jest` section looks something like:\n```json\n{\n  \"jest\": {\n    \"preset\": \"ts-jest\"\n  }\n}\n```\nor create/modify the `jest.config.js`:\n```js\nmodule.exports = {\n  preset: 'ts-jest',\n};\n```\nThis setup should allow you to write Jest tests in Typescript and be able to locate errors without any additional gymnastics.\n\n### Versioning\nFrom version `\"jest\": \"17.0.0\"` we are using same MAJOR.MINOR as [`Jest`](https://github.com/facebook/jest).\nFor `\"jest\": \"< 17.0.0\"` use `\"ts-jest\": \"0.1.13\"`. Docs for it see [here](https://github.com/kulshekhar/ts-jest/blob/e1f95e524ed62091736f70abf63530f1f107ec03/README.md).\n\nYou can try using ts-jest with `jest@next`; use at your own risk! (And file an issue if you find problems.)\n\n### Coverage\n\nPrior to version `20.0.0`, coverage reports could be obtained using the inbuilt coverage processor in ts-jest. Starting with version `20.0.0`, ts-jest delegates coverage processing to jest and no longer includes a coverage processor.\n\n## Default Setup\nts-jest tries to ship with sensible defaults, to get you on your feet as quickly as possible.\n\n### Sourcemap support\nSourcemaps should work out of the box. That means your stack traces should have the correct line numbers,\nand you should be able to step through the TypeScript code using a debugger.\n\n### Automatically finds tsconfig.json\nts-jest automatically located your `tsconfig` file.\nIf you want to compile typescript with a special configuration, you [can do that too](#typescript-configuration).\n\n### Supports synthetic modules\nIf you're on a codebase where you're using synthetic default imports, e.g.\n```javascript 1.6\n//Regular imports\nimport * as React from 'react';\n\n//Synthetic default imports:\nimport React from 'react';\n```\nts-jest does that by using TypeScript 2.7+ `esModuleInterop` option. More details [here](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html).\n\n### Supports automatic of jest.mock() calls\n[Just like Jest](https://facebook.github.io/jest/docs/manual-mocks.html#using-with-es-module-imports) ts-jest\nautomatically hoist your `jest.mock()` calls to the top of their block.\n\n## Configuration\nIf the default setup doesn't address your requirements, you can create a custom setup to suit your project. All ts-jest specific configuration is done in an object with the `ts-jest` key within jest `gobals` config:\n\n```js\n// package.json\n{\n  \"jest\": {\n    \"globals\": {\n      \"ts-jest\": {\n        // ts-jest specific configuration\n      }\n    }\n  }\n}\n```\n**OR**\n```js\n// jest.config.js\nmodule.exports = {\n  globals: {\n    'ts-jest': {\n      // ts-jest specific configuration\n    }\n  }\n}\n```\n\nIn following documentation we'll show you examples as if you were using a `jest.config.js` file, but the same applies if you were putting the configuration optons within `package.json`'s `jest` section of course.\n\nAny configuration options which is a path to some file can make the use of `<rootDir>`. It'll be replaced with the value of `rootDir` as in other Jest config options.\n\n### TypeScript configuration\nBy default this package will try to locate `tsconfig.json` and use its compiler options for your `.ts` and `.tsx` files.\n\nYou can override this behavior with the `tsConfig` option of ts-jest. It can be:\n\n- the path to a `tsconfig` JSON file (relative to `rootDir`):\n  ```js\n  // jest.config.js\n  module.exports = {\n    globals: {\n      'ts-jest': {\n        tsConfig: 'my-tsconfig.json'\n      }\n    }\n  };\n  ```\n\n- a plain object containing the `compilerOptions`:\n  ```js\n  // jest.config.js\n  module.exports = {\n    globals: {\n      'ts-jest': {\n        tsConfig: {\n          experimentalDecorators: true,\n          // ...\n        }\n      }\n    }\n  };\n  ```\n\nFor all available `tsc` options see [TypeScript docs](https://www.typescriptlang.org/docs/handbook/compiler-options.html).\n\nNote that files are transpiled as isolated modules. Because of that some compiler options have no effect: `declaration`, `declarationDir`, `esModuleInterop`, `inlineSourceMaps`, `inlineSources`, `lib`, `module`, `noEmit`, `noEmitOnError`, `out`, `outFile`, `paths`, `rootDirs`, `sourceMaps` and `types`. See TypeScript `transpileModule`'s [function source](https://github.com/Microsoft/TypeScript/blob/v3.0.1/src/services/transpile.ts#L44-L53).\n\n### Module path mapping\n\nIf you use [\"baseUrl\"](https://www.typescriptlang.org/docs/handbook/module-resolution.html) and \"paths\" options for the compiler, see [\"moduleNameMapper\"](https://facebook.github.io/jest/docs/en/configuration.html#modulenamemapper-object-string-string) option on Jest docs.\n\nFor example, with the below config in your tsconfig:\n```js\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    \"paths\": {\n      \"@App/*\": [\"src/*\"],\n      \"@Shared/*\": [\"src/Shared/*\"]\n    }\n  }\n}\n```\n\n...here's what your jest config should look like:\n```js\n// jest.config.js\nmodule.exports = {\n  moduleNameMapper: {\n    '@App/(.*)': '<rootDir>/src/$1',\n    '@Shared/(.*)': '<rootDir>/src/Shared/$1'\n  }\n};\n```\n\nTS Jest provides a helper to automatically create this map from the `paths` compiler option of your TS config:\n\n```js\n// jest.config.js\nconst { pathsToModuleNameMapper } = require('ts-jest');\nconst { compilerOptions } = require('./tsconfig'); // replace with the path to your tsconfig.json file\n\nmodule.exports = {\n  // [...]\n  moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '<rootDir>/' } */ )\n};\n```\n\n### Using `babel-jest`\nBy default ts-jest does not rely on babel-jest. But you may want to use some babel plugins and stll be able to write TypeScript. This can be achieved using the `babelConfig` config key. It can be:\n\n- `true`, in which case it'll use defaults from babelrc or any other found config file:\n  ```js\n  // jest.config.js\n  module.exports = {\n    globals: {\n      'ts-jest': {\n        babelConfig: true\n      }\n    }\n  };\n  ```\n\n- the path to a babel config file:\n  ```js\n  // jest.config.js\n  module.exports = {\n    globals: {\n      'ts-jest': {\n        babelConfig: 'babelrc.test.js'\n      }\n    }\n  };\n  ```\n\n- a plain object containing babel configuration:\n  ```js\n  // jest.config.js\n  module.exports = {\n    globals: {\n      'ts-jest': {\n        babelConfig: {\n          plugins: [\n            // ...\n          ]\n        }\n      }\n    }\n  };\n  ```\n\n- `false`, in which case it'll disable the use of babel-jest (which is the default):\n  ```js\n  // jest.config.js\n  module.exports = {\n    globals: {\n      'ts-jest': {\n        babelConfig: false\n      }\n    }\n  };\n  ```\n\n### TS compiler & error reporting\n\n<center>=== To be documented ===</center>\n\n### Ignore coverage on decorators\n\n<center>=== To be documented ===</center>\n\n### extending\nYou can extend the defaults shipped with ts-jest in its preset (this is only possible in an external `jest.config.js` file):\n```js\n// jest.config.js\nconst { jestPreset } = require('ts-jest');\n\nmodule.exports = {\n  // ...\n  ...jestPreset,\n  moduleFileExtensions: ['ts'],\n  transform: {\n    ...jestPreset.transform,\n    // ...\n  }\n  // ...\n};\n```\n\n## Use cases\n\n### React Native\n\nThere is a few additional steps if you want to use it with React Native.\n\nInstall `babel-preset-react-native` modules.\n\n```sh\nnpm install -D babel-preset-react-native\n```\n\nEnsure `.babelrc` contains:\n\n```js\n// .babelrc\n{\n  \"presets\": [\"react-native\"],\n}\n```\n\nAnd your jest config should look like:\n\n```js\n// jest.config.js\nconst { jestPreset } = require('ts-jest');\n\nmodule.exports = {\n  ...jestPreset,\n  preset: 'react-native',\n  globals: {\n    'ts-jest': {\n      babelConfig: true\n    }\n  }\n};\n```\n\n## Angular 2\nWhen using Jest with Angular (a.k.a Angular 2) apps you will likely need to parse HTML templates. If you're unable to add `html-loader` to webpack config (e.g. because you don't want to eject from `angular-cli`) you can do so by using the `stringifyContentPathRegex` config option:\n\n```js\n// jest.config.js\nconst { jestPreset } = require('ts-jest');\n\nmodule.exports = {\n  // ...\n  transform: {\n    ...jestPreset.transform,\n    '^.+\\\\.html$': 'ts-jest'\n  },\n  globals: {\n    'ts-jest': {\n      stringifyContentPathRegex: '\\\\.html$'\n    }\n  }\n};\n```\n\n\n## Tips\n### Importing packages written in TypeScript\n\nIf you have dependencies on npm packages that are written in TypeScript but are\n**not** published in ES5 you have to tweak your configuration. For example\nyou depend on a private scoped package `@foo/bar` you have to add following to\nyour Jest configuration:\n\n```js\n{\n  // ...\n  \"transformIgnorePatterns\": [\n    \"<rootDir>/node_modules/(?!@foo/bar)\"\n  ]\n  // ...\n}\n```\n\nBy default Jest ignores everything in `node_modules`. This setting prevents Jest from ignoring the package you're interested in, in this case `@foo/bar`, while continuing to ignore everything else in `node_modules`.\n\n### Logging\n\nThis package is using [`bs-logger`](https://www.npmjs.com/package/bs-logger).\n\nUse environment variable `TS_JEST_LOG=xxx` to configure log targets. By default it'll log entries with level _warning_ and above to **stderr**.\n\nSee the examples in [there](https://github.com/huafu/bs-logger#using-targets) to configure different target(s).\n\nWhen posting an issue, it's best to join the full log file which you can create in CWD using:\n```sh\nTS_JEST_LOG=ts-jest.log jest\n# or\nTS_JEST_LOG=ts-jest.log npm run test\n```\n\n## Known Limitations\n\n### Known limitations for TS compiler options\n\nIf you use `\"baseUrl\": \"<path_to_your_sources>\"`, you also have to change `jest config` a little bit (also check [Module path mapping](#module-path-mapping) section):\n\n```json\n\"jest\": {\n  \"moduleDirectories\": [\"node_modules\", \"<path_to_your_sources>\"]\n}\n```\n\n### `const enum` is not supported if `isolatedModules` is enabled\n\nThis is due to a limitation in the ts-jest basic processor which compiles each test file individually, therefore ignoring implementations of ambient declarations. The TypeScript team currently have [no plan to support const enum inlining](https://github.com/Microsoft/TypeScript/issues/5243) for this particular compiler method. See [#112](https://github.com/kulshekhar/ts-jest/issues/112) and [#281](https://github.com/kulshekhar/ts-jest/issues/281) for more information.\n\n## How to Contribute\nIf you have any suggestions/pull requests to turn this into a useful package, just open an issue and I'll be happy to work with you to improve this.\n\n### Quickstart to run tests (only if you're working on this package)\n\n```sh\ngit clone https://github.com/kulshekhar/ts-jest\ncd ts-jest\nnpm install\nnpm test\n```\n\n## License\n\nCopyright (c) [Authors](AUTHORS).\nThis source code is licensed under the [MIT license](LICENSE).\n","readmeFilename":"README.md","_id":"ts-jest@23.10.0-beta.2","_npmVersion":"6.4.1","_nodeVersion":"10.9.0","_npmUser":{"name":"huafu","email":"huafu.gandon@gmail.com"},"dist":{"integrity":"sha512-+1S04fXcLi1FTYY2QeYSsSEzDSvmVyVZqnoLvn97DW4zdoc1FsdH9awF6rq6imYVDndt0N1FT81VJdS9o/j3Yw==","shasum":"ec5ccf3c100ee1ac6d9f9b736f981ea746f938f9","tarball":"http://registry-npm.ywwl.com/ts-jest/download/ts-jest-23.10.0-beta.2.tgz","fileCount":75,"unpackedSize":289843,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjFdHCRA9TVsSAnZWagAANiAP/1HpiKgO0Ntd86+BmoUP\nKc4NHu89Z9RwUpb3ei0IsJmkzlvbBbqOQ9ivLgIGYOXWQacEcAZjmiFzDylx\nR62w0sHZsdvAQvuGjd7jECHhM8gTggRdaap5uX2sAi4k9nboQ8j+gjse3BrJ\nHdNHI6tZnKOL4GKo6FE1DqlHafwEvpl+eIwYdreE3vC/bOJ3Pm5MKkWTBdXy\nkl4YmLjDIK7gY/of8ElhKqSBxf38kpVJ8oz/lKIJqs+++c3lJRpiiYB851qG\nS3szenszmnUwJ5C5WErrOHSTKgj6RtV1HTDNDhuI9lW6jr4EucV1ZN09Vb/b\n21wew6I189qnd7Fo+SOyZplA+notmtvUkjBIquom4MZYlOql4Ra/KMKC59az\n1u3Q+H6b0Gj7vIoYGwggiBhBoWJcTbXO+oWxDvizovIw5YBX0fEDaEzoj5J7\nORv4Hde2lAc7Y4KzZ1X6EjXwM0Lhv3jDn0dI/hSC4DUlRM1u5Bvb/Zvnf3oT\niv6m7zFPlvUj1NyzWXpG3BOfJKhfv14VGkTUhvvIcFm2lsw/XUfSJjbhoRdj\nrqOQM4NQ6t8n/CXRiPTz5Qpe8yUoXZ0ZgRMGbGXleHiqH7kChxg92KucWttL\nM90erm8j9BPuhBfVFdD6UFhgog2XVM7iyOkihHaJEIu8NUBufkkvzx/eRuFu\ny/9T\r\n=sDTe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICYzWDsV1P1vd+y7/Pcij2qYgGSVDMWAd9vO/1KGKgcjAiEApRqr+qo3Jiv43aBBD5RqhvVO+zcM8MUP767ceIYD29E="}],"size":92135,"noattachment":false,"key":"/ts-jest/-/ts-jest-23.10.0-beta.2.tgz"},"maintainers":[{"email":"gustavwengel@gmail.com","name":"geewee"},{"email":"huafu.gandon@gmail.com","name":"huafu"},{"email":"kulshekhar+npm@gmail.com","name":"kul"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ts-jest_23.10.0-beta.2_1535924038626_0.8367857197549997"},"_hasShrinkwrap":false,"publish_time":1535924038758,"_cnpm_publish_time":1535924038758,"dist-tags":{"latest":"29.4.15","next":"29.0.0-next.1"}}