Giter VIP home page Giter VIP logo

pact-mock-service-npm's Introduction

Pact Mock Service for NPM

Build Status

Installation wrapper for standalone platform-specific executables packaged from the Ruby [pact-mock-service-gem] gem.

On install, this package selects and installs the correct pact-mock-service-standalone executable for your environment.

This node module downloads the appropriate platform-specific and installs it alongside pact-mock-service inside the node_modules directory.

Usage

$ npm i @pact-foundation/pact-mock-service
$ node_modules/.bin/pact-mock-service --port 1234

pact-mock-service-npm's People

Contributors

bethesque avatar mboudreau avatar mefellows avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pact-mock-service-npm's Issues

Mac standalone giving issues when a different version of ruby is installed

I wasn't able to reproduce it myself, but it's something that came up when another user tried to use grunt-pact to run it, but hit an issue when trying to run the standalone package on OSX when he had Ruby 2.2.4 installed:

/Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:478:in `ruby': Your Ruby version is 2.1.5, but your Gemfile requires 2.2.4 (Gem::RubyVersionMismatch)
    from /Users/admin/development/travi.org-admin/Gemfile:2:in `load'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:193:in `instance_eval'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set/gem_dependency_api.rb:193:in `load'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems/request_set.rb:232:in `load_gemdeps'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems.rb:1031:in `use_gemdeps'
    from /Users/admin/development/travi.org-admin/node_modules/@pact-foundation/pact-node/node_modules/pact-mock-service-darwin/lib/ruby/lib/ruby/2.1.0/rubygems.rb:1216:in `<top (required)>'
    from <internal:gem_prelude>:1:in `require'
    from <internal:gem_prelude>:1:in `<compiled>'

I thought this was the hole point of having the standalone in the first place? I'll have to test this out further and see if the same issues occur on linux/windows, then see if we can mitigate it when creating the standalone package.

Post install script fail when using private npm proxy which require authenication

Somehow the .npmrc setting is not honored in the post install script which install the platform specific pact-mock-service package. It automatically fail back to the npm global configuration which does not have the authentication details and therefore failing to download the package from private npm registry.

The workaround is to run npm install with --userconfig .npmrc which force the post install script to use the provided .npmrc file.

I am not sure if it's intended behaviour of npm API or not, but if it can be resolved at the install / post install script level (or even in the library / code itself), it would be wonderful.

permission denied: lib/ruby/(bin|bin.real)/ruby is not executable

I've tested this with @pact-foundation/pact-mock-service-darwin 2.0.2 and 2.1.0

The files in lib/ruby/bin and lib/ruby/bin.real are not executable:

-rw-r--r--  1 rwaldon  staff   163 14 Jul  2015 bundle
-rw-r--r--  1 rwaldon  staff   164 14 Jul  2015 bundler
-rw-r--r--  1 rwaldon  staff   160 14 Jul  2015 gem
-rw-r--r--  1 rwaldon  staff   160 14 Jul  2015 irb
-rw-r--r--  1 rwaldon  staff   161 14 Jul  2015 rake
-rw-r--r--  1 rwaldon  staff   139 14 Jul  2015 ruby
-rw-r--r--  1 rwaldon  staff  1149 14 Jul  2015 ruby_environment

So when I execute pact-mock-service, I get the following error:

$ ./node_modules/.bin/pact-mock-service
$REDACTED/node_modules/@pact-foundation/pact-mock-service/node_modules/@pact-foundation/pact-mock-service-darwin/lib/ruby/bin/ruby: line 6: $REDACTED/node_modules/@pact-foundation/pact-mock-service/node_modules/@pact-foundation/pact-mock-service-darwin/lib/ruby/bin.real/ruby: Permission denied

Does not work on alpine linux

Alpine is becoming a bit of a defacto docker environment, it would be nice if I could use it for running my tests in containers (another emerging trend)

First issue:
The pact-mock-service script requires bash, however alpine only has /bin/sh

Second issue:
the ruby binary installed by npm does not appear to function in alpine linux, no idea why

Cannot stop the mock service on windows

When starting up the service (on windows) with pact-mock-service -p 1234, I cannot stop it with pact-mock-service stop -p 1234.

I get the following error message:
ERROR: "pact-mock-service.rb service" was called with arguments ["stop"]
Usage: "pact-mock-service.rb service"

I tried removing the default --pact-dir tmp\pacts argument in the pact-mock-service.bat file. I then got this error:

No PID file found at tmp/pids/mock-service-1234.pid, server probably not running. Use ps -ef | grep pact if you suspect the process is still running.

NPM Versions doesn't conform to semantic versioning

when trying to do npm install pact-mock-service, npm came back saying that it couldn't figure out which version to download since the targets available were "0.5.2-1","0.5.2-2","0.5.2-3","0.5.3-1" because they weren't part of the strict semantic versioning specification. Adding the dash label at the end makes it so the * version doesn't resolve, which is needed when first installing and tries to install the latest version. Label can be used, but they won't resolve unless specifically mentioned as part of the version.

For this to work, I had to do npm install [email protected]. This is against the standard.

node_modules/.bin/pact-mock-service does not work

Need to use
$ node_modules/pact-mock-service-osx/bin/pact-mock-service

Problem: there could be a conflict if the osx and linux packages are both installed because dev is on mac, but CI is on linux.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.