gpt4 book ai didi

typescript - Cypress:commands.ts 下的导入行会导致错误

转载 作者:行者123 更新时间:2023-12-05 04:34:51 27 4
gpt4 key购买 nike

当我将导入添加到 commands.ts 时,然后我通过运行测试得到错误。

命令.ts

import 'cypress-localstorage-commands';

/* eslint-disable */
declare namespace Cypress {
interface Chainable<Subject = any> {
commandA();
commandB();
commandC();
}
}

错误:

Module not found: Error: Can't resolve 'cypress-localstorage-commands'in 'C:...\cypress\support\commands\commands' resolve'cypress-localstorage-commands' in 'C:...\cypress\support\commands'
Parsed request is a module using description file:C:...\angular\package.json (relative path:./cypress/support/commands)Field 'browser' doesn't contain a valid alias configuration

最佳答案

我的导入错误的解决方案是将“global”添加到commands.ts。

import cypress-localstorage-commands';
/* eslint-disable */
declare global{
namespace Cypress {
interface Chainable<Subject = any> {
commandA();
commandB();
commandC();
}
}
}

关于typescript - Cypress:commands.ts 下的导入行会导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71160405/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com