【发布时间】:2023-02-03 23:57:00
【问题描述】:
我正在尝试使用 cypress、vue3 和 vite 设置组件测试。使用入门指南,我能够成功安装我的组件,但是在我的编辑器 (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 警告?
【问题讨论】: