From 4f261790cf7433b804e5de14c3d3fc6cfb820a29 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Mon, 5 Feb 2018 15:22:27 +0100 Subject: [PATCH 1/3] implements a custom typescript config possibility in compilers/typescript-compiler.js If a tsconfig.jest.json is found it will load that one instead of the default tsconfig.json --- lib/compilers/typescript-compiler.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/compilers/typescript-compiler.js b/lib/compilers/typescript-compiler.js index 1cb7c118..e3d72e75 100644 --- a/lib/compilers/typescript-compiler.js +++ b/lib/compilers/typescript-compiler.js @@ -4,6 +4,7 @@ const compileBabel = require('./babel-compiler') const loadBabelConfig = require('../load-babel-config.js') const cache = require('../cache') const logger = require('../logger') +const fs = require('fs') const defaultTypescriptConfig = { 'compilerOptions': { @@ -34,7 +35,12 @@ function getTypescriptConfig () { if (cachedConfig) { return cachedConfig } else { - const { config } = tsconfig.loadSync(process.cwd()) + const tscPath = process.cwd() + let tscFile = 'tsconfig.jest.json' + if (!fs.existsSync(tscPath+ '/'+ tscFile)){ + tscFile = false + } + const { config } = tsconfig.loadSync(tscPath, tscFile) if (!config) { logger.info('no tsconfig.json found, defaulting to default typescript options') From e6cb614028b4ed60d9fa4ea1bb8703dd876ae83f Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Wed, 7 Feb 2018 08:33:18 +0100 Subject: [PATCH 2/3] readme and package.json changes --- README.md | 12 +++++++----- package.json | 14 +++++++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 790786b1..102a03d7 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ -# vue-jest +# vue-jest-kn + +Jest Vue transformer with source map support
+custom tsconfig support - temporary npm, please avoid usage as it will be deleted sooner than later -Jest Vue transformer with source map support ## Usage ``` -npm install --save-dev vue-jest +npm install --save-dev vue-jest-kn ``` ## Setup @@ -14,7 +16,7 @@ To define vue-jest as a transformer for your .vue files, you need to map .vue fi ``` "transform": { - ".*\\.(vue)$": "/node_modules/vue-jest" + ".*\\.(vue)$": "/node_modules/vue-jest-kn" }, ``` @@ -30,7 +32,7 @@ To use source maps, you need to set `mapCoverage` to `true`. A full config will ], "transform": { "^.+\\.js$": "/node_modules/babel-jest", - ".*\\.(vue)$": "/node_modules/vue-jest" + ".*\\.(vue)$": "/node_modules/vue-jest-kn" }, "mapCoverage": true } diff --git a/package.json b/package.json index 19dad6f9..3421ee20 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "vue-jest", + "name": "vue-jest-kn", "version": "2.0.1", - "description": "Jest Vue transform", + "description": "Jest Vue transform that loads a custom tsconfig - temporary", "main": "vue-jest.js", "files": [ "vue-jest.js", @@ -27,7 +27,7 @@ "unit": "./test.sh", "unit:run": "jest test --no-cache --runInBand --coverage --coverageDirectory test/coverage" }, - "author": "Edd Yerburgh", + "author": "Edd Yerburgh, Lars Eggert", "license": "MIT", "devDependencies": { "babel-core": "^6.25.0", @@ -83,5 +83,13 @@ "repository": { "type": "git", "url": "git+https://github.com/eddyerburgh/vue-jest.git" + }, + "bugs": { + "url": "https://github.com/eddyerburgh/vue-jest/issues" + }, + "homepage": "https://github.com/eddyerburgh/vue-jest#readme", + "directories": { + "lib": "lib", + "test": "test" } } From b95845c7ecf49e33704bff879953a9fadf935b07 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Wed, 7 Feb 2018 08:35:52 +0100 Subject: [PATCH 3/3] package --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3421ee20..ebc96d49 100644 --- a/package.json +++ b/package.json @@ -82,12 +82,12 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/eddyerburgh/vue-jest.git" + "url": "git+https://github.com/webforgeeu/vue-jest" }, "bugs": { - "url": "https://github.com/eddyerburgh/vue-jest/issues" + "url": "https://github.com/webforgeeu/vue-jest/issues" }, - "homepage": "https://github.com/eddyerburgh/vue-jest#readme", + "homepage": "https://github.com/webforgeeu/vue-jest#readme", "directories": { "lib": "lib", "test": "test"