From 58177d25cd7e56a2bc877c2a2c90631d4dec804b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20L=C3=BCnborg?= Date: Wed, 21 Aug 2019 09:34:16 +0200 Subject: [PATCH] fix: eslint should override env for **/tests/** subfolders (#4447) close #4397 --- .../@vue/cli-plugin-unit-jest/generator/index.js | 13 +++++++++++++ .../@vue/cli-plugin-unit-mocha/generator/index.js | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/@vue/cli-plugin-unit-jest/generator/index.js b/packages/@vue/cli-plugin-unit-jest/generator/index.js index bde06aa5de..998bf8b805 100644 --- a/packages/@vue/cli-plugin-unit-jest/generator/index.js +++ b/packages/@vue/cli-plugin-unit-jest/generator/index.js @@ -77,6 +77,19 @@ module.exports = (api, _, __, invoking) => { if (api.hasPlugin('eslint')) { applyESLint(api) + + api.extendPackage({ + eslintConfig: { + overrides: [ + { + files: ['**/__tests__/*.{j,t}s?(x)'], + env: { + jest: true + } + } + ] + } + }) } } diff --git a/packages/@vue/cli-plugin-unit-mocha/generator/index.js b/packages/@vue/cli-plugin-unit-mocha/generator/index.js index 7e1d2da970..a6298cb5fd 100644 --- a/packages/@vue/cli-plugin-unit-mocha/generator/index.js +++ b/packages/@vue/cli-plugin-unit-mocha/generator/index.js @@ -15,6 +15,18 @@ module.exports = (api, _, __, invoking) => { if (api.hasPlugin('eslint')) { applyESLint(api) + api.extendPackage({ + eslintConfig: { + overrides: [ + { + files: ['**/__tests__/*.{j,t}s?(x)'], + env: { + mocha: true + } + } + ] + } + }) } if (api.hasPlugin('typescript')) {