Skip to content

Commit

Permalink
test: fix breaking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 26, 2023
1 parent 0556cb5 commit ae35d24
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@

export * as errors from './src/errors.js'
export { configure } from './configure.js'
export { stubsRoot } from './stubs/main.js'
export { defineConfig } from './src/define_config.js'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"index:commands": "adonis-kit index build/commands"
},
"dependencies": {
"@adonisjs/presets": "^1.0.0",
"@adonisjs/presets": "^1.0.2",
"@faker-js/faker": "^8.3.1",
"@poppinss/hooks": "^7.2.2",
"@poppinss/macroable": "^1.0.1",
Expand Down
20 changes: 12 additions & 8 deletions test/configure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ test.group('Configure', (group) => {
context.fs.basePath = fileURLToPath(BASE_URL)
})

group.each.disableTimeout()

test('create config file and register provider', async ({ fs, assert }) => {
const ignitor = new IgnitorFactory()
.withCoreProviders()
Expand All @@ -45,7 +47,9 @@ test.group('Configure', (group) => {

const ace = await app.container.make('ace')
ace.prompt.trap('Select the database you want to use').chooseOption(2)
ace.prompt.trap('Do you want to install npm package "pg"?').reject()
ace.prompt
.trap('Do you want to install additional packages required by "@adonisjs/lucid"?')
.reject()

const command = await ace.create(Configure, ['../../index.js'])
await command.exec()
Expand All @@ -67,7 +71,7 @@ test.group('Configure', (group) => {
await assert.fileContains('start/env.ts', 'DB_USER: Env.schema.string()')
await assert.fileContains('start/env.ts', 'DB_PASSWORD: Env.schema.string.optional()')
await assert.fileContains('start/env.ts', 'DB_DATABASE: Env.schema.string()')
}).timeout(6000)
})

test('do not define env vars for sqlite dialect', async ({ fs, assert }) => {
const ignitor = new IgnitorFactory()
Expand All @@ -92,7 +96,7 @@ test.group('Configure', (group) => {

const ace = await app.container.make('ace')
ace.prompt.trap('Select the database you want to use').chooseOption(0)
ace.prompt.trap('Do you want to install npm package "sqlite3"?').reject()
ace.prompt.trap('Do you want to install additional packages required by "@adonisjs/lucid"?')

const command = await ace.create(Configure, ['../../index.js'])
await command.exec()
Expand All @@ -104,7 +108,7 @@ test.group('Configure', (group) => {

await assert.fileNotExists('.env')
await assert.fileNotExists('start/env.ts')
}).timeout(6000)
})

test('create tmp directory for sqlite dialect', async ({ fs, assert }) => {
const ignitor = new IgnitorFactory()
Expand All @@ -129,13 +133,13 @@ test.group('Configure', (group) => {

const ace = await app.container.make('ace')
ace.prompt.trap('Select the database you want to use').chooseOption(0)
ace.prompt.trap('Do you want to install npm package "sqlite3"?').reject()
ace.prompt.trap('Do you want to install additional packages required by "@adonisjs/lucid"?')

const command = await ace.create(Configure, ['../../index.js'])
await command.exec()

await assert.dirExists('tmp')
}).timeout(6000)
})

test('do not recreate tmp directory if it already exists', async ({ fs, assert }) => {
const ignitor = new IgnitorFactory()
Expand All @@ -161,11 +165,11 @@ test.group('Configure', (group) => {

const ace = await app.container.make('ace')
ace.prompt.trap('Select the database you want to use').chooseOption(0)
ace.prompt.trap('Do you want to install npm package "sqlite3"?').reject()
ace.prompt.trap('Do you want to install additional packages required by "@adonisjs/lucid"?')

const command = await ace.create(Configure, ['../../index.js'])
await command.exec()

await assert.fileExists('tmp/db.sqlite')
}).timeout(6000)
})
})

0 comments on commit ae35d24

Please sign in to comment.