test: add await for promisable expect

This commit is contained in:
Clark Du 2019-02-04 11:31:24 +00:00
parent 43491f6e53
commit fabf1c07eb
2 changed files with 4 additions and 4 deletions

View File

@ -92,7 +92,7 @@ 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 = [
@ -100,7 +100,7 @@ describe('builder: builder plugins', () => {
]
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 () => {

View File

@ -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 () => {