component-driven / component-driven/cypress-axe
"cypress-axe": "^0.14.0" Blocked by Cors 'unsafe-eval'
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 641
- Forks
- 90
- Avg merge
- 6h 8m
- Merged PRs (30d)
- 1
Description
Packages:
"cypress": "^9.7.0",
"axe-core": "^4.4.2",
"cypress-axe": "^0.14.0",
Error:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'
Code Triggering Error:
node_modules/cypress-axe/dist/index.js
exports.injectAxe = function () {
var fileName = typeof (require === null || require === void 0 ? void 0 : require.resolve) === 'function'
? require.resolve('axe-core/axe.min.js')
: 'node_modules/axe-core/axe.min.js';
cy.readFile(fileName).then(function (source) {
return cy.window({ log: false }).then(function (window) {
window.eval(source); // Triggers Cors error.
});
});
};
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with node_modules/cypress-axe/dist/index.js and its injectAxe entry point, using the listed Cypress, axe-core, and cypress-axe versions to reproduce the Content Security Policy error. Trace how axe-core is loaded through cy.readFile and cy.window, then verify that accessibility checks still run without triggering the unsafe-eval violation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cypress, typescript
- Domain
- accessibility, security, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100