Skip to content

Commit 5af29e9

Browse files
committed
fix: do not require ts-jest and typescript
1 parent 0aa9bdd commit 5af29e9

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

lib/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const constants = require('./constants')
22
const loadPartialConfig = require('@babel/core').loadPartialConfig
3+
const { resolveSync: resolveTsConfigSync } = require('tsconfig')
34
const chalk = require('chalk')
45
const path = require('path')
56
const fs = require('fs')
@@ -64,6 +65,11 @@ const getBabelOptions = function loadBabelOptions(filename, options = {}) {
6465
}
6566

6667
const getTsJestConfig = function getTsJestConfig(config) {
68+
const isUsingTs = resolveTsConfigSync(process.cwd())
69+
if (!isUsingTs) {
70+
return null
71+
}
72+
6773
const createTransformer = require('ts-jest').createTransformer
6874
const tr = createTransformer()
6975
const configSet = tr.configsFor(config)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"chalk": "^2.1.0",
8181
"convert-source-map": "^1.6.0",
8282
"extract-from-css": "^0.4.4",
83-
"ts-jest": "^24.0.0"
83+
"tsconfig": "^7.0.0"
8484
},
8585
"repository": {
8686
"type": "git",

yarn.lock

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,16 @@
10761076
version "1.0.1"
10771077
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
10781078

1079+
"@types/strip-bom@^3.0.0":
1080+
version "3.0.0"
1081+
resolved "https://registry.yarnpkg.com/@types/strip-bom/-/strip-bom-3.0.0.tgz#14a8ec3956c2e81edb7520790aecf21c290aebd2"
1082+
integrity sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I=
1083+
1084+
"@types/strip-json-comments@0.0.30":
1085+
version "0.0.30"
1086+
resolved "https://registry.yarnpkg.com/@types/strip-json-comments/-/strip-json-comments-0.0.30.tgz#9aa30c04db212a9a0649d6ae6fd50accc40748a1"
1087+
integrity sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==
1088+
10791089
"@types/yargs-parser@*":
10801090
version "15.0.0"
10811091
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d"
@@ -7758,7 +7768,7 @@ strip-indent@^2.0.0:
77587768
version "2.0.0"
77597769
resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68"
77607770

7761-
strip-json-comments@^2.0.1, strip-json-comments@~2.0.1:
7771+
strip-json-comments@^2.0.0, strip-json-comments@^2.0.1, strip-json-comments@~2.0.1:
77627772
version "2.0.1"
77637773
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
77647774

@@ -8001,6 +8011,16 @@ ts-jest@^24.0.0:
80018011
semver "^5.5"
80028012
yargs-parser "10.x"
80038013

8014+
tsconfig@^7.0.0:
8015+
version "7.0.0"
8016+
resolved "https://registry.yarnpkg.com/tsconfig/-/tsconfig-7.0.0.tgz#84538875a4dc216e5c4a5432b3a4dec3d54e91b7"
8017+
integrity sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==
8018+
dependencies:
8019+
"@types/strip-bom" "^3.0.0"
8020+
"@types/strip-json-comments" "0.0.30"
8021+
strip-bom "^3.0.0"
8022+
strip-json-comments "^2.0.0"
8023+
80048024
tslib@^1.10.0, tslib@^1.9.0:
80058025
version "1.11.1"
80068026
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35"

0 commit comments

Comments
 (0)