MCPcopy
hub / github.com/vuejs/core / assertAwaitDetection

Function assertAwaitDetection

packages/compiler-sfc/__tests__/compileScript.spec.ts:879–887  ·  view source on GitHub ↗
(code: string, shouldAsync = true)

Source from the content-addressed store, hash-verified

877
878 describe('async/await detection', () => {
879 function assertAwaitDetection(code: string, shouldAsync = true) {
880 const { content } = compile(`<script setup>${code}</script>`)
881 if (shouldAsync) {
882 expect(content).toMatch(`let __temp, __restore`)
883 }
884 expect(content).toMatch(`${shouldAsync ? `async ` : ``}setup(`)
885 assertCode(content)
886 return content
887 }
888
889 test('expression statement', () => {
890 assertAwaitDetection(`await foo`)

Callers 1

Calls 2

assertCodeFunction · 0.90
compileFunction · 0.70

Tested by

no test coverage detected