0.1.4 • Published 8 years ago

karma-express-server v0.1.4

Weekly downloads
82
License
MIT
Repository
github
Last release
8 years ago

karmaExpressServer

Summary

Runs a customizable expressjs application for karma tests.

Usage

Install

npm install --save-dev karma-express-server

Configure

Add framework and expressServer configuration to karma config:

module.exports = function(config) {
  config.set({

    // ...

    frameworks: [
      // ...
      'expressServer'
    ],

    // ...

    expressServer: {

      port: 9877, // different than karma's port

      // custom extensions go here
      extensions: [
        // for example:
        function(
          app, // express app
          logger // karma logger
        ) {
          app.get('/heartbeat', (req, res) => {
            res.sendStatus(200);
          });
        }
      ]

    }

  });
};

SSL

Self-signed certificates can be generated with nodejs-self-signed-certificate-example.

// ...

expressServer: {

  // ...

  protocol: 'https',
  httpsServerOptions: {
    key: fs.readFileSync('path/to/my-server.key.pem'),
    cert: fs.readFileSync('path/to/my-server.crt.pem')
  }

}

// ...

More Configuration

All Config properties are documented in the API Documentation.

Contribution

See Contribution documentation for build, test and publish details.