When I add imports into the commands.ts
, then I get errors by running the tests.
commands.ts
import 'cypress-localstorage-commands';
/* eslint-disable */
declare namespace Cypress {
interface Chainable<Subject = any> {
commandA();
commandB();
commandC();
}
}
Error:
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
CodePudding user response:
The solution of my import error was to add 'global' to commands.ts.
import cypress-localstorage-commands';
/* eslint-disable */
declare global{
namespace Cypress {
interface Chainable<Subject = any> {
commandA();
commandB();
commandC();
}
}
}