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: 1ac501ac52986c0f143900c2a441f472666f4991
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: ad58c9b73a340eb8cf17f1999682a6c1bda00a7e
Choose a head ref
Loading
Showing with 28,361 additions and 14,634 deletions.
  1. +1 −0 .eslintignore
  2. +4 −1 .eslintrc.js
  3. +2 −0 .npmignore
  4. +57 −45 .travis.yml
  5. +162 −24 CHANGELOG.md
  6. +1 −1 CONTRIBUTING.md
  7. +8 −6 README.md
  8. +41 −0 TROUBLESHOOTING.md
  9. +1 −1 appveyor.yml
  10. +6 −6 docs/Gemfile.lock
  11. +6 −2 docs/index.md
  12. +15 −5 docs/user/config/babelConfig.md
  13. +93 −0 docs/user/config/compilerHost.md
  14. +2 −2 docs/user/config/diagnostics.md
  15. +6 −0 docs/user/config/index.md
  16. +69 −0 docs/user/config/packageJson.md
  17. +18 −1 e2e/README.md
  18. +2 −1 e2e/__cases__/allow-js/tsconfig.json
  19. +6 −0 e2e/__cases__/compiler-host/main.spec.ts
  20. +1 −0 e2e/__cases__/compiler-host/main.ts
  21. +4 −0 e2e/__cases__/enum/constants.ts
  22. +6 −0 e2e/__cases__/enum/enum.spec.ts
  23. +9 −0 e2e/__cases__/hoisting/disable-automock/disable-automock.spec.ts
  24. +3 −0 e2e/__cases__/hoisting/disable-automock/disable-automock.ts
  25. +9 −0 e2e/__cases__/hoisting/enable-automock/enable-automock.spec.ts
  26. +3 −0 e2e/__cases__/hoisting/enable-automock/enable-automock.ts
  27. +0 −21 e2e/__cases__/hoisting/hello.spec.ts
  28. +13 −0 e2e/__cases__/hoisting/mock-unmock/mock-unmock.spec.ts
  29. 0 e2e/__cases__/hoisting/{hello.ts → mock-unmock/mock-unmock.ts}
  30. +15 −1 e2e/__cases__/test-helpers/pass.spec.ts
  31. +10 −0 e2e/__cases__/test-helpers/to-mock.ts
  32. +5 −2 e2e/__helpers__/templates.ts
  33. +5 −2 e2e/__helpers__/test-case/processed-file-io.ts
  34. +16 −21 e2e/__helpers__/test-case/run-descriptor.ts
  35. +2 −1 e2e/__helpers__/test-case/run-result.ts
  36. +5 −4 e2e/__helpers__/test-case/runtime.ts
  37. +3 −1 e2e/__helpers__/test-case/types.ts
  38. +1 −0 e2e/__monorepos__/simple/dependency/imported-module.ts
  39. +3 −0 e2e/__monorepos__/simple/dependency/index.ts
  40. +8 −0 e2e/__monorepos__/simple/dependency/package.json
  41. +21 −0 e2e/__monorepos__/simple/dependency/tsconfig.json
  42. +3 −0 e2e/__monorepos__/simple/with-dependency/index.ts
  43. +48 −0 e2e/__monorepos__/simple/with-dependency/package.json
  44. +7 −0 e2e/__monorepos__/simple/with-dependency/test/index.spec.ts
  45. +21 −0 e2e/__monorepos__/simple/with-dependency/tsconfig.json
  46. +5 −0 e2e/__monorepos__/yarn-workspace-composite/jest.config.js
  47. +16 −0 e2e/__monorepos__/yarn-workspace-composite/package.json
  48. +6 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-app/jest.config.js
  49. +9 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-app/main.test.ts
  50. +12 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-app/main.ts
  51. +11 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-app/package.json
  52. +5 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-app/tsconfig.json
  53. +11 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-library/index.test.ts
  54. +11 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-library/index.ts
  55. +6 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-library/jest.config.js
  56. +5 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-library/package.json
  57. +9 −0 e2e/__monorepos__/yarn-workspace-composite/packages/my-library/tsconfig.json
  58. +16 −0 e2e/__monorepos__/yarn-workspace-composite/tsconfig.json
  59. +3,452 −0 e2e/__monorepos__/yarn-workspace-composite/yarn.lock
  60. +1,906 −2,327 e2e/__templates__/default/package-lock.json
  61. +9 −5 e2e/__templates__/default/package.json
  62. +2 −0 e2e/__templates__/with-babel-7-string-config/babel.config.js
  63. +5 −0 e2e/__templates__/with-babel-7-string-config/jest.config.js
  64. +5,554 −0 e2e/__templates__/with-babel-7-string-config/package-lock.json
  65. +21 −0 e2e/__templates__/with-babel-7-string-config/package.json
  66. +8 −0 e2e/__templates__/with-babel-7-string-config/tsconfig.json
  67. +3,348 −2,638 e2e/__templates__/with-babel-7/package-lock.json
  68. +7 −7 e2e/__templates__/with-babel-7/package.json
  69. +1,906 −2,327 e2e/__templates__/with-typescript-2-7/package-lock.json
  70. +4 −4 e2e/__templates__/with-typescript-2-7/package.json
  71. +1,901 −2,322 e2e/__templates__/with-unsupported-version/package-lock.json
  72. +4 −4 e2e/__templates__/with-unsupported-version/package.json
  73. +34 −0 e2e/__tests__/__snapshots__/allow-js.test.ts.snap
  74. +213 −0 e2e/__tests__/__snapshots__/compiler-host.test.ts.snap
  75. +41 −18 e2e/__tests__/__snapshots__/coverage.test.ts.snap
  76. +55 −6 e2e/__tests__/__snapshots__/deep-path.test.ts.snap
  77. +46 −9 e2e/__tests__/__snapshots__/diagnostics.test.ts.snap
  78. +578 −136 e2e/__tests__/__snapshots__/hoisting.test.ts.snap
  79. +17 −0 e2e/__tests__/__snapshots__/isolated-modules.test.ts.snap
  80. +81 −32 e2e/__tests__/__snapshots__/logger.test.ts.snap
  81. +93 −0 e2e/__tests__/__snapshots__/source-map.test.ts.snap
  82. +6 −8 e2e/__tests__/__snapshots__/test-helpers.test.ts.snap
  83. +52 −0 e2e/__tests__/compiler-host.test.ts
  84. +13 −0 e2e/__tests__/enum.test.ts
  85. +36 −3 e2e/__tests__/hoisting.test.ts
  86. +47 −9 e2e/__tests__/module-kinds/__snapshots__/amd.test.ts.snap
  87. +59 −7 e2e/__tests__/module-kinds/__snapshots__/commonjs.test.ts.snap
  88. +47 −9 e2e/__tests__/module-kinds/__snapshots__/es2015.test.ts.snap
  89. +47 −9 e2e/__tests__/module-kinds/__snapshots__/esnext.test.ts.snap
  90. +47 −9 e2e/__tests__/module-kinds/__snapshots__/none.test.ts.snap
  91. +47 −9 e2e/__tests__/module-kinds/__snapshots__/system.test.ts.snap
  92. +47 −9 e2e/__tests__/module-kinds/__snapshots__/umd.test.ts.snap
  93. +1 −0 e2e/__tests__/module-kinds/amd.test.ts
  94. +1 −0 e2e/__tests__/module-kinds/commonjs.test.ts
  95. +1 −0 e2e/__tests__/module-kinds/es2015.test.ts
  96. +1 −0 e2e/__tests__/module-kinds/esnext.test.ts
  97. +1 −0 e2e/__tests__/module-kinds/none.test.ts
  98. +1 −0 e2e/__tests__/module-kinds/system.test.ts
  99. +1 −0 e2e/__tests__/module-kinds/umd.test.ts
  100. +1 −0 jest.config.js
  101. +4,752 −3,435 package-lock.json
  102. +31 −24 package.json
  103. +3 −1 scripts/lib/bundle.js
  104. +85 −67 scripts/test-external-project.js
  105. +28 −46 src/__helpers__/fakers.ts
  106. +1 −1 src/__helpers__/source-maps.ts
  107. +7 −0 src/__mocks__/.babelrc-foo
  108. +7 −0 src/__mocks__/babel-foo.config.js
  109. +3 −0 src/__mocks__/package-foo.json
  110. +4 −4 src/cli/cli.spec.ts
  111. +13 −15 src/cli/config/migrate.ts
  112. +1 −1 src/cli/helpers/presets.ts
  113. +1 −1 src/cli/index.ts
  114. +0 −208 src/compiler.spec.ts
  115. +0 −331 src/compiler.ts
  116. +90 −0 src/compiler/__snapshots__/language-service.spec.ts.snap
  117. +151 −0 src/compiler/__snapshots__/program.spec.ts.snap
  118. +89 −0 src/compiler/__snapshots__/transpile-module.spec.ts.snap
  119. +188 −0 src/compiler/instance.ts
  120. +187 −0 src/compiler/language-service.spec.ts
  121. +136 −0 src/compiler/language-service.ts
  122. +388 −0 src/compiler/program.spec.ts
  123. +180 −0 src/compiler/program.ts
  124. +178 −0 src/compiler/transpile-module.spec.ts
  125. +32 −0 src/compiler/transpile-module.ts
  126. +117 −1 src/config/__snapshots__/config-set.spec.ts.snap
  127. +633 −181 src/config/config-set.spec.ts
  128. +88 −57 src/config/config-set.ts
  129. +4 −2 src/config/create-jest-preset.ts
  130. +2 −1 src/config/paths-to-module-name-mapper.ts
  131. +3 −0 src/index.ts
  132. +0 −18 src/shims.d.ts
  133. +46 −24 src/transformers/hoist-jest.spec.ts
  134. +13 −10 src/transformers/hoist-jest.ts
  135. +86 −23 src/ts-jest-transformer.spec.ts
  136. +49 −33 src/ts-jest-transformer.ts
  137. +102 −47 src/types.ts
  138. +1 −1 src/util/backports.spec.ts
  139. +2 −1 src/util/backports.ts
  140. +24 −0 src/util/importer.spec.ts
  141. +8 −4 src/util/importer.ts
  142. +6 −9 src/util/messages.ts
  143. +1 −1 src/util/sha1.spec.ts
  144. +24 −20 src/util/testing.ts
  145. +1 −2 src/util/ts-error.ts
  146. +3 −3 src/util/version-checkers.spec.ts
  147. +3 −3 src/util/version-checkers.ts
  148. +2 −2 tsconfig.build.json
  149. +3 −2 tsconfig.json
  150. +1 −0 tslint.json
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist/
node_modules/
e2e/__cases__/
e2e/__workdir_synlink__/
coverage/
docs/
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -4,9 +4,12 @@ module.exports = {
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 5,
ecmaVersion: 2020,
sourceType: 'module',
impliedStrict: true,
ecmaFeatures: {
jsx: true,
},
},
rules: {
'no-console': ['error', { allow: ['warn', 'error', 'log'] }],
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -70,6 +70,8 @@ tslint.json
.npmrc
.markdownlint.yaml
.cache
.gitattributes
icon.png

# Github Pages
docs
102 changes: 57 additions & 45 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
language: node_js

env:
- TS_JEST_E2E_WORKDIR=/tmp/ts-jest-e2e-workdir TS_JEST_E2E_OPTIMIZATIONS=1

cache:
npm: true
directories:
- .cache
- /tmp/ts-jest-e2e-workdir/__templates__

node_js:
- "10"
- "6"

sudo: false

before_install:
# Disabled, randomly works :-/
# https://github.com/scikit-learn/scikit-learn/issues/10927
# - |
# set -e
# # fail loudly when force-pushed, that is why there is the `|| 'dummy.js'` part
# MODIFIED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE || echo 'dummy.js')
# # waiting for native solution https://github.com/travis-ci/travis-ci/issues/6301
# if ! echo ${MODIFIED_FILES} | grep -qvE '^docs/|^\.gitignore|^\.gitattributes|\.md$|^appveyor\.yml$|^icon\.png$|^commitlint\.config\.js$'; then
# echo "Only docs were updated, stopping build process."
# exit
# fi
# ensure we have npm >= 5.8 so that we can use `npm ci` instead of `npm install` (much faster)
- dpkg --compare-versions `npm -v` ge 5.8 || npm i -g npm@latest
# we report coverages only within node 10, ensure we have the coveralls bin installed
- 'if [[ "$(node --version)" == v10.* ]]; then npm install --global coveralls; fi'

script:
- npm run clean -- --when-ci-commit-message
# only grab coverage data on node 10
- |
if [[ "$(node --version)" == v10.* ]]; then
npm run test -- --runInBand --coverage;
else
npm run test -- --runInBand;
fi
after_success:
# report coverages to coveralls
- 'if [[ "$(node --version)" == v10.* && -s coverage/lcov.info ]]; then cat coverage/lcov.info | coveralls; fi'
jobs:
include:
- os: windows
node_js: 8
env: TS_JEST_E2E_WORKDIR=\%APPDATA%\ts-jest-e2e-workdir TS_JEST_E2E_OPTIMIZATIONS=1
cache:
npm: true
directories:
- .cache
- \%APPDATA%\ts-jest-e2e-workdir\__templates__
script:
- npm run clean -- --when-ci-commit-message
- npm run test:unit -- --runInBand
- os: windows
node_js: 12
env: TS_JEST_E2E_WORKDIR=\%APPDATA%\ts-jest-e2e-workdir TS_JEST_E2E_OPTIMIZATIONS=1
cache:
npm: true
directories:
- .cache
- \%APPDATA%\ts-jest-e2e-workdir\__templates__
before_install:
- npm i -g yarn
script:
- npm run clean -- --when-ci-commit-message
- npm run test:monorepo
- os: linux
node_js: 10
env: TS_JEST_E2E_WORKDIR=/tmp/ts-jest-e2e-workdir TS_JEST_E2E_OPTIMIZATIONS=1
before_install:
# Disabled, randomly works :-/
# https://github.com/scikit-learn/scikit-learn/issues/10927
# - |
# set -e
# # fail loudly when force-pushed, that is why there is the `|| 'dummy.js'` part
# MODIFIED_FILES=$(git diff --name-only $TRAVIS_COMMIT_RANGE || echo 'dummy.js')
# # waiting for native solution https://github.com/travis-ci/travis-ci/issues/6301
# if ! echo ${MODIFIED_FILES} | grep -qvE '^docs/|^\.gitignore|^\.gitattributes|\.md$|^appveyor\.yml$|^icon\.png$|^commitlint\.config\.js$'; then
# echo "Only docs were updated, stopping build process."
# exit
# fi
# we report coverages only within node 10, ensure we have the coveralls bin installed
- npm i -g coveralls
cache:
npm: true
yarn: true
directories:
- .cache
- /tmp/ts-jest-e2e-workdir/__templates__
script:
- npm run clean -- --when-ci-commit-message
# only grab coverage data on node 10
- npm run test -- --runInBand --coverage
- npm run test:monorepo
after_success:
# report coverages to coveralls
- if [[ -s coverage/lcov.info ]]; then cat coverage/lcov.info | coveralls; fi
Loading