Open rhobot opened 2 years ago
That's a problem that I ran into when I tried to use webpack (v5) dev configuration.
I added buffer
package to dev dependencies, then added buffer
package in webpack config like following
plugins: [
....
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
...
],
...
node: {
global: true,
}
if you don't want to change your dev config, you can use env variables and run component tests like IS_CT=true npx cypress open-ct
nothing worked for me (running on vite.js), so I've overridden the supportFile
location path only for component tests, where I did not import cypress-plugin-snapshots/commands
Describe the bug
Once
cypress-plugin-snapshots/commands
is imported incypress/support/index.js
, running component tests (i.e.npx cypress open-ct
errors out withCannot find module 'crypto'
.Note that I'm not trying to run
cypress-plugin-snapshots
in component testing. It just happens to error out.To Reproduce Steps to reproduce the behavior:
npx cypress open-ct
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
Desktop (please complete the following information):
Additional context
I've attempted to fix the error by adding fallbacks in webpack. I eventually had to add fallbacks of
crypto
,path
, andstream
. After that it still complains thatprocess
is not defined.I also searched for disabling
cypress-plugin-snapshots
only in component testing but I couldn't find a way. The commands are always executed in both integration testing and component testing.