Skip to content

Commit ad97bba

Browse files
committed
wip: invert compiler compat behavior default during tests
1 parent bbf708d commit ad97bba

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

packages/compiler-core/src/compat/compatConfig.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ export function checkCompatEnabled(
102102
loc: SourceLocation | null,
103103
...args: any[]
104104
): boolean {
105-
const enabled = getCompatValue(key, context) !== false
105+
const value = getCompatValue(key, context)
106+
// during tests, only enable when value is explicitly true
107+
const enabled = __TEST__ ? value === true : value !== false
106108
if (__DEV__ && enabled) {
107109
warnDeprecation(key, context, loc, ...args)
108110
}

packages/compiler-core/src/errors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export function defaultOnError(error: CompilerError) {
1313
throw error
1414
}
1515

16-
export function defaultOnWarn(msg: string | CompilerError) {
17-
__DEV__ &&
18-
console.warn(`[Vue warn]`, typeof msg === 'string' ? msg : msg.message)
16+
export function defaultOnWarn(msg: CompilerError) {
17+
throw new Error('foo')
18+
__DEV__ && console.warn(`[Vue warn]`, msg.message)
1919
}
2020

2121
export function createCompilerError<T extends number>(

0 commit comments

Comments
 (0)