Skip to content

Commit

Permalink
test: add await for promisable expect
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Feb 4, 2019
1 parent 43491f6 commit fabf1c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/builder/test/builder.plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ describe('builder: builder plugins', () => {
])
})

test('should throw error if plugin no existed', () => {
test('should throw error if plugin no existed', async () => {
const nuxt = createNuxt()
const builder = new Builder(nuxt, {})
builder.plugins = [
{ src: '/var/nuxt/plugins/test.js', mode: 'all' }
]
Glob.mockImplementationOnce(() => [])

expect(builder.resolvePlugins()).rejects.toThrow('Plugin not found: /var/nuxt/plugins/test.js')
await expect(builder.resolvePlugins()).rejects.toThrow('Plugin not found: /var/nuxt/plugins/test.js')
})

test('should warn if there are multiple files and not index', async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,13 @@ describe('core: module', () => {
expect(result).toEqual({ test: true })
})

test('should throw error when handler is not function', () => {
test('should throw error when handler is not function', async () => {
const module = new ModuleContainer({
resolver: { requireModule: () => false },
options: {}
})

expect(module.addModule('moduleTest')).rejects.toThrow('Module should export a function: moduleTest')
await expect(module.addModule('moduleTest')).rejects.toThrow('Module should export a function: moduleTest')
})

test('should prevent multiple adding when requireOnce is enabled', async () => {
Expand Down

0 comments on commit fabf1c0

Please sign in to comment.