Skip to content

Commit a28e683

Browse files
rchlTheAlexLichter
authored andcommitted
fix: crash on init with inline-style options (#55)
1 parent c446821 commit a28e683

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

lib/module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ async function redirectModule (moduleOptions) {
1818
this.addServerMiddleware(middleware)
1919
}
2020

21-
async function parseOptions (options) {
21+
async function parseOptions (options = {}) {
2222
if (typeof options === 'function') {
2323
options = await options()
2424
}

test/module.test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,17 @@ describe('function', () => {
121121
})
122122

123123
describe('function inline', () => {
124+
const inlineConfig = {
125+
...config,
126+
modules: [
127+
[require('../'), redirects]
128+
]
129+
}
130+
131+
delete inlineConfig.redirect
132+
124133
beforeAll(async () => {
125-
nuxt = await setupNuxt({
126-
...config,
127-
modules: [
128-
[require('../'), redirects]
129-
]
130-
})
134+
nuxt = await setupNuxt(inlineConfig)
131135
})
132136

133137
afterAll(async () => {

0 commit comments

Comments
 (0)