1.1.3 • Published 7 years ago

mockingjay-npm-wrapper v1.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

mockingjay-npm-wrapper

Wraps the mockingjay server to npm - so you don't have to deal with the binaries manually. Original project: https://github.com/quii/mockingjay-server Supported platforms:

  • darvin (Mac)
  • linux

Installation

Mockingjay-npm-wrapper requires Node.js v6+ to run. Add mockingjay-npm-wrapper to your project:

$ npm install --save-dev mockingjay-npm-wrapper

How to use

Lets see a protractor example:

const mockingServer = require('mockingjay-npm-wrapper');

  describe('scenario - hello', function () {
    beforeAll(mockingServer.serve('stubs/scenario-hello.yml')); 
    afterAll(mockingServer.kill());

    it('should receive the message', function () {
      browser.get('http://localhost:8080');
      var result = element(by.id('result'));
      expect(result.getText()).toEqual('hello');
    });
  });

The wrapper api is designed to work well with beforeEach, beforeALL, afterEach, afterAll. If you want to use the server outside of those functions, you have to call the callback function manually:

const mockingServer = require('mockingjay-npm-wrapper'); 

const servCallback = mockingServer.serve('stubs/scenario-hello.yml'); 
const killCallback = mockingServer.kill();

// Mocking server is not available here
serveCallback();
// mocking server is running here
// ...
// mocking server is running here
killCallback();
// Mocking server is not available here

Running the mocking server on a different port (default port is 8000):

const mockingServer = require('mockingjay-npm-wrapper'); 

mockingServer.serve('stubs/scenario-hello.yml', 9000)(); 
1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago