How to use miniprogram-simulate - 4 common examples

To help you get started, we’ve selected a few miniprogram-simulate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wechat-miniprogram / miniprogram-custom-component / test / utils.js View on Github external
const path = require('path')
const simulate = require('miniprogram-simulate')

const config = require('../tools/config')

const srcPath = config.srcPath
const oldLoad = simulate.load
simulate.load = function (componentPath, ...args) {
  if (typeof componentPath === 'string') componentPath = path.join(srcPath, componentPath)
  return oldLoad(componentPath, ...args)
}

module.exports = simulate

// adjust the simulated wx api 
const oldGetSystemInfoSync = global.wx.getSystemInfoSync
global.wx.getSystemInfoSync = function() {
  const res = oldGetSystemInfoSync()
  res.SDKVersion = '2.4.1'

  return res
}
github wechat-miniprogram / computed / test / utils.js View on Github external
const path = require('path')
const simulate = require('miniprogram-simulate')

const config = require('../tools/config')

const srcPath = config.srcPath
const oldLoad = simulate.load
simulate.load = function (componentPath, ...args) {
  if (typeof componentPath === 'string') componentPath = path.join(srcPath, componentPath)
  return oldLoad(componentPath, ...args)
}

module.exports = simulate

// adjust the simulated wx api
const oldGetSystemInfoSync = global.wx.getSystemInfoSync
global.wx.getSystemInfoSync = function () {
  const res = oldGetSystemInfoSync()
  res.SDKVersion = '2.4.1'

  return res
}
github wechat-miniprogram / computed / test / utils.js View on Github external
const path = require('path')
const simulate = require('miniprogram-simulate')

const config = require('../tools/config')

const srcPath = config.srcPath
const oldLoad = simulate.load
simulate.load = function (componentPath, ...args) {
  if (typeof componentPath === 'string') componentPath = path.join(srcPath, componentPath)
  return oldLoad(componentPath, ...args)
}

module.exports = simulate

// adjust the simulated wx api
const oldGetSystemInfoSync = global.wx.getSystemInfoSync
global.wx.getSystemInfoSync = function () {
  const res = oldGetSystemInfoSync()
  res.SDKVersion = '2.4.1'

  return res
}
github wechat-miniprogram / miniprogram-custom-component / test / utils.js View on Github external
const path = require('path')
const simulate = require('miniprogram-simulate')

const config = require('../tools/config')

const srcPath = config.srcPath
const oldLoad = simulate.load
simulate.load = function (componentPath, ...args) {
  if (typeof componentPath === 'string') componentPath = path.join(srcPath, componentPath)
  return oldLoad(componentPath, ...args)
}

module.exports = simulate

// adjust the simulated wx api 
const oldGetSystemInfoSync = global.wx.getSystemInfoSync
global.wx.getSystemInfoSync = function() {
  const res = oldGetSystemInfoSync()
  res.SDKVersion = '2.4.1'

  return res
}

miniprogram-simulate

tools for miniprogram custom component unit test

MIT
Latest version published 1 year ago

Package Health Score

49 / 100
Full package analysis

Popular miniprogram-simulate functions