Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/nuxi/test/unit/commands/module/add.spec.ts
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
import { describe, expect, it, vi } from 'vitest'
import { beforeAll, describe, expect, it, vi } from 'vitest'

import commands from '../../../../src/commands/module'
import * as utils from '../../../../src/commands/module/_utils'
import * as runCommands from '../../../../src/run'
Expand DownExpand Up@@ -37,6 +38,12 @@ function applyMocks() {
})
}
describe('module add', () => {
let v3: string
beforeAll(async () => {
v3 = await fetch('https://registry.npmjs.org/@nuxt/content')
.then(r => r.json())
.then(r => r['dist-tags'].latest)
})
applyMocks()
vi.spyOn(runCommands, 'runCommand').mockImplementation(vi.fn())
vi.spyOn(utils, 'getNuxtVersion').mockResolvedValue('3.0.0')
Expand DownExpand Up@@ -76,7 +83,7 @@ describe('module add', () => {
},
})

expect(addDependency).toHaveBeenCalledWith(['@nuxt/content@3.0.0'], {
expect(addDependency).toHaveBeenCalledWith([`@nuxt/content@${v3}`], {
cwd: '/fake-dir',
dev: true,
installPeerDependencies: true,
Expand Down