diff --git a/packages/compiler-sfc/__tests__/parse.spec.ts b/packages/compiler-sfc/__tests__/parse.spec.ts index 1378e64a..d81ce60c 100644 --- a/packages/compiler-sfc/__tests__/parse.spec.ts +++ b/packages/compiler-sfc/__tests__/parse.spec.ts @@ -1,11 +1,8 @@ import { parse } from '../src' -import { mockWarn } from '@vue/shared' import { baseParse, baseCompile } from '@vue/compiler-core' import { SourceMapConsumer } from 'source-map' describe('compiler:sfc', () => { - mockWarn() - describe('source map', () => { test('style block', () => { // Padding determines how many blank lines will there be before the style block @@ -143,36 +140,40 @@ h1 { color: red } }) describe('warnings', () => { + function assertWarning(errors: Error[], msg: string) { + expect(errors.some(e => e.message.match(msg))).toBe(true) + } + test('should only allow single template element', () => { - parse(``) - expect( + assertWarning( + parse(``).errors, `Single file component can contain only one