Skip to content

Commit f99ca7f

Browse files
committed
test: fix breaking tests
1 parent 2e4daa1 commit f99ca7f

File tree

5 files changed

+59
-6
lines changed

5 files changed

+59
-6
lines changed

commands/Invoke.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ export default class Configure extends BaseCommand {
6666
try {
6767
await pkgFile.commitAsync()
6868
spinner.update('Installed')
69+
spinner.stop()
6970
} catch (error) {
7071
spinner.update('Unable to install the package')
72+
spinner.stop()
7173
logger.fatal(error)
7274
}
7375
}
@@ -103,16 +105,16 @@ export default class Configure extends BaseCommand {
103105
}
104106

105107
/**
106-
* Create "tests/functional/hello-world.spec.ts" file
108+
* Create "tests/functional/hello_world.spec.ts" file
107109
*/
108110
const helloWorldTestFile = new files.MustacheFile(
109111
this.application.appRoot,
110-
'tests/functional/hello-world.spec.ts',
111-
join(__dirname, '..', 'templates/tests/functional/hello-world.spec.txt')
112+
'tests/functional/hello_world.spec.ts',
113+
join(__dirname, '..', 'templates/tests/functional/hello_world.spec.txt')
112114
)
113115
if (!helloWorldTestFile.exists()) {
114116
helloWorldTestFile.apply({}).commit()
115-
logger.action('create').succeeded('tests/functional/hello-world.spec.ts')
117+
logger.action('create').succeeded('tests/functional/hello_world.spec.ts')
116118
}
117119

118120
/**
@@ -157,8 +159,10 @@ export default class Configure extends BaseCommand {
157159
try {
158160
await pkgFile.commitAsync()
159161
spinner.update('Installed')
162+
spinner.stop()
160163
} catch (error) {
161164
spinner.update('Unable to install packages')
165+
spinner.stop()
162166
logger.fatal(error)
163167
}
164168
}
File renamed without changes.

test/configure-encore.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test.group('Configure Encore', (group) => {
3535
const app = new Application(fs.basePath, 'test', {})
3636

3737
const invoke = new Invoke(app, new Kernel(app).mockConsoleOutput())
38-
invoke.name = 'encore'
38+
invoke.packages = ['encore']
3939
await invoke.run()
4040

4141
const envFile = await fs.fsExtra.pathExists(join(fs.basePath, 'webpack.config.js'))

test/configure-tests.spec.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* @adonisjs/assembler
3+
*
4+
* (c) Harminder Virk <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
import test from 'japa'
11+
import { join } from 'path'
12+
import { Kernel } from '@adonisjs/ace'
13+
import { Filesystem } from '@poppinss/dev-utils'
14+
import { Application } from '@adonisjs/application'
15+
16+
import Invoke from '../commands/Invoke'
17+
18+
const fs = new Filesystem(join(__dirname, '__app'))
19+
20+
test.group('Configure Tests', (group) => {
21+
group.afterEach(async () => {
22+
await fs.cleanup()
23+
})
24+
25+
test
26+
.skipInCI('setup tests', async (assert) => {
27+
await fs.add(
28+
'package.json',
29+
JSON.stringify({
30+
name: 'sample_app',
31+
})
32+
)
33+
34+
await fs.ensureRoot()
35+
const app = new Application(fs.basePath, 'test', {})
36+
37+
const invoke = new Invoke(app, new Kernel(app).mockConsoleOutput())
38+
invoke.packages = ['tests']
39+
await invoke.run()
40+
41+
assert.isTrue(await fs.fsExtra.pathExists(join(fs.basePath, 'test.ts')))
42+
assert.isTrue(await fs.fsExtra.pathExists(join(fs.basePath, 'tests/bootstrap.ts')))
43+
assert.isTrue(
44+
await fs.fsExtra.pathExists(join(fs.basePath, 'tests/functional/hello_world.spec.ts'))
45+
)
46+
assert.isTrue(await fs.fsExtra.pathExists(join(fs.basePath, 'contracts/tests.ts')))
47+
})
48+
.timeout(0)
49+
})

test/invoke-command.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test.group('Invoke', (group) => {
3838
const app = new Application(fs.basePath, 'test', {})
3939

4040
const invoke = new Invoke(app, new Kernel(app).mockConsoleOutput())
41-
invoke.name = '@adonisjs/sample'
41+
invoke.packages = ['@adonisjs/sample']
4242
await invoke.run()
4343

4444
const envFile = await fs.fsExtra.readFile(join(fs.basePath, '.env'), 'utf-8')

0 commit comments

Comments
 (0)