Nuxt/packages/cli/test/unit/dependencies.test.js
Daniel Roe e5d202badb
feat(cli): warn if incompatible node/package versions detected (#8792)
Co-authored-by: Pooya Parsa <pyapar@gmail.com>
2021-02-09 18:35:22 +01:00

26 lines
668 B
JavaScript

import { consola } from '../utils'
import { checkDependencies } from '../../src/utils/dependencies'
jest.mock('webpack/package.json', () => ({
version: '5.0.0'
}))
describe('cli/utils', () => {
afterEach(() => jest.resetAllMocks())
test('checkDependencies', () => {
checkDependencies()
expect(consola.warn).toHaveBeenCalledWith(
expect.stringMatching(
/webpack@.+ is installed but .+ is expected/
)
)
expect(consola.warn).toHaveBeenCalledTimes(1)
if (process.version.startsWith('v10')) {
expect(consola.warn).toHaveBeenCalledTimes(2)
} else {
expect(consola.warn).toHaveBeenCalledTimes(1)
}
})
})