# karma-nightmare **Repository Path**: mirrors_bokuweb/karma-nightmare ## Basic Information - **Project Name**: karma-nightmare - **Description**: ⚡ A Karma plugin. Launcher for Nightmare - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-02-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

A Karma plugin. Launcher for Nightmare
## Table of Contents - [Installation](#installation) - [Usage](#usage) - [API](#api) - [Extend](#extend) - [Test](#test) - [Contribute](#contribute) - [License](#license) ## Installation ``` sh $ npm i -D karma-nightmare ``` ## Usage ### Karma config example ``` javascript // karma.conf.js module.exports = function(config) { config.set({ browsers: ['Nightmare'], plugins: [ 'karma-nightmare' ], // you can define custom flags nightmareOptions: { width: 800, height: 600, show: false, }, }) } ``` ### require You can use `require` as below, in your test. ``` js const fs = window.require('fs'); fs.readFileSync('./screenshot.png'); ``` ### Browser window options The options attribute allows you to initialize properties on the nightmare browser window. The available options are [documented here](https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions). *** Attention *** `nodeIntegration`, `waitTimeout`, `preload` options are fixed by `karma-nightmare`. you can not change these options. ### karma-nightmare options | name | Default | Description | | :--------------------------- | :------ | :------------------------------------------------------------------------------------------------------------------------------ | | skipScreenshot | `false` | If set `true`, `screenshot` API is ignored. | | skipCaptureHtml | false | If set `true`, `saveHtml` API is ignored. | Please, see also [karma.conf.js](https://github.com/bokuweb/karma-nightmare/blob/master/karma.conf.js) of this project, using `mocha` and `browserify`. ## API ### isNightmare(): boolean Return `true`, when test is running on nightmare. ### getCurrentWindow(): ?Electron.BrowserWindow Return current `BrowserWindow`, when test is running on nightmare. Return `null`, when running on other browser. ### screenshot(path: string): Promise\