]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: invert compiler compat behavior default during tests
authorEvan You <yyx990803@gmail.com>
Fri, 16 Apr 2021 16:26:17 +0000 (12:26 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 16 Apr 2021 16:26:17 +0000 (12:26 -0400)
packages/compiler-core/src/compat/compatConfig.ts
packages/compiler-core/src/errors.ts

index f5acca1b62011e06b85330d66e812bd4af99e124..91acbbd874124d79dbd6f8a56c281cb797d685fe 100644 (file)
@@ -102,7 +102,9 @@ export function checkCompatEnabled(
   loc: SourceLocation | null,
   ...args: any[]
 ): boolean {
-  const enabled = getCompatValue(key, context) !== false
+  const value = getCompatValue(key, context)
+  // during tests, only enable when value is explicitly true
+  const enabled = __TEST__ ? value === true : value !== false
   if (__DEV__ && enabled) {
     warnDeprecation(key, context, loc, ...args)
   }
index d1f1e0a8c633cf98768c9f17058f5a84f143846d..ae9da226a1be816328111dc93ef1eed8735f789f 100644 (file)
@@ -13,9 +13,9 @@ export function defaultOnError(error: CompilerError) {
   throw error
 }
 
-export function defaultOnWarn(msg: string | CompilerError) {
-  __DEV__ &&
-    console.warn(`[Vue warn]`, typeof msg === 'string' ? msg : msg.message)
+export function defaultOnWarn(msg: CompilerError) {
+  throw new Error('foo')
+  __DEV__ && console.warn(`[Vue warn]`, msg.message)
 }
 
 export function createCompilerError<T extends number>(