Skip to content

Commit 3823eb2

Browse files
authored
Merge pull request #307 from vuejs/remove-ts-dep
fix: do not require ts-jest and typescript
2 parents 0aa9bdd + 7c195c7 commit 3823eb2

File tree

8 files changed

+709
-28
lines changed

8 files changed

+709
-28
lines changed

e2e/__projects__/babel-in-package/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"test": "jest --no-cache test.js"
99
},
1010
"dependencies": {
11-
"vue": "3.0.0-alpha.10"
12-
},
13-
"devDependencies": {
1411
"@babel/core": "^7.2.2",
1512
"@babel/preset-env": "^7.2.3",
16-
"jest": "^24.0.0"
13+
"jest": "^24.0.0",
14+
"ts-jest": "^26.4.4",
15+
"typescript": "^4.1.2",
16+
"vue": "3.0.0-alpha.10"
1717
},
1818
"jest": {
1919
"moduleFileExtensions": [

e2e/__projects__/babel-in-package/yarn.lock

+250-2
Large diffs are not rendered by default.

e2e/__projects__/basic/__snapshots__/test.js.snap

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var _default = {
3333
exports[\\"default\\"] = _default;
3434
\\"use strict\\";
3535
Object.defineProperty(exports, \\"__esModule\\", { value: true });
36+
exports.render = void 0;
3637
var vue_1 = require(\\"vue\\");
3738
var _hoisted_1 = { class: \\"hello\\" };
3839
function render(_ctx, _cache) {
@@ -77,6 +78,7 @@ var _default = {
7778
exports[\\"default\\"] = _default;
7879
\\"use strict\\";
7980
Object.defineProperty(exports, \\"__esModule\\", { value: true });
81+
exports.render = void 0;
8082
var vue_1 = require(\\"vue\\");
8183
var _hoisted_1 = { class: \\"hello\\" };
8284
function render(_ctx, _cache) {

e2e/__projects__/basic/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"babel-plugin-syntax-jsx": "^6.18.0",
1919
"babel-plugin-transform-vue-jsx": "^3.7.0",
2020
"jest": "^24.0.0",
21+
"ts-jest": "^26.4.4",
22+
"typescript": "^4.1.2",
2123
"vue-class-component": "^8.0.0-beta.4"
2224
},
2325
"jest": {

e2e/__projects__/basic/yarn.lock

+250-2
Large diffs are not rendered by default.

lib/utils.js

+6
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

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"sass": "^1.23.7",
5757
"semantic-release": "^15.13.2",
5858
"stylus": "^0.54.5",
59-
"typescript": "^3.2.2",
59+
"ts-jest": "^26.4.4",
60+
"typescript": "^4.1.2",
6061
"vue": "^3.0.3"
6162
},
6263
"peerDependencies": {
@@ -80,7 +81,7 @@
8081
"chalk": "^2.1.0",
8182
"convert-source-map": "^1.6.0",
8283
"extract-from-css": "^0.4.4",
83-
"ts-jest": "^24.0.0"
84+
"tsconfig": "^7.0.0"
8485
},
8586
"repository": {
8687
"type": "git",

0 commit comments

Comments
 (0)