Skip to content

Commit e6fde22

Browse files
committed
fix(staticserver): keep ref to config
1 parent 81a35a9 commit e6fde22

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/utils/commands/static-server.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,11 @@ export default class StaticServer {
2424
return
2525
}
2626

27-
const config = {
28-
quiet: browser.config.quiet,
29-
...browser.config.staticServer
30-
}
31-
32-
browser.hook('start:before', () => StaticServer.start(config))
27+
browser.hook('start:before', () => StaticServer.start(browser.config.staticServer, browser.config.quiet))
3328
browser.hook('close:after', StaticServer.stop)
3429
}
3530

36-
static async start(config) {
31+
static async start(config, quiet) {
3732
await StaticServer.loadDependencies()
3833

3934
const app = StaticServer.express()
@@ -45,7 +40,7 @@ export default class StaticServer {
4540

4641
StaticServer.server = app.listen(port, host)
4742

48-
if (!config.quiet) {
43+
if (!quiet) {
4944
// eslint-disable-next-line no-console
5045
console.info(`tib: Static server started on http://${host}:${port}`)
5146
}

test/unit/command.static-server.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,12 @@ describe('StaticServer', () => {
101101
StaticServer.serveStatic = jest.fn()
102102

103103
const staticServerConfig = {
104-
quiet: true,
105104
folder: 'test-folder',
106105
host: 'test-host',
107106
port: 667
108107
}
109108

110-
await expect(StaticServer.start(staticServerConfig)).resolves.toBeUndefined()
109+
await expect(StaticServer.start(staticServerConfig, true)).resolves.toBeUndefined()
111110

112111
expect(StaticServer.express).toHaveBeenCalled()
113112
expect(use).toHaveBeenCalled()

0 commit comments

Comments
 (0)