Watch 1 Star 1 Fork 0

小为 / jest-electronTypeScript

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
:electric_plug: The easiest way to run and debug test cases in electron with jest. spread retract

Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

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 INTERACTIVE=1.

INTERACTIVE=1 jest

License

MIT@hustcc.

Comments ( 0 )

Sign in for post a comment

TypeScript
1
https://gitee.com/hustcc/jest-electron.git
git@gitee.com:hustcc/jest-electron.git
hustcc
jest-electron
jest-electron
master

Help Search