NervJS / taro-test-utils

多端单测工具
MIT License
9 stars 4 forks source link

@tarojs/test-utils-shared 依赖错误 #40

Open Tangjj1996 opened 3 months ago

Tangjj1996 commented 3 months ago

问题描述

@tarojs/test-utils-shared 包的 package.json

{
  "name": "@tarojs/test-utils-shared",
  "version": "0.1.1",
  "main": "dist/index.js",
  "type": "module",
  "license": "MIT",
  "scripts": {
    "dev": "tsc -w",
    "build": "tsc"
  },
  "types": "dist",
  "typings": "dist/index.d.ts",
  "publishConfig": {
    "access": "public"
  },
  "dependencies": {
    "@babel/runtime": "^7.21.5",
    "babel-jest": "^29.5.0",
    "pretty-format": "^29.5.0"
  },
  "devDependencies": {
    "@tarojs/runtime": "^3.6.0",
    "@tarojs/router": "^3.6.0",
    "@tarojs/taro": "^3.6.0",
    "@tarojs/taro-h5": "^3.6.0",
    "@babel/core": "^7.8.0"
  }
}

test-utils-shared/src/lifecycle.ts 用到了 devDependencies 的依赖

import type { AppInstance, PageInstance } from '@tarojs/runtime'
import type { PageResizeObject, PageScrollObject, ShareAppMessageObject, TabItemTapObject } from '@tarojs/taro'
import stacks from '@tarojs/router/dist/router/stack'
...

期望结果

依赖引用和声明统一,避免执行报错

  Cannot find module '@tarojs/router/dist/router/stack' from 'node_modules/@tarojs/test-utils-shared/dist/lifecycle.js'