You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('Sample test',()=>{cy.task('readSettingsJson',settingsFolder).then((content)=>{// This can print the JSON file contents correctlyconsole.log('content = '+content)})})
And on my plugins/index.js:
on('task',{readSettingsJson(foldername){if(!fs.existsSync(foldername)){fs.mkdirSync(foldername,{recursive: true})// some command to copy the file}else{// This is what I am testing at this momentreturnfs.readFileSync(path.join(filename,'/settings.json'),'utf8')}returnnull}})
However, it doesnt seem to work. I still get the error:
Error in mounted hook: "TypeError: fs.existsSync is not a function"
And despite the test printing (console.log in the test) the json file correctly, my app still can't load the JSON file.
Am I missing anything? Help please! Thank you!
Cypress Version: 4.3.0 Browser: Electron
The text was updated successfully, but these errors were encountered:
This seems isolated to your running and testing within Electron app (or some other variable in your project) - as this is not reproducible with the code provided. Some comments in Electron mention changing the require statements maybe helping. electron/electron#7300 (comment)
Closing as we don't support testing Electron apps out of the box.
I am using Cypress to test my Electron application.
Since Cypress uses the browser mode,
FS
is not supported.So I am getting this error:
I know Electron is not yet fully supported, but specifically for my need to use
fs
, I found this on the documentation:So I added this on my test:
And on my
plugins/index.js
:However, it doesnt seem to work. I still get the error:
And despite the test printing (console.log in the test) the json file correctly, my app still can't load the JSON file.
Am I missing anything? Help please! Thank you!
Cypress Version: 4.3.0
Browser: Electron
The text was updated successfully, but these errors were encountered: