Skip to content

⚛️ The easiest way to run and debug test cases in electron with jest.

License

Notifications You must be signed in to change notification settings

ForkRepo/jest-electron

 
 

Repository files navigation

jest-electron

Easiest way to run jest unit test cases in electron.

Build Status npm npm

Usage

  • Install
npm i --save-dev jest-electron
  • Add to Jest config

In your package.json

{
  "jest": {
+    "runner": "jest-electron/runner",
+    "testEnvironment": "jest-electron/environment"
  }
}

Notice: update the runner configure, not testRunner.

  • Update .travis.yml
language: node_js
node_js:
  - "8"
  - "9"
  - "10"
  - "11"
  - "12"
+ addons:
+   apt:
+     packages:
+       - xvfb
+ install:
+   - export DISPLAY=':99.0'
+   - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
+   - npm install
script:
  - npm run test

Debugger mode

Keep the electron browser window for debugging. set env DEBUG_MODE=1.

DEBUG_MODE=1 jest

License

MIT@hustcc.

About

⚛️ The easiest way to run and debug test cases in electron with jest.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.7%
  • Other 1.3%