All Projects → hustcc → Jest Electron

hustcc / Jest Electron

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

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Jest Electron

Vue Mooc
🔰使用Vue3.0全家桶+TS+Jest重构慕课网PC端
Stars: ✭ 97 (-8.49%)
Mutual labels:  jest
Scala Debugger
Scala libraries and tooling utilizing the Java Debugger Interface.
Stars: ✭ 100 (-5.66%)
Mutual labels:  debugger
React Bootstrap Webpack Starter
ReactJS 16.4 + new React Context API +react Router 4 + webpack 4 + babel 7+ hot Reload + Bootstrap 4 + styled-components
Stars: ✭ 103 (-2.83%)
Mutual labels:  jest
Jest Glamor React
Jest utilities for Glamor and React
Stars: ✭ 97 (-8.49%)
Mutual labels:  jest
Democracy Client
DEMOCRACY App Client
Stars: ✭ 98 (-7.55%)
Mutual labels:  jest
Birdseye
Graphical Python debugger which lets you easily view the values of all evaluated expressions
Stars: ✭ 1,373 (+1195.28%)
Mutual labels:  debugger
Write A Strace And Gdb
A tiny system call tracer and debugger implementation
Stars: ✭ 93 (-12.26%)
Mutual labels:  debugger
Rider Content
A curated list of content around JetBrains Rider
Stars: ✭ 104 (-1.89%)
Mutual labels:  debugger
Xntsv
XNTSV program for detailed viewing of system structures for Windows.
Stars: ✭ 100 (-5.66%)
Mutual labels:  debugger
Consolemock
A tool for testing console logs
Stars: ✭ 103 (-2.83%)
Mutual labels:  jest
Simple React Calendar
A simple react based calendar component to be used for selecting dates and date ranges
Stars: ✭ 97 (-8.49%)
Mutual labels:  jest
Newschool Backend
Plataforma de ensino para pessoas carentes
Stars: ✭ 98 (-7.55%)
Mutual labels:  jest
Ipdb
Integration of IPython pdb
Stars: ✭ 1,373 (+1195.28%)
Mutual labels:  debugger
Npm Registry Browser
Browse the npm registry with an SPA made in React, with full dev workflow.
Stars: ✭ 97 (-8.49%)
Mutual labels:  jest
Ts React Boilerplate
Universal React App with Redux 4, Typescript 3, and Webpack 4
Stars: ✭ 104 (-1.89%)
Mutual labels:  jest
Pdbr
pdb + Rich library
Stars: ✭ 96 (-9.43%)
Mutual labels:  debugger
React Native Cross Platform Starter
One codebase to build for iOS, Android, Web and Desktop with React-Native
Stars: ✭ 101 (-4.72%)
Mutual labels:  jest
Nfdx64dbg
Plugin for x64dbg Linker/Compiler/Tool detector.
Stars: ✭ 105 (-0.94%)
Mutual labels:  debugger
Node Flowtype Boilerplate
This boilerplate repository is outdated and no longer maintained. Instead, I strongly recommend to use TypeScript.
Stars: ✭ 104 (-1.89%)
Mutual labels:  jest
Esbuild Jest
A Jest transformer using esbuild
Stars: ✭ 100 (-5.66%)
Mutual labels:  jest

jest-electron

Easiest way to run jest unit test cases in electron.

When we run unit test in Jest, it is actually running in the node environment, or virtual browser environment(e.g. JSDOM) mocked by NodeJS. Sometimes we need a lot of Jest mocks for running code with no throw, such as: jest-canvas-mock, jest-storage-mock, @jest/fake-timers and so on. This is solved by Jest-Electron.

Build Status npm npm

  1. Technological ecology of Jest.
  2. Complete and real browser environment.
  3. Multi-renderer for running performance.
  4. Running and debug is better then mock.

Installation

  • Add into devDependencies
$ npm i --save-dev jest-electron
  • Update Jest config
{
  "jest": {
+    "runner": "jest-electron/runner",
+    "testEnvironment": "jest-electron/environment"
  }
}

Notice: update the runner configure, not testRunner.

Related

Those will be helpful when run test case with jest-electron.

CI

Run test cases with jest-electron for continuous integration.

  • GitHub action

Running on macOS will be ok.

- runs-on: ubuntu-latest
+ runs-on: macOS-latest
  • travis

Update .travis.yml with electron supported.

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

Depending on your executor, you might need to disable sandbox and shared memory usage:

export JEST_ELECTRON_STARTUP_ARGS='--disable-dev-shm-usage --no-sandbox'
npm run test

Env

  • debug mode

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

DEBUG_MODE=1 jest
  • additional startup arguments

Run electron with arbitrary arguments.

JEST_ELECTRON_STARTUP_ARGS='--disable-dev-shm-usage'

Run electron with --no-sandbox, set process env JEST_ELECTRON_STARTUP_ARGS='--no-sandbox'.

JEST_ELECTRON_STARTUP_ARGS='--no-sandbox' jest

License

[email protected]hustcc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].