@sprucelabs/spruce-cli 24.0.0 → 24.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/build/InFlightEntertainment.d.ts +2 -2
- package/build/__tests__/behavioral/DeployingASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js.map +1 -1
- package/build/__tests__/behavioral/conversations/CreatingAConversationTopic.test.js +2 -2
- package/build/__tests__/behavioral/conversations/CreatingAConversationTopic.test.js.map +1 -1
- package/build/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.js +1 -1
- package/build/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.js.map +1 -1
- package/build/__tests__/behavioral/conversations/TestingAConversation.test.js +5 -5
- package/build/__tests__/behavioral/conversations/TestingAConversation.test.js.map +1 -1
- package/build/__tests__/behavioral/lint/LintService.test.js.map +1 -1
- package/build/__tests__/behavioral/node/CreatingANodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/onboard/StartingOnboarding.test.js.map +1 -1
- package/build/__tests__/behavioral/organization/CreatingAnOrg.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/CreatingASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/RebuildingASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/stores/CreatingADataStore.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.d.ts +11 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.js +49 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.d.ts +5 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.js +34 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.d.ts +12 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.js +88 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.d.ts +13 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.js +109 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.d.ts +4 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.js +29 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.d.ts +29 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js +300 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.d.ts +26 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js +202 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js.map +1 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest.txt +24 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest.txt +24 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +36 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest2.txt +63 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +222 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +34 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest2.txt +62 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +221 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.d.ts +2 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.js +51 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.js.map +1 -0
- package/build/__tests__/behavioral/upgrading/UpdatingDependencies2.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingANonSpruceNodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js.map +1 -1
- package/build/__tests__/behavioral/versions/ResolvingVersions.test.js +0 -3
- package/build/__tests__/behavioral/versions/ResolvingVersions.test.js.map +1 -1
- package/build/__tests__/behavioral/views/WatchingSkillViews.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter4.test.js.map +1 -1
- package/build/__tests__/implementation/FeatureInstaller.test.js.map +1 -1
- package/build/__tests__/implementation/OrganizationStore.test.js +2 -2
- package/build/__tests__/implementation/OrganizationStore.test.js.map +1 -1
- package/build/__tests__/implementation/PkgService.test.js.map +1 -1
- package/build/__tests__/implementation/StoreFeature.test.js.map +1 -1
- package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/AnotherStaticTest.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/ShouldBeIgnored.ts +0 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/StaticTest1.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/DoNotInclude.ts +0 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AStaticTest.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AnotherStaticTest1.test.ts +33 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_3/NotAFileThatShouldBeMigrated.ts +0 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AStaticTest2.test.ts +17 -0
- package/build/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AbstractWhateverTest.ts +3 -0
- package/build/boot.js.map +1 -1
- package/build/features/skill/actions/BootAction.js.map +1 -1
- package/build/features/test/TestRunner.d.ts +2 -2
- package/build/features/test/TestRunner.js.map +1 -1
- package/build/features/test/actions/CreateAction.d.ts +1 -0
- package/build/features/test/actions/CreateAction.js +13 -0
- package/build/features/test/actions/CreateAction.js.map +1 -1
- package/build/features/test/actions/MigrateAction.d.ts +17 -0
- package/build/features/test/actions/MigrateAction.js +42 -0
- package/build/features/test/actions/MigrateAction.js.map +1 -0
- package/build/features/vscode/services/VsCodeService.d.ts +2 -2
- package/build/features/vscode/services/VsCodeService.js.map +1 -1
- package/build/services/BuildService.d.ts +2 -2
- package/build/services/BuildService.js.map +1 -1
- package/build/services/CommandService.d.ts +20 -12
- package/build/services/CommandService.js +4 -4
- package/build/services/CommandService.js.map +1 -1
- package/build/services/GameService.d.ts +2 -2
- package/build/services/GameService.js.map +1 -1
- package/build/services/ImportService.d.ts +2 -2
- package/build/services/ImportService.js.map +1 -1
- package/build/services/LintService.d.ts +1 -1
- package/build/services/PkgService.d.ts +2 -2
- package/build/services/PkgService.js.map +1 -1
- package/build/services/ServiceFactory.d.ts +2 -2
- package/build/services/ServiceFactory.js.map +1 -1
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/CommandFaker.js.map +1 -1
- package/build/tests/staticToInstanceMigration/StaticTestFinder.d.ts +8 -0
- package/build/tests/staticToInstanceMigration/StaticTestFinder.js +23 -0
- package/build/tests/staticToInstanceMigration/StaticTestFinder.js.map +1 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.d.ts +61 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.js +55 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceMigrator.js.map +1 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.d.ts +12 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js +138 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js.map +1 -0
- package/package.json +27 -27
- package/src/InFlightEntertainment.ts +2 -2
- package/src/__tests__/behavioral/DeployingASkill.test.ts +26 -23
- package/src/__tests__/behavioral/EnablingAndDisablingCache.test.ts +13 -13
- package/src/__tests__/behavioral/conversations/CreatingAConversationTopic.test.ts +2 -2
- package/src/__tests__/behavioral/conversations/RegisteringConversationsOnBoot.test.ts +1 -1
- package/src/__tests__/behavioral/conversations/TestingAConversation.test.ts +5 -5
- package/src/__tests__/behavioral/lint/LintService.test.ts +3 -3
- package/src/__tests__/behavioral/node/CreatingANodeModule.test.ts +2 -2
- package/src/__tests__/behavioral/onboard/StartingOnboarding.test.ts +2 -2
- package/src/__tests__/behavioral/organization/CreatingAnOrg.test.ts +0 -1
- package/src/__tests__/behavioral/skill/CreatingASkill.test.ts +2 -2
- package/src/__tests__/behavioral/skill/RebuildingASkill.test.ts +3 -3
- package/src/__tests__/behavioral/stores/CreatingADataStore.test.ts +3 -3
- package/src/__tests__/behavioral/tests/migrationToInstance/AbstractInstanceTest.ts +77 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/InstanceBasedTesting.test.ts +19 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/MigratingTests.test.ts +99 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticTestFinder.test.ts +72 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticTestsWhenAlreadyExists.test.ts +31 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceMigrator.test.ts +310 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.ts +193 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest.txt +24 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest.txt +24 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +36 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest2.txt +63 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +222 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +34 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest2.txt +62 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +221 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/testFileContentsGenerators.ts +50 -0
- package/src/__tests__/behavioral/upgrading/UpdatingDependencies2.test.ts +3 -3
- package/src/__tests__/behavioral/upgrading/UpgradingANodeModule.test.ts +6 -6
- package/src/__tests__/behavioral/upgrading/UpgradingANonSpruceNodeModule.test.ts +4 -4
- package/src/__tests__/behavioral/upgrading/UpgradingASkill3.test.ts +9 -9
- package/src/__tests__/behavioral/upgrading/UpgradingASkill4.test.ts +4 -4
- package/src/__tests__/behavioral/upgrading/UpgradingASkill5.test.ts +4 -4
- package/src/__tests__/behavioral/versions/ResolvingVersions.test.ts +1 -3
- package/src/__tests__/behavioral/views/WatchingSkillViews.test.ts +2 -2
- package/src/__tests__/implementation/ActionExecuter2.test.ts +2 -2
- package/src/__tests__/implementation/ActionExecuter4.test.ts +3 -3
- package/src/__tests__/implementation/FeatureInstaller.test.ts +2 -2
- package/src/__tests__/implementation/OrganizationStore.test.ts +6 -2
- package/src/__tests__/implementation/PkgService.test.ts +3 -3
- package/src/__tests__/implementation/StoreFeature.test.ts +2 -2
- package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/AnotherStaticTest.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/ShouldBeIgnored.ts +0 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/StaticTest1.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/DoNotInclude.ts +0 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AStaticTest.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AnotherStaticTest1.test.ts +33 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_3/NotAFileThatShouldBeMigrated.ts +0 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AStaticTest2.test.ts +17 -0
- package/src/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AbstractWhateverTest.ts +3 -0
- package/src/boot.ts +2 -2
- package/src/features/skill/actions/BootAction.ts +2 -2
- package/src/features/test/TestRunner.ts +3 -3
- package/src/features/test/actions/CreateAction.ts +17 -0
- package/src/features/test/actions/MigrateAction.ts +44 -0
- package/src/features/vscode/services/VsCodeService.ts +2 -2
- package/src/services/BuildService.ts +3 -3
- package/src/services/CommandService.ts +27 -14
- package/src/services/GameService.ts +3 -3
- package/src/services/ImportService.ts +3 -3
- package/src/services/LintService.ts +1 -1
- package/src/services/PkgService.ts +3 -3
- package/src/services/ServiceFactory.ts +6 -6
- package/src/tests/AbstractCliTest.ts +2 -2
- package/src/tests/CommandFaker.ts +4 -4
- package/src/tests/staticToInstanceMigration/StaticTestFinder.ts +25 -0
- package/src/tests/staticToInstanceMigration/StaticToInstanceMigrator.ts +83 -0
- package/src/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.ts +197 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
3
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
4
|
-
import
|
|
4
|
+
import CommandServiceImpl from '../../services/CommandService'
|
|
5
5
|
import LintService from '../../services/LintService'
|
|
6
6
|
import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
7
7
|
import testUtil from '../../tests/utilities/test.utility'
|
|
@@ -15,43 +15,46 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
15
15
|
|
|
16
16
|
protected static async beforeEach() {
|
|
17
17
|
await super.beforeEach()
|
|
18
|
-
|
|
18
|
+
CommandServiceImpl.fakeCommand('which heroku', {
|
|
19
19
|
code: 0,
|
|
20
20
|
})
|
|
21
|
-
|
|
21
|
+
CommandServiceImpl.fakeCommand('grep api.heroku.com ~/.netrc', {
|
|
22
22
|
code: 0,
|
|
23
23
|
})
|
|
24
|
-
|
|
24
|
+
CommandServiceImpl.fakeCommand('git status', {
|
|
25
25
|
code: 0,
|
|
26
26
|
})
|
|
27
|
-
|
|
27
|
+
CommandServiceImpl.fakeCommand('git init', {
|
|
28
28
|
code: 0,
|
|
29
29
|
stdout: 'Initialized empty Git repository in',
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
CommandServiceImpl.fakeCommand('git ls-remote heroku', {
|
|
33
33
|
code: 0,
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
CommandServiceImpl.fakeCommand('which git', {
|
|
37
37
|
code: 0,
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
CommandServiceImpl.fakeCommand('heroku create good-heroku-name', {
|
|
41
41
|
code: 0,
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
CommandServiceImpl.fakeCommand('heroku create bad-heroku-name', {
|
|
45
45
|
code: 1,
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
CommandServiceImpl.fakeCommand('heroku buildpacks:set heroku/nodejs', {
|
|
49
49
|
code: 0,
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
CommandServiceImpl.fakeCommand(
|
|
53
|
+
'git push --set-upstream heroku master',
|
|
54
|
+
{
|
|
55
|
+
code: 0,
|
|
56
|
+
}
|
|
57
|
+
)
|
|
55
58
|
|
|
56
59
|
diskUtil.writeFile(this.resolvePath('Procfile'), 'web: npm run boot')
|
|
57
60
|
}
|
|
@@ -142,7 +145,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
142
145
|
|
|
143
146
|
@test()
|
|
144
147
|
protected static async errorsIfHerokuClientNotInstalled() {
|
|
145
|
-
|
|
148
|
+
CommandServiceImpl.fakeCommand('which heroku', {
|
|
146
149
|
code: 1,
|
|
147
150
|
})
|
|
148
151
|
|
|
@@ -165,7 +168,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
165
168
|
|
|
166
169
|
@test()
|
|
167
170
|
protected static async errorsIfGitNotInstalled() {
|
|
168
|
-
|
|
171
|
+
CommandServiceImpl.fakeCommand('which git', {
|
|
169
172
|
code: 1,
|
|
170
173
|
})
|
|
171
174
|
|
|
@@ -188,7 +191,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
188
191
|
|
|
189
192
|
@test()
|
|
190
193
|
protected static async errorsIfNotInGitRepo() {
|
|
191
|
-
|
|
194
|
+
CommandServiceImpl.fakeCommand('git status', {
|
|
192
195
|
code: 128,
|
|
193
196
|
stderr: 'fatal: not a git repository (or any of the parent directories): .git',
|
|
194
197
|
})
|
|
@@ -217,7 +220,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
217
220
|
|
|
218
221
|
@test()
|
|
219
222
|
protected static async canCreateGitRepoIfNeeded() {
|
|
220
|
-
|
|
223
|
+
CommandServiceImpl.fakeCommand('git status', {
|
|
221
224
|
code: 128,
|
|
222
225
|
})
|
|
223
226
|
|
|
@@ -233,7 +236,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
233
236
|
|
|
234
237
|
await this.waitForInput()
|
|
235
238
|
|
|
236
|
-
|
|
239
|
+
CommandServiceImpl.fakeCommand('git status', {
|
|
237
240
|
code: 0,
|
|
238
241
|
})
|
|
239
242
|
|
|
@@ -246,7 +249,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
246
249
|
|
|
247
250
|
@test()
|
|
248
251
|
protected static async errorsWhenNotLoggedIntoHerkou() {
|
|
249
|
-
|
|
252
|
+
CommandServiceImpl.fakeCommand('grep api.heroku.com ~/.netrc', {
|
|
250
253
|
code: 1,
|
|
251
254
|
})
|
|
252
255
|
|
|
@@ -329,7 +332,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
329
332
|
|
|
330
333
|
@test()
|
|
331
334
|
protected static async failsWhenDeclineToCreateRemoteBranch() {
|
|
332
|
-
|
|
335
|
+
CommandServiceImpl.fakeCommand('git ls-remote heroku', {
|
|
333
336
|
code: 128,
|
|
334
337
|
})
|
|
335
338
|
|
|
@@ -361,7 +364,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
361
364
|
|
|
362
365
|
@test()
|
|
363
366
|
protected static async asksForHerokuAppName() {
|
|
364
|
-
|
|
367
|
+
CommandServiceImpl.fakeCommand('git ls-remote heroku', {
|
|
365
368
|
code: 128,
|
|
366
369
|
})
|
|
367
370
|
|
|
@@ -397,7 +400,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
397
400
|
|
|
398
401
|
@test()
|
|
399
402
|
protected static async keepsAskingForAppNameUntilAGoodOneIsSelected() {
|
|
400
|
-
|
|
403
|
+
CommandServiceImpl.fakeCommand('git ls-remote heroku', {
|
|
401
404
|
code: 128,
|
|
402
405
|
})
|
|
403
406
|
await this.FeatureFixture().installCachedFeatures('deploy')
|
|
@@ -439,7 +442,7 @@ export default class DeployingASkillTest extends AbstractCliTest {
|
|
|
439
442
|
|
|
440
443
|
@test()
|
|
441
444
|
protected static async failsWithPendingChangesToCommit() {
|
|
442
|
-
|
|
445
|
+
CommandServiceImpl.fakeCommand('git status', {
|
|
443
446
|
code: 0,
|
|
444
447
|
stdout: 'Changes not staged for commit',
|
|
445
448
|
})
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
DISABLE_NPM_CACHE_COMMAND,
|
|
5
5
|
ENABLE_NPM_CACHE_COMMAND,
|
|
6
6
|
} from '../../features/cache/constants'
|
|
7
|
-
import
|
|
7
|
+
import CommandServiceImpl from '../../services/CommandService'
|
|
8
8
|
import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
9
9
|
|
|
10
10
|
export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
@@ -21,7 +21,7 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
21
21
|
|
|
22
22
|
@test()
|
|
23
23
|
protected static async returnsErrorWhenEnablingIfDockerIsNotInstalled() {
|
|
24
|
-
|
|
24
|
+
CommandServiceImpl.fakeCommand(/which docker/gis, {
|
|
25
25
|
code: 1,
|
|
26
26
|
})
|
|
27
27
|
|
|
@@ -39,7 +39,7 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
39
39
|
|
|
40
40
|
@test()
|
|
41
41
|
protected static async returnsErrorWhenDockerNotEnabled() {
|
|
42
|
-
|
|
42
|
+
CommandServiceImpl.fakeCommand(/npm config/gis, {
|
|
43
43
|
code: 1,
|
|
44
44
|
stderr: 'which',
|
|
45
45
|
})
|
|
@@ -52,13 +52,13 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
52
52
|
|
|
53
53
|
@test()
|
|
54
54
|
protected static async canEnableCache() {
|
|
55
|
-
|
|
55
|
+
CommandServiceImpl.fakeCommand(/which docker/gis, {
|
|
56
56
|
code: 0,
|
|
57
57
|
})
|
|
58
|
-
|
|
58
|
+
CommandServiceImpl.fakeCommand(ENABLE_NPM_CACHE_COMMAND, {
|
|
59
59
|
code: 0,
|
|
60
60
|
})
|
|
61
|
-
|
|
61
|
+
CommandServiceImpl.fakeCommand(DISABLE_NPM_CACHE_COMMAND, {
|
|
62
62
|
code: 0,
|
|
63
63
|
})
|
|
64
64
|
|
|
@@ -73,7 +73,7 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
73
73
|
|
|
74
74
|
@test()
|
|
75
75
|
protected static async returnsErrorWhenDisablingIfDockerIsNotInstalled() {
|
|
76
|
-
|
|
76
|
+
CommandServiceImpl.fakeCommand(/which docker/gis, {
|
|
77
77
|
code: 1,
|
|
78
78
|
})
|
|
79
79
|
|
|
@@ -91,10 +91,10 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
91
91
|
|
|
92
92
|
@test()
|
|
93
93
|
protected static async returnsErrorWhenDisablingIfDockerIsNotStarted() {
|
|
94
|
-
|
|
94
|
+
CommandServiceImpl.fakeCommand(/which docker/gis, {
|
|
95
95
|
code: 0,
|
|
96
96
|
})
|
|
97
|
-
|
|
97
|
+
CommandServiceImpl.fakeCommand(/npm config/gis, {
|
|
98
98
|
code: 1,
|
|
99
99
|
})
|
|
100
100
|
|
|
@@ -112,7 +112,7 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
112
112
|
|
|
113
113
|
@test()
|
|
114
114
|
protected static async returnsErrorIfCacheIsNotInstalled() {
|
|
115
|
-
|
|
115
|
+
CommandServiceImpl.fakeCommand(/npm config/gis, {
|
|
116
116
|
code: 1,
|
|
117
117
|
stderr: 'tsanoehusnatohu snatoh No such container staoheu saotnhu ',
|
|
118
118
|
})
|
|
@@ -125,13 +125,13 @@ export default class EnablingAndDisablingCacheTest extends AbstractCliTest {
|
|
|
125
125
|
|
|
126
126
|
@test()
|
|
127
127
|
protected static async canEnableCacheMultipleTimes() {
|
|
128
|
-
|
|
128
|
+
CommandServiceImpl.fakeCommand(/which docker/gis, {
|
|
129
129
|
code: 0,
|
|
130
130
|
})
|
|
131
|
-
|
|
131
|
+
CommandServiceImpl.fakeCommand(DISABLE_NPM_CACHE_COMMAND, {
|
|
132
132
|
code: 0,
|
|
133
133
|
})
|
|
134
|
-
|
|
134
|
+
CommandServiceImpl.fakeCommand(ENABLE_NPM_CACHE_COMMAND, {
|
|
135
135
|
code: 0,
|
|
136
136
|
})
|
|
137
137
|
|
|
@@ -5,12 +5,12 @@ import testUtil from '../../../tests/utilities/test.utility'
|
|
|
5
5
|
import { CliInterface } from '../../../types/cli.types'
|
|
6
6
|
|
|
7
7
|
export default class CreatingAConversationTopicTest extends AbstractCliTest {
|
|
8
|
-
@test()
|
|
8
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
9
9
|
protected static async hasCreateConversationAction() {
|
|
10
10
|
assert.isFunction(this.Action('conversation', 'create').execute)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
@test()
|
|
13
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
14
14
|
protected static async createsValidConversationTopicDefinition() {
|
|
15
15
|
const cli =
|
|
16
16
|
await this.FeatureFixture().installCachedFeatures('conversation')
|
|
@@ -2,7 +2,7 @@ import { test, assert } from '@sprucelabs/test-utils'
|
|
|
2
2
|
import AbstractEventTest from '../../../tests/AbstractEventTest'
|
|
3
3
|
|
|
4
4
|
export default class RegisteringConversationsOnBootTest extends AbstractEventTest {
|
|
5
|
-
@test()
|
|
5
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
6
6
|
protected static async canRegisterConversationsOnBoot() {
|
|
7
7
|
const { currentSkill } =
|
|
8
8
|
await this.seedDummySkillRegisterCurrentSkillAndInstallToOrg(
|
|
@@ -5,12 +5,12 @@ import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
|
5
5
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
6
6
|
|
|
7
7
|
export default class TestingAConversationTest extends AbstractCliTest {
|
|
8
|
-
@test()
|
|
8
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
9
9
|
protected static async hasTestConvoFeature() {
|
|
10
10
|
assert.isFunction(this.Action('conversation', 'test').execute)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
@test()
|
|
13
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
14
14
|
protected static async shouldRunWithoutConversationShouldShutdownOnItsOwn() {
|
|
15
15
|
await this.FeatureFixture().installCachedFeatures('conversation')
|
|
16
16
|
|
|
@@ -33,7 +33,7 @@ export default class TestingAConversationTest extends AbstractCliTest {
|
|
|
33
33
|
} while (psResults.length > 0)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@test()
|
|
36
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
37
37
|
protected static async runsUntilKilled() {
|
|
38
38
|
await this.installAndCreateConversation()
|
|
39
39
|
|
|
@@ -59,7 +59,7 @@ export default class TestingAConversationTest extends AbstractCliTest {
|
|
|
59
59
|
} while (psResults.length > 0)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
@test()
|
|
62
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
63
63
|
protected static async doesntReturnErrorWhenKilled() {
|
|
64
64
|
await this.installAndCreateConversation()
|
|
65
65
|
const test = this.Action(
|
|
@@ -79,7 +79,7 @@ export default class TestingAConversationTest extends AbstractCliTest {
|
|
|
79
79
|
assert.isFalsy(results.errors)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
@test()
|
|
82
|
+
@test.skip('bring back if re introducing conversation topics')
|
|
83
83
|
protected static async returnsErrorWhenScriptErrors() {
|
|
84
84
|
const { createResults } = await this.installAndCreateConversation()
|
|
85
85
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
2
|
-
import
|
|
2
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
3
3
|
import LintService from '../../../services/LintService'
|
|
4
4
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ export default class LintServiceTest extends AbstractCliTest {
|
|
|
19
19
|
protected static async throwsWhenLintReturnsMessage() {
|
|
20
20
|
await this.FeatureFixture().installCachedFeatures('skills')
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
CommandServiceImpl.fakeCommand(/node/, {
|
|
23
23
|
code: 0,
|
|
24
24
|
stdout: `[{"filePath":"/Users/taylorromero/Development/SpruceLabs/spruce-appointments-skill/src/.spruce/stores/stores.types.ts","messages":[{"fatal":false,"severity":1,"message":"File ignored by default. Use a negated ignore pattern (like \\"--ignore-pattern '!<relative/path/to/filename>'\\") to override."}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]}]\n`,
|
|
25
25
|
})
|
|
@@ -31,7 +31,7 @@ export default class LintServiceTest extends AbstractCliTest {
|
|
|
31
31
|
protected static async worksWhenNoMessagesReturned() {
|
|
32
32
|
await this.FeatureFixture().installCachedFeatures('skills')
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
CommandServiceImpl.fakeCommand(/node/, {
|
|
35
35
|
code: 0,
|
|
36
36
|
stdout: `[{"filePath":"/Users/taylorromero/Development/SpruceLabs/spruce-appointments-skill/src/.spruce/stores/stores.types.ts","messages":[{"fatal":false,"severity":1,"message":"File ignored by default. Use a negated ignore pattern (like \\"--ignore-pattern '!<relative/path/to/filename>'\\") to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]}]\n`,
|
|
37
37
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
|
-
import
|
|
3
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
4
4
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
5
5
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ export default class CreatingANodeModuleTest extends AbstractCliTest {
|
|
|
12
12
|
|
|
13
13
|
@test()
|
|
14
14
|
protected static async canCreateAtDestination() {
|
|
15
|
-
|
|
15
|
+
CommandServiceImpl.fakeCommand(new RegExp(/yarn add/gis), {
|
|
16
16
|
code: 0,
|
|
17
17
|
})
|
|
18
18
|
const promise = this.Action('node', 'create', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
2
|
import CliGlobalEmitter, { globalContract } from '../../../GlobalEmitter'
|
|
3
|
-
import
|
|
3
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
4
4
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
5
5
|
|
|
6
6
|
class SpyEmitter extends CliGlobalEmitter {
|
|
@@ -32,7 +32,7 @@ export default class StartingOnboardingTest extends AbstractCliTest {
|
|
|
32
32
|
|
|
33
33
|
@test()
|
|
34
34
|
protected static async onboardingThroughSkillCreateThenShutsOff() {
|
|
35
|
-
|
|
35
|
+
CommandServiceImpl.fakeCommand(/yarn/, { code: 0 })
|
|
36
36
|
|
|
37
37
|
const onboardAction = this.Action('onboard', 'onboard')
|
|
38
38
|
const onboardPromise = onboardAction.execute({})
|
|
@@ -14,7 +14,6 @@ export default class CreatingAnOrgTest extends AbstractCliTest {
|
|
|
14
14
|
const slug = `my-org-${new Date().getTime()}`
|
|
15
15
|
|
|
16
16
|
await this.FeatureFixture().installCachedFeatures('organizations')
|
|
17
|
-
|
|
18
17
|
await this.people.loginAsDemoPerson()
|
|
19
18
|
|
|
20
19
|
const results = await this.Action('organization', 'create').execute({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
|
-
import
|
|
2
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
3
3
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
4
4
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
5
5
|
|
|
6
6
|
export default class CreatingASkillTest extends AbstractCliTest {
|
|
7
7
|
protected static async beforeEach() {
|
|
8
8
|
await super.beforeEach()
|
|
9
|
-
|
|
9
|
+
CommandServiceImpl.fakeCommand(new RegExp(/npm.*?install .*?/gis), {
|
|
10
10
|
code: 0,
|
|
11
11
|
})
|
|
12
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
2
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
3
|
-
import
|
|
3
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
4
4
|
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
5
5
|
|
|
6
6
|
export default class RebuildingASkillTest extends AbstractSkillTest {
|
|
@@ -13,7 +13,7 @@ export default class RebuildingASkillTest extends AbstractSkillTest {
|
|
|
13
13
|
|
|
14
14
|
@test()
|
|
15
15
|
protected static async runsExpectedCommand() {
|
|
16
|
-
|
|
16
|
+
CommandServiceImpl.fakeCommand('yarn rebuild', { code: 0 })
|
|
17
17
|
|
|
18
18
|
const results = await this.Action('skill', 'rebuild').execute({
|
|
19
19
|
shouldPlayGames: false,
|
|
@@ -24,7 +24,7 @@ export default class RebuildingASkillTest extends AbstractSkillTest {
|
|
|
24
24
|
|
|
25
25
|
@test()
|
|
26
26
|
protected static async handlesError() {
|
|
27
|
-
|
|
27
|
+
CommandServiceImpl.fakeCommand('yarn rebuild', { code: 1 })
|
|
28
28
|
|
|
29
29
|
const results = await this.Action('skill', 'rebuild').execute({
|
|
30
30
|
shouldPlayGames: false,
|
|
@@ -2,7 +2,7 @@ import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
3
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
4
4
|
import '@sprucelabs/spruce-store-plugin'
|
|
5
|
-
import
|
|
5
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
6
6
|
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
7
7
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
8
8
|
|
|
@@ -159,11 +159,11 @@ export default class CreatingDataStoresTest extends AbstractSkillTest {
|
|
|
159
159
|
|
|
160
160
|
@test()
|
|
161
161
|
protected static async upgradeRestoresDataStoreTypes() {
|
|
162
|
-
|
|
162
|
+
CommandServiceImpl.fakeCommand('yarn rebuild', {
|
|
163
163
|
code: 0,
|
|
164
164
|
})
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
CommandServiceImpl.fakeCommand(/yarn add/gis, {
|
|
167
167
|
code: 0,
|
|
168
168
|
})
|
|
169
169
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
import { assert } from '@sprucelabs/test-utils'
|
|
3
|
+
import CreateAction from '../../../../features/test/actions/CreateAction'
|
|
4
|
+
import AbstractSkillTest from '../../../../tests/AbstractSkillTest'
|
|
5
|
+
import testUtil from '../../../../tests/utilities/test.utility'
|
|
6
|
+
|
|
7
|
+
export default abstract class AbstractInstanceTest extends AbstractSkillTest {
|
|
8
|
+
protected static skillCacheKey = 'tests'
|
|
9
|
+
protected static action: CreateAction
|
|
10
|
+
|
|
11
|
+
protected static async beforeEach() {
|
|
12
|
+
await super.beforeEach()
|
|
13
|
+
|
|
14
|
+
this.action = this.Action('test', 'create')
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected static async createTest(
|
|
18
|
+
name: string,
|
|
19
|
+
willPromptForSubDir = false
|
|
20
|
+
) {
|
|
21
|
+
const promise = this.action.execute({
|
|
22
|
+
type: 'behavioral',
|
|
23
|
+
nameReadable: name,
|
|
24
|
+
nameCamel: namesUtil.toCamel(name),
|
|
25
|
+
namePascal: namesUtil.toPascal(name),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
await this.ui.waitForInput()
|
|
29
|
+
await this.ui.sendInput('')
|
|
30
|
+
|
|
31
|
+
if (willPromptForSubDir) {
|
|
32
|
+
await this.ui.waitForInput()
|
|
33
|
+
await this.ui.sendInput('')
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const results = await promise
|
|
37
|
+
|
|
38
|
+
assert.isFalsy(results.errors, 'Error creating test')
|
|
39
|
+
return results
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected static async createTestAndAssertContentsEqual(
|
|
43
|
+
name: string,
|
|
44
|
+
expected: string,
|
|
45
|
+
|
|
46
|
+
willPromptForSubDir = false
|
|
47
|
+
) {
|
|
48
|
+
const testFile = await this.createTestAndGetCreatedFilePath(
|
|
49
|
+
name,
|
|
50
|
+
willPromptForSubDir
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
const contents = diskUtil.readFile(testFile)
|
|
54
|
+
assert.isEqual(
|
|
55
|
+
this.normalizeWhitespace(contents),
|
|
56
|
+
this.normalizeWhitespace(expected),
|
|
57
|
+
'Instance test does not match expected'
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
protected static async createTestAndGetCreatedFilePath(
|
|
62
|
+
name: string,
|
|
63
|
+
willPromptForSubDir = false
|
|
64
|
+
) {
|
|
65
|
+
const results = await this.createTest(name, willPromptForSubDir)
|
|
66
|
+
|
|
67
|
+
const testFile = testUtil.assertFileByNameInGeneratedFiles(
|
|
68
|
+
`${namesUtil.toPascal(name)}.test.ts`,
|
|
69
|
+
results.files
|
|
70
|
+
)
|
|
71
|
+
return testFile
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
protected static normalizeWhitespace(contents: string) {
|
|
75
|
+
return contents.replace(/\s/g, '')
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { test } from '@sprucelabs/test-utils'
|
|
2
|
+
import AbstractInstanceTest from './AbstractInstanceTest'
|
|
3
|
+
import { generateExpectedInstanceTestContents } from './testFileContentsGenerators'
|
|
4
|
+
|
|
5
|
+
export default class InstanceBasedTestingTest extends AbstractInstanceTest {
|
|
6
|
+
@test()
|
|
7
|
+
protected static async ifNoTestsExistCreatesInstanceTest() {
|
|
8
|
+
const name = 'My First Test'
|
|
9
|
+
const expected = generateExpectedInstanceTestContents(name)
|
|
10
|
+
await this.createTestAndAssertContentsEqual(name, expected)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@test()
|
|
14
|
+
protected static async secondTestAlsoInstance() {
|
|
15
|
+
const name = 'My Second Test'
|
|
16
|
+
const expected = generateExpectedInstanceTestContents(name)
|
|
17
|
+
await this.createTestAndAssertContentsEqual(name, expected, true)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
|
+
import MigrationAction from '../../../../features/test/actions/MigrateAction'
|
|
3
|
+
import AbstractSkillTest from '../../../../tests/AbstractSkillTest'
|
|
4
|
+
import StaticToInstanceMigratorImpl, {
|
|
5
|
+
StaticToInstanceMigrator,
|
|
6
|
+
StaticToInstanceMigratorOptions,
|
|
7
|
+
StaticToInstanceMigratorResults,
|
|
8
|
+
} from '../../../../tests/staticToInstanceMigration/StaticToInstanceMigrator'
|
|
9
|
+
|
|
10
|
+
export default class MigratingTestsTest extends AbstractSkillTest {
|
|
11
|
+
private static action: MigrationAction
|
|
12
|
+
protected static skillCacheKey = 'tests'
|
|
13
|
+
|
|
14
|
+
protected static async beforeEach() {
|
|
15
|
+
await super.beforeEach()
|
|
16
|
+
StaticToInstanceMigratorImpl.Class = FakeStaticToInstanceMigrator
|
|
17
|
+
this.action = this.Action('test', 'migrate')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@test()
|
|
21
|
+
protected static async hasMigrateAction() {
|
|
22
|
+
assert.isFunction(this.Action('test', 'migrate').execute)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@test()
|
|
26
|
+
protected static async migrateCreatsMigrator() {
|
|
27
|
+
const results = await this.execute()
|
|
28
|
+
assert.isFalsy(results.errors)
|
|
29
|
+
assert.isTruthy(this.migrator, 'Migrator not created')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@test()
|
|
33
|
+
protected static async migratorRunsMigratePassingLookupDir() {
|
|
34
|
+
await this.execute()
|
|
35
|
+
this.migrator.assertLookupCalledWith(
|
|
36
|
+
this.resolvePath('src', '__tests__')
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@test('returns results from migrator 1', 1, 1)
|
|
41
|
+
@test('returns results from migrator 2', 2, 3)
|
|
42
|
+
protected static async returnsResultsFromMigrator(
|
|
43
|
+
totalTestsSkipped: number,
|
|
44
|
+
totalTestsUpdated: number
|
|
45
|
+
) {
|
|
46
|
+
FakeStaticToInstanceMigrator.runResults = {
|
|
47
|
+
totalTestsSkipped,
|
|
48
|
+
totalTestsUpdated,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const results = await this.execute()
|
|
52
|
+
assert.isEqualDeep(results, {
|
|
53
|
+
headline: 'Migrated tests from static to instance based.',
|
|
54
|
+
summaryLines: [
|
|
55
|
+
`${totalTestsUpdated} test${totalTestsUpdated === 1 ? '' : 's'} updated`,
|
|
56
|
+
`${totalTestsSkipped} test${totalTestsSkipped === 1 ? '' : 's'} skipped`,
|
|
57
|
+
],
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private static get migrator(): FakeStaticToInstanceMigrator {
|
|
62
|
+
return FakeStaticToInstanceMigrator.instance
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private static async execute() {
|
|
66
|
+
return await this.action.execute()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class FakeStaticToInstanceMigrator implements StaticToInstanceMigrator {
|
|
71
|
+
public static instance: FakeStaticToInstanceMigrator
|
|
72
|
+
private passedLookupDir?: string
|
|
73
|
+
public static runResults?: StaticToInstanceMigratorResults
|
|
74
|
+
|
|
75
|
+
public constructor(_options: StaticToInstanceMigratorOptions) {
|
|
76
|
+
FakeStaticToInstanceMigrator.instance = this
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public async run(
|
|
80
|
+
lookupDir: string
|
|
81
|
+
): Promise<StaticToInstanceMigratorResults> {
|
|
82
|
+
this.passedLookupDir = lookupDir
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
FakeStaticToInstanceMigrator.runResults ?? {
|
|
86
|
+
totalTestsUpdated: 0,
|
|
87
|
+
totalTestsSkipped: 0,
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public assertLookupCalledWith(expected: string) {
|
|
93
|
+
assert.isEqual(
|
|
94
|
+
this.passedLookupDir,
|
|
95
|
+
expected,
|
|
96
|
+
`Migrator.run was not called with expected lookup dir.`
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
}
|