From 437f56cf99fc9c93f3897583ffa3a42550e2689d Mon Sep 17 00:00:00 2001 From: ky-is Date: Fri, 3 Aug 2018 10:52:18 -1000 Subject: [PATCH] fix(typescript): tsconfig whitespace (#2046) --- .../cli-plugin-typescript/__tests__/tsGenerator.spec.js | 9 +++++++-- .../generator/template/tsconfig.json | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/@vue/cli-plugin-typescript/__tests__/tsGenerator.spec.js b/packages/@vue/cli-plugin-typescript/__tests__/tsGenerator.spec.js index 281de004b..8cc134cc8 100644 --- a/packages/@vue/cli-plugin-typescript/__tests__/tsGenerator.spec.js +++ b/packages/@vue/cli-plugin-typescript/__tests__/tsGenerator.spec.js @@ -110,10 +110,11 @@ test('tsconfig.json should be valid json', async () => { expect(() => { JSON.parse(files['tsconfig.json']) }).not.toThrow() + expect(files['tsconfig.json']).not.toMatch('" ') }) test('compat with unit-mocha', async () => { - const { pkg } = await generateWithPlugin([ + const { pkg, files } = await generateWithPlugin([ { id: '@vue/cli-plugin-unit-mocha', apply: require('@vue/cli-plugin-unit-mocha/generator'), @@ -131,10 +132,12 @@ test('compat with unit-mocha', async () => { expect(pkg.devDependencies).toHaveProperty('@types/mocha') expect(pkg.devDependencies).toHaveProperty('@types/chai') + + expect(files['tsconfig.json']).not.toMatch('" ') }) test('compat with unit-jest', async () => { - const { pkg } = await generateWithPlugin([ + const { pkg, files } = await generateWithPlugin([ { id: '@vue/cli-plugin-unit-jest', apply: require('@vue/cli-plugin-unit-jest/generator'), @@ -151,4 +154,6 @@ test('compat with unit-jest', async () => { ]) expect(pkg.devDependencies).toHaveProperty('@types/jest') + + expect(files['tsconfig.json']).not.toMatch('" ') }) diff --git a/packages/@vue/cli-plugin-typescript/generator/template/tsconfig.json b/packages/@vue/cli-plugin-typescript/generator/template/tsconfig.json index eb7f6b837..e427d1e27 100644 --- a/packages/@vue/cli-plugin-typescript/generator/template/tsconfig.json +++ b/packages/@vue/cli-plugin-typescript/generator/template/tsconfig.json @@ -14,10 +14,11 @@ "sourceMap": true, "baseUrl": ".", "types": [ - "node"<%_ if (hasMocha) { _%>, + "node"<% if (hasMocha || hasJest) { %>,<% } %> + <%_ if (hasMocha) { _%> "mocha", "chai" - <%_ } else if (hasJest) { _%>, + <%_ } else if (hasJest) { _%> "jest" <%_ } _%> ],