Run jest tests with [electron
Canvas [object HTMLCanvasElement] is unable to provide a 2D context.+ "runner": "jest-electron/runner",
+ "testEnvironment": "jest-electron/environment",
- "testEnvironment": "jest-environment-jsdom-fourteen"
$ DEBUG_MODE=1 npm test$ npm test$ npm install --save jest-electron
need eject before config
Out of the box, Create React App only supports overriding these Jest options: These options in your package.json Jest configuration are not currently supported by Create React App: - • verbose - • runner - • testEnvironment If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.
$ npx create-react-app --typescript test-jest-electron$ cd test-jest-electron/$ npm run ejectconfig
+ "runner": "jest-electron/runner",
+ "testEnvironment": "jest-electron/environment",
- "testEnvironment": "jest-environment-jsdom-fourteen"
:
console.error node_modules/jest-environment-jsdom-fourteen/node_modules/jsdom/lib/jsdom/virtual-console.js:29
Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
Keep the electron browser window for debugging, set process env DEBUG_MODE=1.
$ DEBUG_MODE=1 npm testThis page is auto-translated from /nishio/jest-electron using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.