Cypress - Plugins and Ecosystem
You want to implement a plugin task that reads a JSON file asynchronously and returns its parsed content. Which code snippet correctly achieves this?
const fs = require('fs').promises;
module.exports = (on) => {
on('task', {
readJson(path) {
return fs.readFile(path, 'utf8').then(JSON.parse);
}
});
}; correctly returns a promise resolving to parsed JSON.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions