# karma-static-server

> Allow karma to also act as a static server.

Latest version **2.0.0** (published 2021-12-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install karma-static-server
pnpm add karma-static-server
yarn add karma-static-server
bun add karma-static-server
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-12-14 |
| First published | 2018-08-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Brandon Casey |
| Maintainers | brandonocasey |

## Links

- npm: https://www.npmjs.com/package/karma-static-server
- Repository: https://github.com/brandonocasey/karma-static-server
- Issues: https://github.com/brandonocasey/karma-static-server/issues
- npm.io page: https://npm.io/package/karma-static-server

## Dependencies (1)

- [serve-static](https://npm.io/package/serve-static.md) ^1.14.1

## Recent versions

- 2.0.0 (latest) — 2021-12-14
- 3.0.0-4 (next) — 2025-05-15
- 3.0.0-3 — 2024-07-02
- 3.0.0-2 — 2024-06-19
- 3.0.0-1 — 2024-06-11
- 3.0.0-0 — 2024-02-22
- 1.0.0 — 2018-08-17

## README

# karma-static-server

[![Greenkeeper badge](https://badges.greenkeeper.io/BrandonOCasey/karma-static-server.svg)](https://greenkeeper.io/)

Use karma as a static server as well as a test runner!

## Installation

```
$ npm install --save-dev karma-static-server
```

Then edit your karma.conf.js so that `staticServer` is in middleware:

```js
  "middleware": ["staticServer"],
```

You will also want to change the karma `urlRoot` so that karma does not take over the root path, IE: `/`.

```js
  "urlRoot": "/test/",
```

Now karma will run test on `/test`.

You may also need to include it in plugins, if you are manually specifying them. By default karma will include all packages that match
`karma-*`.

```js
  "plugins": ["karma-*"],
  // or
  "plugins": [
    ...
    "karma-static-server"
    ...
  ],
```

Now when you run karma you will also get a static server for the `basePath` you have set in your karma config. To configure that see below.

## Options
Most options are passed directly to [`serve-static`](https://www.npmjs.com/package/serve-static), other than those listed.

### root

> Type: `string`
> Default: karma basePath

Where to serve files out of

### log

> Type: `boolean`
> Default: false during singleRun, false otherwise

Use the karma log to log static responses, and log that we are seving static files.

---
_Source: https://npm.io/package/karma-static-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
