Recently, I've been conducting unit tests on my Chrome extension using Mocha, Chai, and Sinon. However, I encountered an issue when attempting to stub an object from a method:
EvalError: 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' blob: filesystem: chrome-extension-resource:".
at createProxy (js/lib/sinon.js:2488:86)
at Function.create (js/lib/sinon.js:2549:29)
at Function.create (js/lib/sinon.js:3337:42)
at Object.stub (js/lib/sinon.js:3289:32)
at Context.<anonymous> (js/spec/sf-companion.spec.js:44:19)
at Test.Runnable.run (js/lib/mocha.js:4529:15)
at Runner.runTest (js/lib/mocha.js:4974:10)
at js/lib/mocha.js:5057:12
at next (js/lib/mocha.js:4899:14)
at js/lib/mocha.js:4909:7
test-runner.html
:
If anyone has any insights or guidance on how to resolve this issue, I would greatly appreciate it. Thank you in advance.