Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
jest-electron
Advanced tools
Readme
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
.
Jest
.browser environment
.Multi-renderer
for running performance.Running and debug
is better then mock.$ npm i --save-dev jest-electron
{
"jest": {
+ "runner": "jest-electron/runner",
+ "testEnvironment": "jest-electron/environment"
}
}
Notice: update the runner
configure, not testRunner
.
Those will be helpful when run test case with
jest-electron
.
less
, css
code.svg
, png
, jpg
or other url file..Run test cases with
jest-electron
for continuous integration.
Running on macOS
will be ok.
- runs-on: ubuntu-latest
+ runs-on: macOS-latest
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
Keep the electron browser window for debugging, set process env DEBUG_MODE=1
.
DEBUG_MODE=1 jest
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
MIT@hustcc.
FAQs
Easiest way to run jest unit test cases in electron.
The npm package jest-electron receives a total of 733 weekly downloads. As such, jest-electron popularity was classified as not popular.
We found that jest-electron demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.