Problems with Vue Unit Test testing filters

recently, when writing a unit test for a component, the test filter found a small problem. I"ve seen the source code of vue, and I"ve found that vue is an expression that compiles a node into _ f () {} if it encounters a filter during compilation. Then use resolveAsset to get the same filter in vm.$options "s filters.


describe("filters", () => {
  const Cotr = Vue.extend(Hello)
  const vm = new Cotr().$mount()

  it("filter ", () => {
   vm.$nextTick(_ => {
      const upperText = vm.filters.upperCase("lisi")
      expect(upperText).to.equal("LISI")
    })
  })
})

is not mounted on the DOM, but why is it not mounted on the vm instance either? But if you change it to setTimeout, there will be? I hope you can help me answer this question. Thank you

.
Mar.12,2022
Menu