Skip to content

Commit

Permalink
Merge pull request #307 from vuejs/remove-ts-dep
Browse files Browse the repository at this point in the history
fix: do not require ts-jest and typescript
  • Loading branch information
lmiller1990 authored Dec 7, 2020
2 parents 0aa9bdd + 7c195c7 commit 3823eb2
Show file tree
Hide file tree
Showing 8 changed files with 709 additions and 28 deletions.
8 changes: 4 additions & 4 deletions e2e/__projects__/babel-in-package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"test": "jest --no-cache test.js"
},
"dependencies": {
"vue": "3.0.0-alpha.10"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"jest": "^24.0.0"
"jest": "^24.0.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2",
"vue": "3.0.0-alpha.10"
},
"jest": {
"moduleFileExtensions": [
Expand Down
252 changes: 250 additions & 2 deletions e2e/__projects__/babel-in-package/yarn.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions e2e/__projects__/basic/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var _default = {
exports[\\"default\\"] = _default;
\\"use strict\\";
Object.defineProperty(exports, \\"__esModule\\", { value: true });
exports.render = void 0;
var vue_1 = require(\\"vue\\");
var _hoisted_1 = { class: \\"hello\\" };
function render(_ctx, _cache) {
Expand Down Expand Up @@ -77,6 +78,7 @@ var _default = {
exports[\\"default\\"] = _default;
\\"use strict\\";
Object.defineProperty(exports, \\"__esModule\\", { value: true });
exports.render = void 0;
var vue_1 = require(\\"vue\\");
var _hoisted_1 = { class: \\"hello\\" };
function render(_ctx, _cache) {
Expand Down
2 changes: 2 additions & 0 deletions e2e/__projects__/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"jest": "^24.0.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2",
"vue-class-component": "^8.0.0-beta.4"
},
"jest": {
Expand Down
252 changes: 250 additions & 2 deletions e2e/__projects__/basic/yarn.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const constants = require('./constants')
const loadPartialConfig = require('@babel/core').loadPartialConfig
const { resolveSync: resolveTsConfigSync } = require('tsconfig')
const chalk = require('chalk')
const path = require('path')
const fs = require('fs')
Expand Down Expand Up @@ -64,6 +65,11 @@ const getBabelOptions = function loadBabelOptions(filename, options = {}) {
}

const getTsJestConfig = function getTsJestConfig(config) {
const isUsingTs = resolveTsConfigSync(process.cwd())
if (!isUsingTs) {
return null
}

const createTransformer = require('ts-jest').createTransformer
const tr = createTransformer()
const configSet = tr.configsFor(config)
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"sass": "^1.23.7",
"semantic-release": "^15.13.2",
"stylus": "^0.54.5",
"typescript": "^3.2.2",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2",
"vue": "^3.0.3"
},
"peerDependencies": {
Expand All @@ -80,7 +81,7 @@
"chalk": "^2.1.0",
"convert-source-map": "^1.6.0",
"extract-from-css": "^0.4.4",
"ts-jest": "^24.0.0"
"tsconfig": "^7.0.0"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 3823eb2

Please sign in to comment.