2020-10-13 10:20:04 +00:00
import consola from 'consola'
import getCommand from '../../src/commands'
2019-07-04 12:58:07 +00:00
import run from '../../src/run'
2020-10-13 10:20:04 +00:00
jest . mock ( '../../src/commands' )
2019-07-04 12:58:07 +00:00
jest . mock ( '../../package.json' , ( ) => ( {
2019-07-10 09:57:31 +00:00
name : '@nuxt/cli-edge'
2019-07-04 12:58:07 +00:00
} ) )
describe ( 'run in edge' , ( ) => {
test ( 'throws error if nuxt and nuxt-edge are installed' , async ( ) => {
2020-10-13 10:20:04 +00:00
const mockedCommand = { run : jest . fn ( ( ) => Promise . resolve ( { } ) ) }
getCommand . mockImplementationOnce ( ( ) => Promise . resolve ( mockedCommand ) )
await run ( )
expect ( consola . warn ) . toHaveBeenCalledWith ( 'Both `nuxt` and `nuxt-edge` dependencies are installed! Please choose one and remove the other one from dependencies.' )
2019-07-04 12:58:07 +00:00
} )
} )