Nostradamus Prophecy Machine
    Wondering what’s next for npm?Check out our public roadmap! »

    karma-static-server

    1.0.0 • Public • Published

    karma-static-server

    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:

      "middleware": ["staticServer"],

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

      "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-*.

      "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, 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.

    Keywords

    none

    Install

    npm i karma-static-server

    DownloadsWeekly Downloads

    292

    Version

    1.0.0

    License

    Apache-2.0

    Unpacked Size

    3.5 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar