Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

组件测试的时候,vuewrapper里面拿到的vm是空,使用的script setup写法,optionsApi写法是ok的? #560

Open
chenNoway opened this issue Mar 4, 2024 · 0 comments

Comments

@chenNoway
Copy link

依赖:

"devDependencies": {
    "@babel/preset-env": "^7.23.5",
    "@babel/register": "^7.17.7",
    "@dcloudio/types": "^3.3.2",
    "@dcloudio/uni-automator": "3.0.0-alpha-3090720231104001",
    "@dcloudio/uni-cli-shared": "3.0.0-alpha-3090720231104001",
    "@dcloudio/uni-stacktracey": "3.0.0-alpha-3090720231104001",
    "@dcloudio/vite-plugin-uni": "3.0.0-alpha-3090720231104001",
    "@rollup/plugin-node-resolve": "^13.3.0",
    "@tbmp/mp-cloud-sdk": "^1.4.2",
    "@types/crypto-js": "^4.1.1",
    "@types/html5plus": "*",
    "@types/jest": "^27.5.2",
    "@types/lodash": "^4.14.172",
    "@types/node": "^17.0.38",
    "@types/uni-app": "*",
    "@typescript-eslint/eslint-plugin": "^5.42.0",
    "@typescript-eslint/parser": "^5.38.0",
    "@vue/runtime-core": "^3.2.45",
    "@vue/test-utils": "2.4.0-alpha.2",
    "@vue/vue3-jest": "^27.0.0",
    "@zmn/eslint-plugin": "0.0.13",
    "@zmn/prettier-config": "0.0.2",
    "@zmn/treelint": "^2.0.17",
    "add": "^2.0.6",
    "babel-jest": "27",
    "cross-env": "7.0.2",
    "eslint": "^8.26.0",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-jsx-a11y": "^6.6.1",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.31.10",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-vue": "^9.7.0",
    "husky": "^8.0.3",
    "jest": "27",
    "jest-environment-jsdom": "27",
    "jest-environment-node": "^29.7.0",
    "mini-types": "*",
    "miniprogram-api-typings": "*",
    "prettier": "^2.8.8",
    "sass": "^1.52.1",
    "terser": "^5.14.1",
    "ts-jest": "27",
    "typescript": "^4.6.3",
    "vite": "4.2.0",
    "vite-plugin-html": "^3.2.0",
    "vite-plugin-html-template": "^1.1.5",
    "vite-plugin-require-transform": "^1.0.3"
  }
// jest.config.js
module.exports = {
  testEnvironment: 'jsdom',
  transform: {
    '^.+\\.ts$': 'ts-jest',
    '^.+\\.vue$': '<rootDir>/node_modules/@vue/vue3-jest',
    '^.+.(js|jsx|ts|tsx)$': 'babel-jest',
  },
  testTimeout: 10000,
  moduleFileExtensions: ['ts', 'js', 'json', 'vue'],
  moduleNameMapper: {
    '^@/(.*)$': '<rootDir>/src/$1',
  },
  preset: 'ts-jest',
  rootDir: __dirname,
  testMatch: ['<rootDir>/test/**/*test.[jt]s?(x)'],
  globals: {
    __ZMN_BUILD_ENV__: 'test',
  },
  // "collectCoverage": true,
  // "collectCoverageFrom": [
  //   "src/**/*.{js,vue}"
  // ],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant