static and serveIndex default directories added to programmatic API
path.resolve used on mock module path to guarantee absolute path. Fixes #25
This commit is contained in:
@ -59,6 +59,8 @@ function localWebServer (options) {
|
||||
log.format = 'none'
|
||||
}
|
||||
|
||||
if (!options.static.root) options.static.root = process.cwd()
|
||||
if (!options.serveIndex.path) options.serveIndex.path = process.cwd()
|
||||
options.rewrite = arrayify(options.rewrite)
|
||||
options.forbid = arrayify(options.forbid)
|
||||
options.mocks = arrayify(options.mocks)
|
||||
@ -148,7 +150,7 @@ function localWebServer (options) {
|
||||
/* Mock Responses */
|
||||
options.mocks.forEach(mock => {
|
||||
if (mock.module) {
|
||||
mock.responses = require(path.join(options.static.root, mock.module))
|
||||
mock.responses = require(path.resolve(path.join(options.static.root, mock.module)))
|
||||
}
|
||||
|
||||
if (mock.responses) {
|
||||
|
Reference in New Issue
Block a user