Skip to content

Commit 64cdf5c

Browse files
committed
refactor: install specific versions of plugins
1 parent 2b646d2 commit 64cdf5c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

index.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const TITLE = Buffer.from(
2626
const REPORTER_CHOICES = [
2727
{
2828
name: '@japa/spec-reporter' as const,
29+
version: '1.3.3',
2930
hint: '(Spec reporter)',
3031
importCall() {
3132
return `import { specReporter } from '${this.name}'`
@@ -41,6 +42,7 @@ const ASSERTION_CHOICES = [
4142
{
4243
name: '@japa/assert' as const,
4344
hint: '(Chai.js assert)',
45+
version: '1.4.1',
4446
importCall() {
4547
return `import { assert } from '${this.name}'`
4648
},
@@ -60,6 +62,7 @@ const ASSERTION_CHOICES = [
6062
{
6163
name: '@japa/expect' as const,
6264
hint: '(Jest expect)',
65+
version: '2.0.2',
6366
types: {
6467
importCall() {
6568
return ''
@@ -86,6 +89,7 @@ const ADDITIONAL_PLUGINS = [
8689
{
8790
name: '@japa/run-failed-tests' as const,
8891
hint: '(A plugin to run only failed tests)',
92+
version: '1.1.1',
8993
importCall() {
9094
return `import { runFailedTests } from '${this.name}'`
9195
},
@@ -97,6 +101,7 @@ const ADDITIONAL_PLUGINS = [
97101
{
98102
name: '@japa/api-client' as const,
99103
hint: '(A plugin to test API endpoints over HTTP)',
104+
version: '1.4.4',
100105
importCall() {
101106
return `import { apiClient } from '${this.name}'`
102107
},
@@ -207,7 +212,7 @@ export async function setup() {
207212
const tsContextProperties: string[] = []
208213
const tsTestProperties: string[] = []
209214
const tsImports: string[] = [`import '@japa/runner'`]
210-
const packagesToInstall: string[] = ['@japa/runner']
215+
const packagesToInstall: string[] = ['@japa/runner@1.2.0']
211216

212217
const testFileName = `bin/test.${fileExtension}`
213218
const typesFileName = 'bin/japa_types.ts'
@@ -225,7 +230,7 @@ export async function setup() {
225230
*/
226231
reporters.forEach((reporter) => {
227232
const reporterMatch = REPORTER_CHOICES.find(({ name }) => name === reporter)!
228-
packagesToInstall.push(reporter)
233+
packagesToInstall.push(`${reporterMatch.name}@${reporterMatch.version}`)
229234
imports.push(
230235
projectType === 'JavaScript' ? reporterMatch.requireCall() : reporterMatch.importCall()
231236
)
@@ -237,7 +242,7 @@ export async function setup() {
237242
*/
238243
if (assertionLibrary !== 'None') {
239244
const assertionMatch = ASSERTION_CHOICES.find(({ name }) => name === assertionLibrary)!
240-
packagesToInstall.push(assertionLibrary)
245+
packagesToInstall.push(`${assertionMatch.name}@${assertionMatch.version}`)
241246
imports.push(
242247
projectType === 'JavaScript' ? assertionMatch.requireCall!() : assertionMatch.importCall!()
243248
)
@@ -264,7 +269,7 @@ export async function setup() {
264269
*/
265270
plugins.forEach((plugin) => {
266271
const promptMatch = ADDITIONAL_PLUGINS.find(({ name }) => name === plugin)!
267-
packagesToInstall.push(plugin)
272+
packagesToInstall.push(`${promptMatch.name}@${promptMatch.version}`)
268273
imports.push(
269274
projectType === 'JavaScript' ? promptMatch.requireCall() : promptMatch.importCall()
270275
)

0 commit comments

Comments
 (0)