-
Notifications
You must be signed in to change notification settings - Fork 24
Add support for mocking services #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
b419565
bba06c9
e254f78
2a35017
ec59917
be88f40
6f25a0a
b7b815d
4e42609
cf7cd71
73d4235
822be83
7b00fe0
d7379f5
2660153
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,10 +3,21 @@ | |
| * Copyright (c) 2015-2016 PointSource, LLC. | ||
| * MIT Licensed | ||
| */ | ||
| var parseArgs = require('minimist'); | ||
| var server = require('../'); | ||
|
|
||
| // parse arguments | ||
| var argv = parseArgs(process.argv.slice(2)); | ||
|
|
||
| // convert mocks from CSV into an array | ||
| var mocks = argv.mocks || argv.m; | ||
| if (mocks) { | ||
| mocks = mocks.split(','); | ||
| } | ||
|
|
||
| server.init({ | ||
| appDir: process.cwd() | ||
| appDir: process.cwd(), | ||
| mocks: mocks | ||
|
||
| }, function(err) { | ||
| if (err) { | ||
| console.warn('Startup failed', err); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "express": { | ||
| "port": "5000" | ||
| }, | ||
|
|
||
| "cluster": { | ||
| "maxWorkers": 1 | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /* | ||
| * Copyright (c) 2015-2016 PointSource, LLC. | ||
| * MIT Licensed | ||
| */ | ||
| exports.init = function(logger) { | ||
| logger.info('Dummy Service Mock initialized'); | ||
| process.exit(0); // exit test here | ||
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| /* | ||
| * Copyright (c) 2015-2016 PointSource, LLC. | ||
| * MIT Licensed | ||
| */ | ||
| exports.init = function() { | ||
| throw new Error('Dummy Service initialized'); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work if invoked as
blueoak-server?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean like this?
blueoak-server --mocks mock-serviceInstead of like this?
./node_modules/blueoak-server/bin/blueoak-server.js --mocks mock-serviceYes, it works on Node v6.8.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks