I am facing some problem with cypress and typescript on a project. When I try to setup cypress with typescript in a new project things go well. When I do the exact same things in an another big project I have an error when I run cypress run the cypress browser open, then when I click on a test a browser open and crash with this stack trace on my terminal.
We stopped running your tests because a plugin crashed.
Your pluginsFile threw an error from: /home/xxxxx/Desktop/workspace/trouve-ui-13/src/web_app/cypress/plugins/index.ts
TypeError: SizeOnlySource is not a constructor
at updateFileWithReplacementSource (/home/xxxxx/Desktop/workspace/trouve-ui-13/src/web_app/node_modules/webpack/lib/Compiler.js:740:37)
at updateWithReplacementSource (/home/xxxxx/Desktop/workspace/trouve-ui-13/src/web_app/node_modules/webpack/lib/Compiler.js:722:8)
at processExistingFile (/home/xxxxx/Desktop/workspace/trouve-ui-13/src/web_app/node_modules/webpack/lib/Compiler.js:756:8)
at /home/xxxxx/Desktop/workspace/trouve-ui-13/src/web_app/node_modules/webpack/lib/Compiler.js:825:10
at callback (/home/xxxxx/Desktop/workspace/trouve-ui-13/src/web_app/node_modules/graceful-fs/polyfills.js:299:20)
at callback (/home/xxxxx/.cache/Cypress/9.5.3/Cypress/resources/app/node_modules/graceful-fs/polyfills.js:299:20)
at FSReqCallback.oncomplete (node:fs:199:5)
I don't have any plugin and here is the content of plugins/index.ts
export default (on, config) => {
return config;
};
Anyone help would be appreciated ?
I tried removing node_modules
and yarn.lock
and reinstalling it.
I expected the tests to run
CodePudding user response:
Try use:
module.exports = (on, config) => {
return config;
};
instead of export default, this should work, if not please let me know
Best regards, Caíque Coelho
CodePudding user response:
As pointed in the comment below, I had two versions of webpack-sources
coming from different dependencies. Specifying "webpack-sources": "^3.2.0"
in my devDependencies solved my problem