I want to use node-imap or the imap package from NPM in Cypress to check whether certain E-mails are received and to check their contents.
When I try a basic copy from the example taken from the imap github and docs it fails with the following error:
./node_modules/imap/lib/Connection.js
Module not found: Error: Can't resolve 'net' in '/Users/username/Documents/test-e2e/node_modules/imap/lib'
resolve 'net' in '/Users/username/Documents/test-e2e/node_modules/imap/lib'
Parsed request is a module
using description file: /Users/username/Documents/test-e2e/node_modules/imap/package.json (relative path: ./lib)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/Users/username/Documents/test-e2e/node_modules/imap/lib/node_modules doesn't exist or is not a directory
/Users/username/Documents/test-e2e/node_modules/node_modules doesn't exist or is not a directory
/Users/username/Documents/node_modules doesn't exist or is not a directory
/Users/username/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/username/Documents/test-e2e/node_modules/imap/node_modules
using description file: /Users/username/Documents/test-e2e/node_modules/imap/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
looking for modules in /Users/username/Documents/test-e2e/node_modules
using description file: /Users/username/Documents/test-e2e/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/username/Documents/test-e2e/node_modules/imap/package.json (relative path: ./node_modules/net)
no extension
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/username/Documents/test-e2e/package.json (relative path: ./node_modules/net)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/username/Documents/test-e2e/node_modules/imap/node_modules/net doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/Users/username/Documents/test-e2e/node_modules/net doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/Users/username/Documents/test-e2e/node_modules/imap/node_modules/net.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/username/Documents/test-e2e/node_modules/net.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/username/Documents/test-e2e/node_modules/imap/node_modules/net.js doesn't exist
/Users/username/Documents/test-e2e/node_modules/net.js doesn't exist
as directory
/Users/username/Documents/test-e2e/node_modules/imap/node_modules/net doesn't exist
as directory
/Users/username/Documents/test-e2e/node_modules/net doesn't exist
No tests can run because of this. I tried looking for this 'net', also in combination with the imap package, but I can't really find any solution for this. Is it even possible to use Imap with Cypress?