diff --git a/packages/compiler-core/__tests__/transform.spec.ts b/packages/compiler-core/__tests__/transform.spec.ts
index b23340344..aa04c3f0d 100644
--- a/packages/compiler-core/__tests__/transform.spec.ts
+++ b/packages/compiler-core/__tests__/transform.spec.ts
@@ -7,7 +7,20 @@ import {
ExpressionNode
} from '../src/ast'
import { ErrorCodes, createCompilerError } from '../src/errors'
-import { TO_STRING, CREATE_VNODE, COMMENT } from '../src/runtimeConstants'
+import {
+ TO_STRING,
+ CREATE_VNODE,
+ COMMENT,
+ OPEN_BLOCK,
+ CREATE_BLOCK,
+ FRAGMENT,
+ RENDER_SLOT
+} from '../src/runtimeConstants'
+import { transformIf } from '../src/transforms/vIf'
+import { transformFor } from '../src/transforms/vFor'
+import { transformElement } from '../src/transforms/transformElement'
+import { transformSlotOutlet } from '../src/transforms/transfromSlotOutlet'
+import { optimizeText } from '../src/transforms/optimizeText'
describe('compiler: transform', () => {
test('context state', () => {
@@ -221,4 +234,110 @@ describe('compiler: transform', () => {
expect(ast.imports).toContain(CREATE_VNODE)
expect(ast.imports).toContain(COMMENT)
})
+
+ describe('root codegenNode', () => {
+ function transformWithCodegen(template: string) {
+ const ast = parse(template)
+ transform(ast, {
+ nodeTransforms: [
+ transformIf,
+ transformFor,
+ optimizeText,
+ transformSlotOutlet,
+ transformElement
+ ]
+ })
+ return ast
+ }
+
+ function createBlockMatcher(args: any[]) {
+ return {
+ type: NodeTypes.JS_SEQUENCE_EXPRESSION,
+ expressions: [
+ {
+ type: NodeTypes.JS_CALL_EXPRESSION,
+ callee: `_${OPEN_BLOCK}`
+ },
+ {
+ type: NodeTypes.JS_CALL_EXPRESSION,
+ callee: `_${CREATE_BLOCK}`,
+ arguments: args
+ }
+ ]
+ }
+ }
+
+ test('no chidlren', () => {
+ const ast = transformWithCodegen(``)
+ expect(ast.codegenNode).toBeUndefined()
+ })
+
+ test('single