( src: string, options?: Partial<SFCScriptCompileOptions>, parseOptions?: SFCParseOptions, )
| 10 | export const mockId = 'xxxxxxxx' |
| 11 | |
| 12 | export function compileSFCScript( |
| 13 | src: string, |
| 14 | options?: Partial<SFCScriptCompileOptions>, |
| 15 | parseOptions?: SFCParseOptions, |
| 16 | ): SFCScriptBlock { |
| 17 | const { descriptor, errors } = parse(src, parseOptions) |
| 18 | if (errors.length) { |
| 19 | console.warn(errors[0]) |
| 20 | } |
| 21 | return compileScript(descriptor, { |
| 22 | ...options, |
| 23 | id: mockId, |
| 24 | }) |
| 25 | } |
| 26 | |
| 27 | export function assertCode(code: string): void { |
| 28 | // parse the generated code to make sure it is valid |
no test coverage detected