Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/watch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = function (Spike, args) {
const project = new Spike({ root: args.path, env: args.env })
const project = new Spike({ root: args.path, env: args.env, server: { port: args.port } })
process.nextTick(() => project.watch())
return project
}
12 changes: 12 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ test.cb('watch', (t) => {
cli.on('warning', t.end)
cli.on('compile', (res) => {
t.is(res, 'watch mock')
t.falsy(mock.opts.server.port)
t.end()
})

Expand All @@ -138,6 +139,17 @@ test.cb('watch with env option', (t) => {
cli.run('watch -e production')
})

test.cb('watch with port option', (t) => {
cli.on('error', t.end)
cli.on('warning', t.end)
cli.on('compile', (res) => {
t.is(mock.opts.server.port, 1118)
t.end()
})

cli.run('watch -p 1118')
})

test.cb('add', (t) => {
cli.on('error', t.end)
cli.on('warning', t.end)
Expand Down