diff --git a/packages/runtime-core/__tests__/debug.spec.ts b/packages/runtime-core/__tests__/debug.spec.ts new file mode 100644 index 00000000000..f378b70c36d --- /dev/null +++ b/packages/runtime-core/__tests__/debug.spec.ts @@ -0,0 +1,34 @@ +import {debug} from '../src/debug' +import { + h, + render, + defineComponent, + ref, getCurrentInstance, ComponentInternalInstance, nodeOps, + serializeInner as inner +} from '@vue/runtime-test' + +describe('debug', () => { + test('watching states', () => { + const root = nodeOps.createElement('div') + let instance: ComponentInternalInstance + const Comp = defineComponent({ + setup() { + const name = ref('foo') + debug({ + name, + }) + return () => ( + h('div', name.value) + ) + }, + mounted() { + instance = getCurrentInstance()! + }, + }) + render(h(Comp), root) + expect(inner(root)).toBe('