Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kulshekhar/ts-jest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 27a205b0b6ad16d7d792551c2da685300d85adec
Choose a base ref
...
head repository: kulshekhar/ts-jest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6916e7b5d461f34cf5ddc1ae05d235bdcea6d689
Choose a head ref
Loading
Showing with 13,941 additions and 4,322 deletions.
  1. +2 −2 .editorconfig
  2. +0 −21 .github/ISSUE_TEMPLATE
  3. +20 −0 .github/ISSUE_TEMPLATE.md
  4. +4 −0 .gitignore
  5. +11 −1 .travis.yml
  6. +19 −0 AUTHORS
  7. +3 −0 CHANGELOG.md
  8. +60 −0 COLLABORATORS.md
  9. +154 −32 README.md
  10. +10 −5 appveyor.yml
  11. +0 −28 collaborator-guidelines.md
  12. +0 −1 index.js
  13. +8,090 −0 package-lock.json
  14. +54 −45 package.json
  15. +0 −1 preprocessor.js
  16. +26 −49 scripts/tests.js
  17. +0 −23 src/default-retrieve-file-handler.ts
  18. +14 −15 src/index.ts
  19. +0 −75 src/jest-types.ts
  20. +112 −55 src/postprocess.ts
  21. +75 −0 src/preprocess.ts
  22. +0 −88 src/preprocessor.ts
  23. +0 −17 src/transpile-if-ts.ts
  24. +57 −0 src/transpiler.ts
  25. +47 −0 src/types.ts
  26. +0 −228 src/utils.ts
  27. +38 −0 src/utils/cache-file.ts
  28. +13 −0 src/utils/constants.ts
  29. +16 −0 src/utils/format-diagnostics.ts
  30. +22 −0 src/utils/get-babel-rc.ts
  31. +26 −0 src/utils/get-cache-key.ts
  32. +131 −0 src/utils/get-ts-config.ts
  33. +8 −0 src/utils/get-ts-jest-config.ts
  34. +52 −0 src/utils/logger.ts
  35. +18 −0 src/utils/run-ts-diagnostics.ts
  36. +26 −0 tests/__helpers__/mock-jest-config.ts
  37. +24 −6 tests/__helpers__/runJest.ts
  38. +5 −5 tests/__helpers__/runJestInWatchMode.ts
  39. +75 −0 tests/__helpers__/test-utils.ts
  40. +16 −15 tests/__helpers__/utils.ts
  41. +8 −4 tests/__tests__/__snapshots__/html-transform.spec.ts.snap
  42. +12 −0 tests/__tests__/__snapshots__/ts-coverage-async.spec.ts.snap
  43. +12 −0 tests/__tests__/__snapshots__/ts-coverage.spec.ts.snap
  44. +31 −0 tests/__tests__/__snapshots__/tsconfig-comments.spec.ts.snap
  45. +20 −0 tests/__tests__/__snapshots__/tsconfig-default.spec.ts.snap
  46. +53 −0 tests/__tests__/__snapshots__/tsconfig-string.spec.ts.snap
  47. +36 −0 tests/__tests__/babel-config.spec.ts
  48. +2 −2 tests/__tests__/babelrc.spec.ts
  49. +29 −0 tests/__tests__/debug.spec.ts
  50. +15 −0 tests/__tests__/disable-sourcemap-support.spec.ts
  51. +28 −24 tests/__tests__/get-cache-key.spec.ts
  52. +39 −11 tests/__tests__/html-transform.spec.ts
  53. +9 −0 tests/__tests__/import-json.spec.ts
  54. +2 −3 tests/__tests__/import.spec.ts
  55. +4 −7 tests/__tests__/jest-hoist.spec.ts
  56. +10 −0 tests/__tests__/jest-projects-with-workspace.spec.ts
  57. +10 −0 tests/__tests__/jest-projects.spec.ts
  58. +1 −1 tests/__tests__/jestconfig-json.spec.ts
  59. +2 −2 tests/__tests__/jestconfig-package.spec.ts
  60. +11 −0 tests/__tests__/long-path.spec.ts
  61. +10 −0 tests/__tests__/no-json-module-file-ext.spec.ts
  62. +68 −0 tests/__tests__/postprocess.spec.ts
  63. +24 −0 tests/__tests__/rel-config-paths.spec.ts
  64. +2 −2 tests/__tests__/synthetic-default-imports.spec.ts
  65. +0 −31 tests/__tests__/transpile-if-ts.spec.ts
  66. +34 −0 tests/__tests__/transpiler.spec.ts
  67. +2 −3 tests/__tests__/ts-compilation.spec.ts
  68. +2 −5 tests/__tests__/ts-coverage-async.spec.ts
  69. +2 −5 tests/__tests__/ts-coverage.spec.ts
  70. +13 −0 tests/__tests__/ts-diagnostics.spec.ts
  71. +2 −2 tests/__tests__/ts-errors.spec.ts
  72. +10 −0 tests/__tests__/ts-jest-module-interface.spec.ts
  73. +20 −42 tests/__tests__/tsconfig-comments.spec.ts
  74. +53 −118 tests/__tests__/tsconfig-default.spec.ts
  75. +0 −83 tests/__tests__/tsconfig-inline.spec.ts
  76. +24 −148 tests/__tests__/tsconfig-string.spec.ts
  77. +3 −3 tests/__tests__/tsx-compilation.spec.ts
  78. +4 −3 tests/__tests__/tsx-errors.spec.ts
  79. +22 −0 tests/__tests__/use-config-from-node-modules.spec.ts
  80. +3 −3 tests/__tests__/use-strict.spec.ts
  81. +7 −6 tests/__tests__/watch.spec.ts
  82. +1 −0 tests/babel-config-invalid/.gitignore
  83. +1 −0 tests/babel-config-invalid/Hello.ts
  84. 0 ...h/long-src-path/long-src-path/long-src-path/long-src-path → babel-config-invalid}/NullCoverage.js
  85. +7 −0 tests/babel-config-invalid/__tests__/index.test.ts
  86. +25 −0 tests/babel-config-invalid/package.json
  87. 0 tests/{deprecated-tsconfig → babel-config-invalid}/tsconfig.json
  88. +5 −0 tests/babel-config-merge-ignore-babelrc/.babelrc
  89. +1 −0 tests/babel-config-merge-ignore-babelrc/.gitignore
  90. +1 −0 tests/babel-config-merge-ignore-babelrc/Hello.ts
  91. +6 −0 tests/babel-config-merge-ignore-babelrc/NullCoverage.js
  92. +7 −0 tests/babel-config-merge-ignore-babelrc/__tests__/index.test.ts
  93. +27 −0 tests/babel-config-merge-ignore-babelrc/package.json
  94. +10 −0 tests/babel-config-merge-ignore-babelrc/tsconfig.json
  95. +5 −0 tests/babel-config-merge-with-babelrc/.babelrc
  96. +1 −0 tests/babel-config-merge-with-babelrc/.gitignore
  97. +1 −0 tests/babel-config-merge-with-babelrc/Hello.ts
  98. +6 −0 tests/babel-config-merge-with-babelrc/NullCoverage.js
  99. +7 −0 tests/babel-config-merge-with-babelrc/__tests__/index.test.ts
  100. +28 −0 tests/babel-config-merge-with-babelrc/package.json
  101. +10 −0 tests/babel-config-merge-with-babelrc/tsconfig.json
  102. +1 −0 tests/babel-config/.gitignore
  103. +1 −0 tests/babel-config/Hello.ts
  104. +6 −0 tests/babel-config/NullCoverage.js
  105. +7 −0 tests/babel-config/__tests__/index.test.ts
  106. +25 −0 tests/babel-config/package.json
  107. +10 −0 tests/babel-config/tsconfig.json
  108. +8 −4 tests/button/Button.tsx
  109. +10 −7 tests/button/__tests__/Button.test.tsx
  110. +5 −3 tests/button/package.json
  111. +0 −1 tests/deprecated-tsconfig/Hello.ts
  112. +0 −9 tests/deprecated-tsconfig/__tests__/Hello.test.ts
  113. +0 −27 tests/deprecated-tsconfig/package.json
  114. +0 −1,999 tests/deprecated-tsconfig/yarn.lock
  115. +6 −4 tests/dynamic-imports/jest.allowdefaultimports.json
  116. +5 −3 tests/dynamic-imports/package.json
  117. +2 −2 tests/hoist-errors/Hello.ts
  118. +5 −4 tests/hoist-errors/package.json
  119. +2 −2 tests/hoist-test/__tests__/jest-hoist.test.ts
  120. +5 −3 tests/hoist-test/package.json
  121. +1 −0 tests/import-json/.gitignore
  122. +9 −0 tests/import-json/__tests__/pkg.test.ts
  123. +15 −0 tests/import-json/package.json
  124. +3 −0 tests/import-json/pkg.ts
  125. +5 −0 tests/import-json/tsconfig.json
  126. +9 −4 tests/imports-test/package.json
  127. +1 −1 tests/imports-test/tsconfig.json
  128. +20 −0 tests/jest-projects-with-workspace/package.json
  129. +18 −0 tests/jest-projects-with-workspace/packages/bar/package.json
  130. +3 −0 tests/jest-projects-with-workspace/packages/bar/src/index.ts
  131. +5 −0 tests/jest-projects-with-workspace/packages/bar/test/index.test.ts
  132. +8 −0 tests/jest-projects-with-workspace/packages/bar/tsconfig.json
  133. +18 −0 tests/jest-projects-with-workspace/packages/foo/package.json
  134. +3 −0 tests/jest-projects-with-workspace/packages/foo/src/index.ts
  135. +5 −0 tests/jest-projects-with-workspace/packages/foo/test/index.test.ts
  136. +8 −0 tests/jest-projects-with-workspace/packages/foo/tsconfig.json
  137. +5 −0 tests/jest-projects/package.json
  138. +3 −0 tests/jest-projects/packages/child/Hello.ts
  139. +5 −0 tests/jest-projects/packages/child/__test__/index.test.ts
  140. +8 −0 tests/jest-projects/packages/child/custom-tsconfig.json
  141. +22 −0 tests/jest-projects/packages/child/package.json
  142. +3 −3 tests/jestconfig-test/jest.json
  143. +76 −0 tests/metadata-emit/__tests__/metadata.test.ts
  144. +22 −0 tests/metadata-emit/package.json
  145. +25 −0 tests/metadata-emit/src/classes.ts
  146. +3 −0 tests/metadata-emit/src/other-class.ts
  147. +14 −0 tests/metadata-emit/tsconfig.json
  148. +1 −0 tests/no-json-module-file-ext/__tests__/transpile-me.test.ts
  149. +19 −0 tests/no-json-module-file-ext/package.json
  150. +11 −0 tests/no-json-module-file-ext/tsconfig.json
  151. +1 −0 tests/no-sourcemaps/.gitignore
  152. +28 −0 tests/no-sourcemaps/Hello.ts
  153. +6 −0 tests/no-sourcemaps/NullCoverage.js
  154. +9 −0 tests/no-sourcemaps/__tests__/Hello.test.ts
  155. +27 −0 tests/no-sourcemaps/package.json
  156. +10 −0 tests/no-sourcemaps/tsconfig.json
  157. +5 −3 tests/no-synthetic-default/package.json
  158. +14 −0 tests/rel-config-paths/config/jest.config.invalid.js
  159. +14 −0 tests/rel-config-paths/config/jest.config.js
  160. +6 −0 tests/rel-config-paths/config/tsconfig.base.json
  161. +6 −0 tests/rel-config-paths/config/tsconfig.test.json
  162. +9 −0 tests/rel-config-paths/custom-test-dir/test.ts
  163. +1 −0 tests/rel-config-paths/package.json
  164. +3 −0 tests/rel-config-paths/src/index.ts
  165. +1 −1 tests/simple-async/Hello.ts
  166. +6 −5 tests/simple-async/package.json
  167. +5 −3 tests/simple-long-path/package.json
  168. 0 ...ng-src-path/long-src-path/long-src-path/long-src-path/long-src-path/long-src-path → src}/Hello.ts
  169. +6 −0 tests/simple-long-path/src/NullCoverage.ts
  170. +1 −1 tests/simple/Hello.ts
  171. +6 −5 tests/simple/package.json
  172. +1 −1 tests/skip-babelrc/Hello.ts
  173. +5 −4 tests/skip-babelrc/package.json
  174. +5 −3 tests/synthetic-default/package.json
  175. +1 −1 tests/synthetic-default/tsconfig.json
  176. +17 −0 tests/ts-diagnostics/Hello.ts
  177. +7 −0 tests/ts-diagnostics/__tests__/Hello.test.ts
  178. +24 −0 tests/ts-diagnostics/package.json
  179. +8 −0 tests/ts-diagnostics/tsconfig.json
  180. +19 −0 tests/ts-jest-module-interface/__tests__/ts-jest-module-interface.test.ts
  181. +19 −0 tests/ts-jest-module-interface/package.json
  182. +11 −0 tests/ts-jest-module-interface/tsconfig.json
  183. +1 −1 tests/tsconfig-test/allows-comments2.json
  184. +0 −26 tests/tsconfig.json
  185. +1 −1 tests/use-babelrc/Hello.ts
  186. +5 −3 tests/use-babelrc/package.json
  187. +28 −0 tests/use-config-from-node-modules/Hello.ts
  188. +9 −0 tests/use-config-from-node-modules/__tests__/Hello.test.ts
  189. +20 −0 tests/use-config-from-node-modules/package.json
  190. +13 −0 tests/use-config-from-node-modules/tsconfig.json
  191. +1 −1 tests/use-strict/Strict-valid.ts
  192. +0 −2 tests/use-strict/__tests__/Strict-valid.test.ts
  193. +0 −2 tests/use-strict/__tests__/Strict.test.ts
  194. +5 −4 tests/use-strict/package.json
  195. +1 −1 tests/watch-test/Hello.ts
  196. +5 −4 tests/watch-test/package.json
  197. +6 −12 tsconfig.json → tsconfig.base.json
  198. +11 −0 tsconfig.build.json
  199. +19 −0 tslint.json
  200. +3,073 −942 yarn.lock
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[*.ts]
indent_style = space
indent_size = 4
indent_size = 2

[*.tsx]
indent_style = space
indent_size = 4
indent_size = 2
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE

This file was deleted.

20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- First of all, check the troubleshooting wiki page for common issues at:
https://github.com/kulshekhar/ts-jest/wiki/Troubleshooting -->

## Issue <!-- describe the issue below -->:


## Expected behavior <!-- describe the expected behavior below -->:


## Output from debug log <!-- You can activate the debug logger by setting the environment variable TS_JEST_DEBUG="true" before running yarn test. The output of the logger will be in **<your_project_dir>/node_modules/ts-jest/debug.txt**, paste it below -->:
```bash
# content of debug.txt :

```


## Minimal repo <!-- If you haven't already, create the smallest possible repo that reproduces this issue by running `npm install` and `npm test`. This will speed up any fixes that this issue might need. Paste the minimal repo URL below -->:


<!-- Optional (but highly recommended): Configure Travis (or your favorite system) with the minimal repo. This allows potential solutions to be tested against the minimal repo. This saves everyone time and avoids a lot of back and forth. -->
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -43,3 +43,7 @@ jspm_packages

.vscode
.idea


# Long paths
tests/simple-long-path/long-src-path
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
dist: trusty
sudo: required
language: node_js
cache: yarn
git:
depth: 5
node_js:
- "10"
- "8"
- "6"
- "4"
before_install:
- sudo sysctl fs.inotify.max_user_watches=524288
- yarn global add greenkeeper-lockfile@1 rimraf
before_script:
# - greenkeeper-lockfile-update
script:
- yarn test
after_script:
# - greenkeeper-lockfile-upload
19 changes: 19 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -3,37 +3,56 @@
#
# Name/Organization <email address>

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>
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### All release changes can be seen in the release page

Release page URL: https://github.com/kulshekhar/ts-jest/releases
60 changes: 60 additions & 0 deletions COLLABORATORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Collaborator Guidelines](#collaborator-guidelines)
- [Installing and building the project](#installing-and-building-the-project)
- [Merging PRs](#merging-prs)
- [Versioning](#versioning)
- [Tests](#tests)
- [How to add tests](#how-to-add-tests)
- [How to run tests](#how-to-run-tests)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# 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

To be able to install and build the project probably, `rimraf` is required. Install `rimraf` by running
```
yarn global add rimraf
```

After installing `rimraf`, `yarn` command can be run normally when installing dependencies for the project

## 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.

### How to add tests
- Tests are added by creating a new file in tests/__tests__
- A test usually consists of two parts
- A directory under tests/ that have some files that should result in a specific output when jest is passed through it
- A file under tests/__tests__ that uses the runJest command to run Jest on the specified directory, and makes asserts on the output of stdout and stderr
When asserting things on the output, it is common to both assert something about the exit code, and something about the output. Always assert on the output first, before asserting on the status code - as it leads to much nicer error messages when refactoring. (You get the full output text, rather than just '0 didn't equal 1')

### How to run tests
Tests are run through `yarn test`
Loading