test: add unit tests for core/resolver.js (#5790)

This commit is contained in:
cui_xiaorui 2019-05-23 16:10:18 +08:00 committed by Xin Du (Clark)
parent 59071e4c6d
commit 6e9cf8e394

View File

@ -428,6 +428,19 @@ describe('core: resolver', () => {
expect(() => resolver.requireModule('/var/nuxt/resolver/module.js')).toThrow('resolve esm failed') expect(() => resolver.requireModule('/var/nuxt/resolver/module.js')).toThrow('resolve esm failed')
}) })
test('should display deprecated intropDefault options', () => {
const resolver = new Resolver({
options: {}
})
resolver.resolvePath = x => x
resolver.esm = jest.fn()
resolver.requireModule('/var/nuxt/resolver/file.js', { intropDefault: true })
const warnMsg = 'Using intropDefault is deprecated and will be removed in Nuxt 3. Use `interopDefault` instead.'
expect(consola.warn).toBeCalledTimes(1)
expect(consola.warn).toBeCalledWith(warnMsg)
})
test('should display deprecated alias options', () => { test('should display deprecated alias options', () => {
const resolver = new Resolver({ const resolver = new Resolver({
options: {} options: {}