ReferenceError: getCurrentPages is not defined
landluck opened this issue · 1 comments
landluck commented
import path from 'path';
import simulate from 'miniprogram-simulate';
test('should render demo and match snapshot', () => {
const id = simulate.load(path.resolve(__dirname, '../demo/index'), {
rootPath: path.resolve(__dirname, '../../'),
});
const comp = simulate.render(id);
comp.attach(document.createElement('parent-wrapper'));
expect(comp.toJSON()).toMatchSnapshot();
});getCurrentPages is not defined 是不是不支持
JuneAndGreen commented
因其定位是自定义组件的单元测试,getCurrentPages 是和页面实例相关的接口,故无法提供。在测试过程中可以按需自己模拟并挂在 global 上