diff --git a/AUTHORS.md b/AUTHORS.md index f5fa8c758c..9e89ebea94 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,58 +1,59 @@ -# Below is a list of people and organizations that have contributed to the -# ts-jest project. Names should be added to the list like so: -# -# Name/Organization +# TSJest contributors -Ahn Pham -Alan Agius -Alex Jover Morales -Andreas Krummsdorf -Anonymous -Bartosz Gościński -Blake Embrey -Bnaya Peretz -Brian Ruddy -Chong Guo -Chris Sauve -Christian Linne -Christian Rackerseder -Daniel Perez Alvarez -Danilo Bürger -David Schkalee -David Sheldrick -Emil Persson -Eric Anderson -Felipe Matos -Forbes Lindesay -Gino Zhang -Gregor Stamac <1668205+gstamac@users.noreply.github.com> -Gustav Wengel -Henry Zektser -Huafu Gandon -Ihor Chulinda -J Cheyo Jimenez -Jim Cummins -Joscha Feth -Junle Li -Justin Bay -Kamijin Fanta -Kulshekhar Kabra -Kyle Roach -Marshall Bowers -Martijn The -Matheus Gambati -Maxim Samoilov -Michael Tiller -Mohammad Rajabifard -OJ Kwon -Oliver Joseph Ash -Orta Therox -Patrick Housley -Richard Silverton -Rikki Tooley -Simen Bekkhus -Thomas Fontaine -Tom Crockett -Tony Valderrama -Trivikram Kamat -Umidbek Karimov +Below is a list of people and organizations that have contributed to the TSJest project. + +| Name | Email | +|------|-------| +| Ahn Pham | anhpnnd@gmail.com | +| Alan Agius | alan.agius4@gmail.com | +| Alex Jover Morales | alexjovermorales@gmail.com | +| Andreas Krummsdorf | andreas.krummsdorf@doksafe.de | +| Anonymous | goodforonefare@gmail.com | +| Bartosz Gościński | bargosc@gmail.com | +| Blake Embrey | hello@blakeembrey.com | +| Bnaya Peretz | me@bnaya.net | +| Brian Ruddy | briancruddy@gmail.com | +| Chong Guo | cguo@azendless.com | +| Chris Sauve | chrismsauve@gmail.com | +| Christian Linne | ShadowVampire@web.de | +| Christian Rackerseder | git@echooff.de | +| Daniel Perez Alvarez | unindented@gmail.com | +| Danilo Bürger | info@danilobuerger.de | +| David Schkalee | david.schkalee@magicline.de | +| David Sheldrick | djsheldrick@gmail.com | +| Emil Persson | emil.n.persson@gmail.com | +| Eric Anderson | e@ericlanderson.com | +| Felipe Matos | felipems@yahoo.com.br | +| Forbes Lindesay | forbes@lindesay.co.uk | +| Gino Zhang | whitetrefoil@gmail.com | +| Gregor Stamac | 1668205+gstamac@users.noreply.github.com | +| Gustav Wengel | gustavwengel@gmail.com | +| Henry Zektser | japhar81@gmail.com | +| Huafu Gandon | huafu.gandon@gmail.com | +| Ihor Chulinda | ichulinda@gmail.com | +| J Cheyo Jimenez | cheyo@masters3d.com | +| Jim Cummins | jimthedev@gmail.com | +| Joscha Feth | joscha@feth.com | +| Junle Li | lijunle@gmail.com | +| Justin Bay | jwbay@users.noreply.github.com | +| Kamijin Fanta | kamijin@live.jp | +| Kulshekhar Kabra | kulshekhar@users.noreply.github.com | +| Kyle Roach | kroach.work@gmail.com | +| Marshall Bowers | elliott.codes@gmail.com | +| Martijn The | post@martijnthe.nl | +| Matheus Gambati | matheusgambati@gmail.com | +| Maxim Samoilov | samoilowmaxim@gmail.com | +| Michael Tiller | michael.tiller@xogeny.com | +| Mohammad Rajabifard | mo.rajbi@gmail.com | +| OJ Kwon | kwon.ohjoong@gmail.com | +| Oliver Joseph Ash | oliverjash@gmail.com | +| Orta Therox | orta.therox+gh@gmail.com | +| Patrick Housley | patrick.f.housley@gmail.com | +| Richard Silverton | richsilv@yahoo.co.uk | +| Rikki Tooley | rikki.tooley@travellocal.com | +| Simen Bekkhus | sbekkhus91@gmail.com | +| Thomas Fontaine | thomas.fontaine@me.com | +| Tom Crockett | tomcrockett@tuplehealth.com | +| Tony Valderrama | tony.valderrama@outlook.com | +| Trivikram Kamat | trivikr.dev@gmail.com | +| Umidbek Karimov | uma.karimov@gmail.com | diff --git a/COLLABORATORS.md b/COLLABORATORS.md deleted file mode 100644 index 37d9ddb28f..0000000000 --- a/COLLABORATORS.md +++ /dev/null @@ -1,44 +0,0 @@ - - -**Table of Contents** - -- [Installing and building the project](#installing-and-building-the-project) -- [Merging PRs](#merging-prs) -- [Versioning](#versioning) -- [Tests](#tests) - - - -# Collaborator Guidelines - -ts-jest is grateful for all issues, PRs and contributions. In this file are tips for getting started contributing, -and best practices, so that we can ensure that we can maintain this project in the future. - -## Installing and building the project - -=== TBD === - -## Merging PRs - -1. A PR should be merged when at least one of the following conditions is satisfied: - -- 2 collaborators have reviewed and okayed the PR -- 1 collaborator has reviewed and okayed the PR and 36 hours have passed after the PR was submitted - -2. Collaborators should squash and merge PRs with a commit message explaining the changes. - -3. All PRs should add the author's name and email address to the authors file, if it isn't already present. - -## Versioning - -ts-jest must match the major version of jest. Matching the minor version is preferred. Matching the version patch is not required. - -When merging PRs which fix bugs, it is preferable to increment the version patch version so that the changes can be published to NPM. - -## Tests - -All new features or bugfixes should be accompanied with a new test, to ensure that the change works as intended, and to make sure we don't inadvertently break it in the future through refactring - -If you are simply refactoring code, it is not needed to add a test. - -See [e2e README](e2e/README.md) and [e2e tech doc](docs/tech/e2e/index.md) for more information. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..1f797efcff --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contributing + +When contributing to this repository, please first discuss the change you wish to make via [slack](https://join.slack.com/t/ts-jest/shared_invite/enQtNDE1ODQ0OTEzMTczLWU2ZTk5YTMzYTE1YjBkZTk5ODI1NWU3NWU0NzhlOWJlZDNkYTRlM2Y3NWQ1YWVjMjc5Mjg1NmY1NTdkNWQ3MTA) or [issue](https://github.com/kulshekhar/ts-jest/issues) with the owners of this repository before making a change. + +Please note we have a code of conduct, please follow it in all your interactions with the project. + +## Pull Request Process + +1. Ensure the tests are passing and that you have latest `master` branch merged in. +2. Update the `docs/` with details of your changes if required. +3. If possible, squash your commits. There must be only one commit in your PR (until a review). Then after each review requesting changes, DO NOT squash your commits with the one before the review, so that we can see intermediate modifications. +4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you. + +## Code of Conduct + +### Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +### Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +### Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +### Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +### Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at kulshekhar@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +### Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/LICENSE b/LICENSE.md similarity index 97% rename from LICENSE rename to LICENSE.md index a8fc851489..82e5bee7e0 100644 --- a/LICENSE +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016 +Copyright (c) 2016-2018 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 9fa75e2f84..8cb6b0876b 100644 --- a/README.md +++ b/README.md @@ -1,427 +1,58 @@ -# 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) +# 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) [![Known Vulnerabilities](https://snyk.io/test/github/kulshekhar/ts-jest/badge.svg)](https://snyk.io/test/github/kulshekhar/ts-jest) [![GitHub issues](https://img.shields.io/github/issues/kulshekhar/ts-jest.svg)](https://github.com/kulshekhar/ts-jest/issues) [![GitHub license](https://img.shields.io/github/license/kulshekhar/ts-jest.svg)](https://github.com/kulshekhar/ts-jest/blob/master/LICENSE) [![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) + -**ts-jest** is a TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript. +**TSJest** (`ts-jest`) is a TypeScript preprocessor with source map support for Jest that lets you use Jest to test projects written in TypeScript. ---- - -[ Before reporting any issue, be sure to check the troubleshooting page](https://github.com/kulshekhar/ts-jest/wiki/Troubleshooting) - -[ You can also find help on the ts-jest community on Slack](https://join.slack.com/t/ts-jest/shared_invite/enQtNDE1ODQ0OTEzMTczLWU2ZTk5YTMzYTE1YjBkZTk5ODI1NWU3NWU0NzhlOWJlZDNkYTRlM2Y3NWQ1YWVjMjc5Mjg1NmY1NTdkNWQ3MTA) - -[ Looking for collaborators. Want to help improve ts-jest?](https://github.com/kulshekhar/ts-jest/issues/223) +It supports all features of TypeScript _(even those which Babel 7 typescript plugin does not)_ and has an internal cache for your tests to run faster. --- -# Table of Contents - - - -- [Usage](#usage) - - [Versioning](#versioning) - - [Coverage](#coverage) -- [Default Setup](#default-setup) - - [Sourcemap support](#sourcemap-support) - - [Automatically finds tsconfig.json](#automatically-finds-tsconfigjson) - - [Supports synthetic modules](#supports-synthetic-modules) - - [Supports automatic of jest.mock() calls](#supports-automatic-of-jestmock-calls) -- [Configuration](#configuration) - - [TypeScript configuration](#typescript-configuration) - - [Module path mapping](#module-path-mapping) - - [Using `babel-jest`](#using-babel-jest) - - [TS compiler & error reporting](#ts-compiler--error-reporting) - - [Ignore coverage on decorators](#ignore-coverage-on-decorators) - - [extending](#extending) -- [Use cases](#use-cases) - - [React Native](#react-native) -- [Angular 2](#angular-2) -- [Tips](#tips) - - [Importing packages written in TypeScript](#importing-packages-written-in-typescript) - - [Logging](#logging) -- [Known Limitations](#known-limitations) - - [Known limitations for TS compiler options](#known-limitations-for-ts-compiler-options) - - [`const enum` is not supported if `isolatedModules` is enabled](#const-enum-is-not-supported-if-isolatedmodules-is-enabled) -- [How to Contribute](#how-to-contribute) - - [Quickstart to run tests (only if you're working on this package)](#quickstart-to-run-tests-only-if-youre-working-on-this-package) -- [License](#license) - - - -## Usage - -To use this in your project, run: -```sh -npm install --save-dev ts-jest @types/jest -``` -If you don't already have jest installed, -```sh -npm install --save-dev jest ts-jest @types/jest -``` -Modify your project's `package.json` so that the `jest` section looks something like: -```json -{ - "jest": { - "preset": "ts-jest" - } -} -``` -or create/modify the `jest.config.js`: -```js -module.exports = { - preset: 'ts-jest', -}; -``` -This setup should allow you to write Jest tests in Typescript and be able to locate errors without any additional gymnastics. - -### Versioning -From version `"jest": "17.0.0"` we are using same MAJOR.MINOR as [`Jest`](https://github.com/facebook/jest). -For `"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). - -You can try using ts-jest with `jest@next`; use at your own risk! (And file an issue if you find problems.) - -### Coverage - -Prior 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. - -## Default Setup -ts-jest tries to ship with sensible defaults, to get you on your feet as quickly as possible. - -### Sourcemap support -Sourcemaps should work out of the box. That means your stack traces should have the correct line numbers, -and you should be able to step through the TypeScript code using a debugger. - -### Automatically finds tsconfig.json -ts-jest automatically located your `tsconfig` file. -If you want to compile typescript with a special configuration, you [can do that too](#typescript-configuration). - -### Supports synthetic modules -If you're on a codebase where you're using synthetic default imports, e.g. -```javascript 1.6 -//Regular imports -import * as React from 'react'; - -//Synthetic default imports: -import React from 'react'; -``` -ts-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). - -### Supports automatic of jest.mock() calls -[Just like Jest](https://facebook.github.io/jest/docs/manual-mocks.html#using-with-es-module-imports) ts-jest -automatically hoist your `jest.mock()` calls to the top of their block. - -## Configuration -If 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: - -```js -// package.json -{ - "jest": { - "globals": { - "ts-jest": { - // ts-jest specific configuration - } - } - } -} -``` -**OR** -```js -// jest.config.js -module.exports = { - globals: { - 'ts-jest': { - // ts-jest specific configuration - } - } -} -``` - -In 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. - -Any configuration options which is a path to some file can make the use of ``. It'll be replaced with the value of `rootDir` as in other Jest config options. - -### TypeScript configuration -By default this package will try to locate `tsconfig.json` and use its compiler options for your `.ts` and `.tsx` files. - -You can override this behavior with the `tsConfig` option of ts-jest. It can be: - -- the path to a `tsconfig` JSON file (relative to `rootDir`): - ```js - // jest.config.js - module.exports = { - globals: { - 'ts-jest': { - tsConfig: 'my-tsconfig.json' - } - } - }; - ``` - -- a plain object containing the `compilerOptions`: - ```js - // jest.config.js - module.exports = { - globals: { - 'ts-jest': { - tsConfig: { - experimentalDecorators: true, - // ... - } - } - } - }; - ``` - -For all available `tsc` options see [TypeScript docs](https://www.typescriptlang.org/docs/handbook/compiler-options.html). - -Note 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). - -### Module path mapping - -If 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. - -For example, with the below config in your tsconfig: -```js -// tsconfig.json -{ - "compilerOptions": { - "paths": { - "@App/*": ["src/*"], - "@Shared/*": ["src/Shared/*"] - } - } -} -``` - -...here's what your jest config should look like: -```js -// jest.config.js -module.exports = { - moduleNameMapper: { - '@App/(.*)': '/src/$1', - '@Shared/(.*)': '/src/Shared/$1' - } -}; -``` +[ View the online documentation (usage & technical)](https://kulshekhar.github.io/ts-jest) -TS Jest provides a helper to automatically create this map from the `paths` compiler option of your TS config: +[ Ask for some help in the ts-jest community of Slack](https://join.slack.com/t/ts-jest/shared_invite/enQtNDE1ODQ0OTEzMTczLWU2ZTk5YTMzYTE1YjBkZTk5ODI1NWU3NWU0NzhlOWJlZDNkYTRlM2Y3NWQ1YWVjMjc5Mjg1NmY1NTdkNWQ3MTA) -```js -// jest.config.js -const { pathsToModuleNameMapper } = require('ts-jest'); -const { compilerOptions } = require('./tsconfig'); // replace with the path to your tsconfig.json file +[ Before reporting any issue, be sure to check the troubleshooting page](https://kulshekhar.github.io/ts-jest/user/troubleshooting) -module.exports = { - // [...] - moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '/' } */ ) -}; -``` +[ Looking for collaborators. Want to help improve ts-jest?](https://github.com/kulshekhar/ts-jest/issues/223) -### Using `babel-jest` -By 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: - -- `true`, in which case it'll use defaults from babelrc or any other found config file: - ```js - // jest.config.js - module.exports = { - globals: { - 'ts-jest': { - babelConfig: true - } - } - }; - ``` - -- the path to a babel config file: - ```js - // jest.config.js - module.exports = { - globals: { - 'ts-jest': { - babelConfig: 'babelrc.test.js' - } - } - }; - ``` - -- a plain object containing babel configuration: - ```js - // jest.config.js - module.exports = { - globals: { - 'ts-jest': { - babelConfig: { - plugins: [ - // ... - ] - } - } - } - }; - ``` - -- `false`, in which case it'll disable the use of babel-jest (which is the default): - ```js - // jest.config.js - module.exports = { - globals: { - 'ts-jest': { - babelConfig: false - } - } - }; - ``` - -### TS compiler & error reporting - -
=== To be documented ===
- -### Ignore coverage on decorators - -
=== To be documented ===
- -### extending -You can extend the defaults shipped with ts-jest in its preset (this is only possible in an external `jest.config.js` file): -```js -// jest.config.js -const { jestPreset } = require('ts-jest'); - -module.exports = { - // ... - ...jestPreset, - moduleFileExtensions: ['ts'], - transform: { - ...jestPreset.transform, - // ... - } - // ... -}; -``` - -## Use cases - -### React Native - -There is a few additional steps if you want to use it with React Native. - -Install `babel-preset-react-native` modules. - -```sh -npm install -D babel-preset-react-native -``` - -Ensure `.babelrc` contains: - -```js -// .babelrc -{ - "presets": ["react-native"], -} -``` - -And your jest config should look like: - -```js -// jest.config.js -const { jestPreset } = require('ts-jest'); - -module.exports = { - ...jestPreset, - preset: 'react-native', - globals: { - 'ts-jest': { - babelConfig: true - } - } -}; -``` - -## Angular 2 -When 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: - -```js -// jest.config.js -const { jestPreset } = require('ts-jest'); - -module.exports = { - // ... - transform: { - ...jestPreset.transform, - '^.+\\.html$': 'ts-jest' - }, - globals: { - 'ts-jest': { - stringifyContentPathRegex: '\\.html$' - } - } -}; -``` - - -## Tips -### Importing packages written in TypeScript - -If you have dependencies on npm packages that are written in TypeScript but are -**not** published in ES5 you have to tweak your configuration. For example -you depend on a private scoped package `@foo/bar` you have to add following to -your Jest configuration: - -```js -{ - // ... - "transformIgnorePatterns": [ - "/node_modules/(?!@foo/bar)" - ] - // ... -} -``` - -By 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`. - -### Logging - -This package is using [`bs-logger`](https://www.npmjs.com/package/bs-logger). +--- -Use environment variable `TS_JEST_LOG=xxx` to configure log targets. By default it'll log entries with level _warning_ and above to **stderr**. +## Getting Started -See the examples in [there](https://github.com/huafu/bs-logger#using-targets) to configure different target(s). +These instructions will get you setup to use TSJest in your project. For more detailed documentation, please check [online documentation](kulshekhar.github.io/ts-jest). -When posting an issue, it's best to join the full log file which you can create in CWD using: -```sh -TS_JEST_LOG=ts-jest.log jest -# or -TS_JEST_LOG=ts-jest.log npm run test -``` +| | using npm | using yarn | +|---:|---|---| +| **Prerequisites** | `npm i -D jest typescript` | `yarn add --dev jest typescript` | +| **Installing** | `npm i -D ts-jest` | `yarn add --dev ts-jest` | +| **Creating config** | `node_modules/.bin/ts-jest config:init` | `yarn ts-jest config:init` | +| **Running tests** | `npm t` or `node_modules/.bin/jest` | `yarn test` or `yarn jest` | -## Known Limitations +## Built With -### Known limitations for TS compiler options +* [TypeScript](https://www.typescriptlang.org/) - JavaScript that scales +* [Jest](https://jestjs.io/) - Delightful JavaScript Testing +* [TSJest](https://kulshekhar.github.io/ts-jest) - Jest processor for TypeScript _(yes, TSJest uses itself for its tests)_ -If you use `"baseUrl": ""`, you also have to change `jest config` a little bit (also check [Module path mapping](#module-path-mapping) section): +## Contributing -```json -"jest": { - "moduleDirectories": ["node_modules", ""] -} -``` +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. -### `const enum` is not supported if `isolatedModules` is enabled +## Versioning -This 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. +We **DOT NOT** use [SemVer](http://semver.org/) for versioning. Tho you can think about SemVer when reading our version, except our major number follow the one of Jest. For the versions available, see the [tags on this repository](https://github.com/kulshekhar/ts-jest/tags). -## How to Contribute -If 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. +## Authors/maintainers -### Quickstart to run tests (only if you're working on this package) +* **Kulshekhar Kabra** - [kulshekar](https://github.com/kulshekhar) +* **Gustav Wengel** - [GeeWee](https://github.com/GeeWee) +* **Ahn** - [ahnpnl](https://github.com/ahnpnl) +* **Huafu Gandon** - [huafu](https://github.com/huafu) -```sh -git clone https://github.com/kulshekhar/ts-jest -cd ts-jest -npm install -npm test -``` +See also the list of [contributors](https://github.com/kulshekhar/ts-jest/contributors) who participated in this project. ## License -Copyright (c) [Authors](AUTHORS). -This source code is licensed under the [MIT license](LICENSE). +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details diff --git a/docs/assets/img/documentation.png b/docs/assets/img/documentation.png new file mode 100644 index 0000000000..537e01372e Binary files /dev/null and b/docs/assets/img/documentation.png differ diff --git a/docs/assets/github.png b/docs/assets/img/github.png similarity index 100% rename from docs/assets/github.png rename to docs/assets/img/github.png diff --git a/docs/assets/pull-request.png b/docs/assets/img/pull-request.png similarity index 100% rename from docs/assets/pull-request.png rename to docs/assets/img/pull-request.png diff --git a/docs/assets/slack.png b/docs/assets/img/slack.png similarity index 100% rename from docs/assets/slack.png rename to docs/assets/img/slack.png diff --git a/docs/assets/troubleshooting.png b/docs/assets/img/troubleshooting.png similarity index 100% rename from docs/assets/troubleshooting.png rename to docs/assets/img/troubleshooting.png diff --git a/logo.png b/icon.png similarity index 100% rename from logo.png rename to icon.png diff --git a/package.json b/package.json index 88d3e27f18..61be85d2d5 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "bugs": { "url": "https://github.com/kulshekhar/ts-jest/issues" }, - "homepage": "https://github.com/kulshekhar/ts-jest#readme", + "homepage": "https://kulshekhar.github.io/ts-jest", "dependencies": { "bs-logger": "^0.2.5", "buffer-from": "^1.1.1",