【问题标题】:Cannot find module even though the cypress test runner is able to mount the component即使 cypress 测试运行器能够安装组件,也找不到模块
【发布时间】:2023-02-03 23:57:00
【问题描述】:

我正在尝试使用 cypressvue3vite 设置组件测试。使用入门指南,我能够成功安装我的组件,但是在我的编辑器 (vscode) 中,它告诉我找不到模块或相应的类型声明ts(2307)

我在support/component.ts 中添加了全局样式文件,仅此而已。

// Import commands.js using ES2015 syntax:
import "./commands";

// Import global styles
import "../../src/styles/style.scss";

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from "cypress/vue";

// Augment the Cypress namespace to include type definitions for
// your custom command.
// Alternatively, can be defined in cypress/support/component.d.ts
// with a <reference path="./component" /> at the top of your spec.
declare global {
  namespace Cypress {
    interface Chainable {
      mount: typeof mount;
    }
  }
}

Cypress.Commands.add("mount", mount);

如何摆脱 linter 警告?

【问题讨论】:

    标签: cypress vuejs3


    【解决方案1】:

    我现在遇到同样的问题,请问您找到解决办法了吗?

    【讨论】:

    • 请不要添加我也是作为答案。它实际上并没有提供问题的答案。如果您有不同但相关的问题,请ask它(如果它有助于提供上下文,请参考此问题)。如果你对这个具体问题感兴趣,你可以upvote它,留下comment,或者一旦你有足够的reputation就开始bounty
    猜你喜欢
    • 1970-01-01
    • 2021-02-13
    • 1970-01-01
    • 1970-01-01
    • 2020-07-10
    • 1970-01-01
    • 1970-01-01
    • 2020-01-19
    • 2016-09-20
    相关资源
    最近更新 更多