@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,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 uiAssert from '../../../tests/utilities/uiAssert.utility'
|
|
6
6
|
|
|
@@ -16,9 +16,9 @@ export default class UpgradingANodeModuleTest extends AbstractCliTest {
|
|
|
16
16
|
|
|
17
17
|
@test()
|
|
18
18
|
protected static async buildErrorsGetPassedThroughToResults() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
CommandServiceImpl.fakeCommand(/yarn (add|install)/gis, { code: 0 })
|
|
20
|
+
CommandServiceImpl.fakeCommand(/yarn clean.build/gis, { code: 1 })
|
|
21
|
+
CommandServiceImpl.fakeCommand(/yarn build.dev/gis, { code: 0 })
|
|
22
22
|
|
|
23
23
|
await this.emitter.on('feature.did-execute', () => {
|
|
24
24
|
return {
|
|
@@ -33,7 +33,7 @@ export default class UpgradingANodeModuleTest extends AbstractCliTest {
|
|
|
33
33
|
|
|
34
34
|
@test()
|
|
35
35
|
protected static async upgradingWritesExpectedFiles() {
|
|
36
|
-
|
|
36
|
+
CommandServiceImpl.fakeCommand(/build/gis, { code: 0 })
|
|
37
37
|
|
|
38
38
|
const shouldNotBeFound = [
|
|
39
39
|
'src/.spruce/skill.ts',
|
|
@@ -58,7 +58,7 @@ export default class UpgradingANodeModuleTest extends AbstractCliTest {
|
|
|
58
58
|
diskUtil.writeFile(tsConfig, 'beenChanged')
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
CommandServiceImpl.fakeCommand(/yarn/gi, {
|
|
62
62
|
code: 0,
|
|
63
63
|
})
|
|
64
64
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HASH_SPRUCE_DIR, diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
2
|
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
3
|
-
import
|
|
3
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
4
4
|
import PkgService from '../../../services/PkgService'
|
|
5
5
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
6
6
|
import ScriptUpdaterImpl, {
|
|
@@ -61,7 +61,7 @@ export default class UpgradingANonSpruceNodeModuleTest extends AbstractCliTest {
|
|
|
61
61
|
|
|
62
62
|
let wasHit = false
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
CommandServiceImpl.fakeCommand(/yarn.*?-W/, {
|
|
65
65
|
code: 0,
|
|
66
66
|
callback: () => {
|
|
67
67
|
wasHit = true
|
|
@@ -79,7 +79,7 @@ export default class UpgradingANonSpruceNodeModuleTest extends AbstractCliTest {
|
|
|
79
79
|
|
|
80
80
|
const commands: string[] = []
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
CommandServiceImpl.fakeCommand(/yarn.*?add .*/gis, {
|
|
83
83
|
code: 0,
|
|
84
84
|
callback: (command, args) => {
|
|
85
85
|
commands.push([command, ...args].join(' '))
|
|
@@ -107,7 +107,7 @@ export default class UpgradingANonSpruceNodeModuleTest extends AbstractCliTest {
|
|
|
107
107
|
protected static async runsUpgradeInEveryPackageInWorkspace() {
|
|
108
108
|
this.setWorkspaces(['packages/*'])
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
CommandServiceImpl.clearFakedResponses()
|
|
111
111
|
|
|
112
112
|
const moduleName = 'test1'
|
|
113
113
|
const path = this.resolvePath('packages', moduleName)
|
|
@@ -3,7 +3,7 @@ import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
|
3
3
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
4
4
|
import SyncAction from '../../../features/error/actions/SyncAction'
|
|
5
5
|
import UpdateDependenciesAction from '../../../features/node/actions/UpdateDependenciesAction'
|
|
6
|
-
import
|
|
6
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
7
7
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
8
8
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
9
9
|
export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
@@ -17,14 +17,14 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
await super.beforeEach()
|
|
20
|
-
|
|
20
|
+
CommandServiceImpl.fakeCommand(new RegExp(/yarn rebuild/gis), {
|
|
21
21
|
code: 0,
|
|
22
22
|
})
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
@test()
|
|
26
26
|
protected static async doesNotAddResolvePathAliasesToDependenciesAfterUpgrade() {
|
|
27
|
-
|
|
27
|
+
CommandServiceImpl.clearFakedResponses()
|
|
28
28
|
await this.FeatureFixture().installCachedFeatures('views')
|
|
29
29
|
|
|
30
30
|
await this.Action('node', 'upgrade').execute({})
|
|
@@ -36,7 +36,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
36
36
|
|
|
37
37
|
@test()
|
|
38
38
|
protected static async featuresNotEnabledDontInstall() {
|
|
39
|
-
|
|
39
|
+
CommandServiceImpl.clearFakedResponses()
|
|
40
40
|
await this.FeatureFixture().installCachedFeatures('schemas')
|
|
41
41
|
|
|
42
42
|
const results = await this.Action('node', 'upgrade').execute({})
|
|
@@ -93,7 +93,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
93
93
|
return {}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
CommandServiceImpl.fakeCommand('yarn clean.build', {
|
|
97
97
|
code: 0,
|
|
98
98
|
callback: () => {
|
|
99
99
|
wasCleanBuildCalled = true
|
|
@@ -102,7 +102,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
102
102
|
|
|
103
103
|
let wasBuildDevCalled = false
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
CommandServiceImpl.fakeCommand('yarn build.dev', {
|
|
106
106
|
code: 0,
|
|
107
107
|
callback: () => {
|
|
108
108
|
wasBuildDevCalled = true
|
|
@@ -217,17 +217,17 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
217
217
|
private static disableCleanBuildAndYarnAdd() {
|
|
218
218
|
this.disableCleanAndBuild()
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
CommandServiceImpl.fakeCommand(/yarn.*?add/gis, {
|
|
221
221
|
code: 0,
|
|
222
222
|
})
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
private static disableCleanAndBuild() {
|
|
226
|
-
|
|
226
|
+
CommandServiceImpl.fakeCommand('yarn clean.build', {
|
|
227
227
|
code: 0,
|
|
228
228
|
})
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
CommandServiceImpl.fakeCommand('yarn build.dev', {
|
|
231
231
|
code: 0,
|
|
232
232
|
})
|
|
233
233
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import fsUtil from 'fs'
|
|
2
2
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
3
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
4
|
-
import
|
|
4
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
5
5
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
6
6
|
|
|
7
7
|
export default class UpgradingASkill4Test extends AbstractCliTest {
|
|
8
8
|
protected static async beforeEach() {
|
|
9
9
|
await super.beforeEach()
|
|
10
|
-
|
|
10
|
+
CommandServiceImpl.fakeCommand(new RegExp(/rebuild/gis), {
|
|
11
11
|
code: 0,
|
|
12
12
|
})
|
|
13
13
|
}
|
|
@@ -49,8 +49,8 @@ export default class UpgradingASkill4Test extends AbstractCliTest {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
CommandServiceImpl.fakeCommand(/yarn clean/, { code: 0 })
|
|
53
|
+
CommandServiceImpl.fakeCommand(/yarn build.dev/, { code: 0 })
|
|
54
54
|
|
|
55
55
|
await this.Action('node', 'upgrade').execute({})
|
|
56
56
|
|
|
@@ -2,7 +2,7 @@ import { Schema } from '@sprucelabs/schema'
|
|
|
2
2
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
3
3
|
import ActionFactory from '../../../features/ActionFactory'
|
|
4
4
|
import { FeatureAction } from '../../../features/features.types'
|
|
5
|
-
import
|
|
5
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
6
6
|
import LintService from '../../../services/LintService'
|
|
7
7
|
import ServiceFactory from '../../../services/ServiceFactory'
|
|
8
8
|
import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
@@ -50,7 +50,7 @@ export default class UpgradingASkill5Test extends AbstractCliTest {
|
|
|
50
50
|
) {
|
|
51
51
|
await this.FeatureFixture().installCachedFeatures('schemas')
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
CommandServiceImpl.fakeCommand(new RegExp(/yarn/gis), {
|
|
54
54
|
code: 0,
|
|
55
55
|
})
|
|
56
56
|
|
|
@@ -93,7 +93,7 @@ export default class UpgradingASkill5Test extends AbstractCliTest {
|
|
|
93
93
|
let wasMovedBackToDev = false
|
|
94
94
|
let wasMovedBackToProd = false
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
CommandServiceImpl.fakeCommand(new RegExp(/yarn/gis), {
|
|
97
97
|
code: 0,
|
|
98
98
|
callback: (_, args) => {
|
|
99
99
|
if (
|
|
@@ -126,7 +126,7 @@ export default class UpgradingASkill5Test extends AbstractCliTest {
|
|
|
126
126
|
|
|
127
127
|
ServiceFactory.setFactoryClass('lint', SpyLintService)
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
CommandServiceImpl.fakeCommand(/.*/gi, {
|
|
130
130
|
code: 0,
|
|
131
131
|
callback: (command, args) => {
|
|
132
132
|
this.invocationLog.push([command, ...args].join(' '))
|
|
@@ -47,7 +47,6 @@ export default class ResolvingVersionsTest extends AbstractSkillTest {
|
|
|
47
47
|
|
|
48
48
|
@test()
|
|
49
49
|
protected static async addsVersionFromPackageJsonWhenChoosingDifferentVersion() {
|
|
50
|
-
debugger
|
|
51
50
|
await this.resolveAndAssertChoices([
|
|
52
51
|
this.newVersionChoice,
|
|
53
52
|
this.buildVersionChoice('v2023_09_16'),
|
|
@@ -56,9 +55,8 @@ export default class ResolvingVersionsTest extends AbstractSkillTest {
|
|
|
56
55
|
|
|
57
56
|
@test()
|
|
58
57
|
protected static async doesNotAddVersionToChoicesIfDirMatchesVersion() {
|
|
59
|
-
debugger
|
|
60
58
|
this.createVersionDir('v2023_09_16')
|
|
61
|
-
|
|
59
|
+
|
|
62
60
|
await this.resolveAndAssertChoices([
|
|
63
61
|
this.newVersionChoice,
|
|
64
62
|
this.buildVersionChoice('v2023_09_16'),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
2
|
import WatchAction from '../../../features/view/actions/WatchAction'
|
|
3
|
-
import
|
|
3
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
4
4
|
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
5
5
|
|
|
6
6
|
export default class WatchingSkillViewsTest extends AbstractSkillTest {
|
|
@@ -21,7 +21,7 @@ export default class WatchingSkillViewsTest extends AbstractSkillTest {
|
|
|
21
21
|
@test()
|
|
22
22
|
protected static async shouldCallBoot() {
|
|
23
23
|
let wasHit = false
|
|
24
|
-
|
|
24
|
+
CommandServiceImpl.fakeCommand(
|
|
25
25
|
'SHOULD_WATCH_VIEWS=true MAXIMUM_LOG_PREFIXES_LENGTH=0 yarn boot',
|
|
26
26
|
{
|
|
27
27
|
code: 200,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
FeatureActionResponse,
|
|
6
6
|
FeatureInstallResponse,
|
|
7
7
|
} from '../../features/features.types'
|
|
8
|
-
import
|
|
8
|
+
import CommandServiceImpl from '../../services/CommandService'
|
|
9
9
|
import AbstractSchemaTest from '../../tests/AbstractSchemaTest'
|
|
10
10
|
import testUtil from '../../tests/utilities/test.utility'
|
|
11
11
|
|
|
@@ -273,7 +273,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
private static fakeInstallCommands() {
|
|
276
|
-
|
|
276
|
+
CommandServiceImpl.fakeCommand(new RegExp(/yarn|npm/gis), {
|
|
277
277
|
code: 0,
|
|
278
278
|
})
|
|
279
279
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
2
|
import { errorAssert } from '@sprucelabs/test-utils'
|
|
3
3
|
import { ENABLE_NPM_CACHE_COMMAND } from '../../features/cache/constants'
|
|
4
|
-
import
|
|
4
|
+
import CommandServiceImpl from '../../services/CommandService'
|
|
5
5
|
import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
6
6
|
|
|
7
7
|
export default class ActionExecuter4Test extends AbstractCliTest {
|
|
8
8
|
protected static async beforeEach() {
|
|
9
9
|
await super.beforeEach()
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
CommandServiceImpl.fakeCommand(/which docker/gis, {
|
|
12
12
|
code: 0,
|
|
13
13
|
})
|
|
14
|
-
|
|
14
|
+
CommandServiceImpl.fakeCommand(ENABLE_NPM_CACHE_COMMAND, {
|
|
15
15
|
code: 0,
|
|
16
16
|
})
|
|
17
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test-utils'
|
|
2
2
|
import FeatureInstaller from '../../features/FeatureInstaller'
|
|
3
|
-
import
|
|
3
|
+
import CommandServiceImpl from '../../services/CommandService'
|
|
4
4
|
import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
5
5
|
|
|
6
6
|
export default class FeatureInstallerTest extends AbstractCliTest {
|
|
@@ -28,7 +28,7 @@ export default class FeatureInstallerTest extends AbstractCliTest {
|
|
|
28
28
|
|
|
29
29
|
@test()
|
|
30
30
|
protected static async afterPackageInstallIsCalledOncePerFeature() {
|
|
31
|
-
|
|
31
|
+
CommandServiceImpl.fakeCommand(/yarn/, {
|
|
32
32
|
code: 0,
|
|
33
33
|
})
|
|
34
34
|
|
|
@@ -26,7 +26,9 @@ export default class OrganizationStoreTest extends AbstractCliTest {
|
|
|
26
26
|
assert.isFalse(isInstalled)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
@test(
|
|
29
|
+
@test.skip(
|
|
30
|
+
'conflicting with "InstallingASkillAtAnOrg which is deleting orgs'
|
|
31
|
+
)
|
|
30
32
|
protected static async canDeleteOrg() {
|
|
31
33
|
await this.FeatureFixture().installCachedFeatures('organizations')
|
|
32
34
|
|
|
@@ -68,7 +70,9 @@ export default class OrganizationStoreTest extends AbstractCliTest {
|
|
|
68
70
|
assert.isTrue(isInstalled)
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
@test(
|
|
73
|
+
@test.skip(
|
|
74
|
+
'is conflicting with "InstallingASkillAtAnOrg" which is deleting orgs'
|
|
75
|
+
)
|
|
72
76
|
protected static async canGetMyOrgs() {
|
|
73
77
|
await this.FeatureFixture().installCachedFeatures('organizations')
|
|
74
78
|
|
|
@@ -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 PkgService from '../../services/PkgService'
|
|
5
5
|
import AbstractSkillTest from '../../tests/AbstractSkillTest'
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ export default class PkgServiceTest extends AbstractSkillTest {
|
|
|
26
26
|
|
|
27
27
|
@test()
|
|
28
28
|
protected static async handlesAtLatestInName() {
|
|
29
|
-
|
|
29
|
+
CommandServiceImpl.fakeCommand(new RegExp(/yarn/gis), {
|
|
30
30
|
code: 0,
|
|
31
31
|
})
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ export default class PkgServiceTest extends AbstractSkillTest {
|
|
|
37
37
|
|
|
38
38
|
@test()
|
|
39
39
|
protected static async ifInstallingOnlySpruceModulesShouldNotRunNPMAdd() {
|
|
40
|
-
|
|
40
|
+
CommandServiceImpl.fakeCommand(
|
|
41
41
|
new RegExp(/npm.*?install.*?--no-progress/gis),
|
|
42
42
|
{
|
|
43
43
|
code: 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
|
5
5
|
export default class StoreFeatureTest extends AbstractCliTest {
|
|
@@ -7,7 +7,7 @@ export default class StoreFeatureTest extends AbstractCliTest {
|
|
|
7
7
|
protected static async syncsOnWillExecute() {
|
|
8
8
|
await this.FeatureFixture().installCachedFeatures('stores')
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
CommandServiceImpl.fakeCommand(/yarn/, {
|
|
11
11
|
code: 0,
|
|
12
12
|
})
|
|
13
13
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { fake } from '@sprucelabs/spruce-test-fixtures'
|
|
2
|
+
import AbstractSpruceTest, {
|
|
3
|
+
test,
|
|
4
|
+
assert,
|
|
5
|
+
errorAssert,
|
|
6
|
+
} from '@sprucelabs/test-utils'
|
|
7
|
+
|
|
8
|
+
@fake.login()
|
|
9
|
+
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
10
|
+
@test()
|
|
11
|
+
protected static async throwsWithMissing() {
|
|
12
|
+
const finder = StaticTestFinder.Finder()
|
|
13
|
+
const err = await assert.doesThrowAsync(() => finder.find())
|
|
14
|
+
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
15
|
+
parameters: ['lookupDir'],
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@test()
|
|
20
|
+
protected static async yourNextTest() {
|
|
21
|
+
assert.isTrue(false)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class StaticTestFinder {
|
|
26
|
+
public static Finder() {
|
|
27
|
+
return new this()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async find() {
|
|
31
|
+
// assertOptions({}, ['lookupDir'])
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/ShouldBeIgnored.ts
ADDED
|
File without changes
|
package/src/__tests__/testDirsAndFiles/static_test_migration_1/src/__tests__/StaticTest1.test.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { fake } from '@sprucelabs/spruce-test-fixtures'
|
|
2
|
+
import AbstractSpruceTest, {
|
|
3
|
+
test,
|
|
4
|
+
assert,
|
|
5
|
+
errorAssert,
|
|
6
|
+
} from '@sprucelabs/test-utils'
|
|
7
|
+
|
|
8
|
+
@fake.login()
|
|
9
|
+
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
10
|
+
@test()
|
|
11
|
+
protected static async throwsWithMissing() {
|
|
12
|
+
const finder = StaticTestFinder.Finder()
|
|
13
|
+
const err = await assert.doesThrowAsync(() => finder.find())
|
|
14
|
+
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
15
|
+
parameters: ['lookupDir'],
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@test()
|
|
20
|
+
protected static async yourNextTest() {
|
|
21
|
+
assert.isTrue(false)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class StaticTestFinder {
|
|
26
|
+
public static Finder() {
|
|
27
|
+
return new this()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async find() {
|
|
31
|
+
// assertOptions({}, ['lookupDir'])
|
|
32
|
+
}
|
|
33
|
+
}
|
|
File without changes
|
package/src/__tests__/testDirsAndFiles/static_test_migration_2/src/__tests__/AStaticTest.test.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { fake } from '@sprucelabs/spruce-test-fixtures'
|
|
2
|
+
import AbstractSpruceTest, {
|
|
3
|
+
test,
|
|
4
|
+
assert,
|
|
5
|
+
errorAssert,
|
|
6
|
+
} from '@sprucelabs/test-utils'
|
|
7
|
+
|
|
8
|
+
@fake.login()
|
|
9
|
+
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
10
|
+
@test()
|
|
11
|
+
protected static async throwsWithMissing() {
|
|
12
|
+
const finder = StaticTestFinder.Finder()
|
|
13
|
+
const err = await assert.doesThrowAsync(() => finder.find())
|
|
14
|
+
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
15
|
+
parameters: ['lookupDir'],
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@test()
|
|
20
|
+
protected static async yourNextTest() {
|
|
21
|
+
assert.isTrue(false)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class StaticTestFinder {
|
|
26
|
+
public static Finder() {
|
|
27
|
+
return new this()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async find() {
|
|
31
|
+
// assertOptions({}, ['lookupDir'])
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { fake } from '@sprucelabs/spruce-test-fixtures'
|
|
2
|
+
import AbstractSpruceTest, {
|
|
3
|
+
test,
|
|
4
|
+
assert,
|
|
5
|
+
errorAssert,
|
|
6
|
+
} from '@sprucelabs/test-utils'
|
|
7
|
+
|
|
8
|
+
@fake.login()
|
|
9
|
+
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
10
|
+
@test()
|
|
11
|
+
protected static async throwsWithMissing() {
|
|
12
|
+
const finder = StaticTestFinder.Finder()
|
|
13
|
+
const err = await assert.doesThrowAsync(() => finder.find())
|
|
14
|
+
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
15
|
+
parameters: ['lookupDir'],
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@test()
|
|
20
|
+
protected static async yourNextTest() {
|
|
21
|
+
assert.isTrue(false)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class StaticTestFinder {
|
|
26
|
+
public static Finder() {
|
|
27
|
+
return new this()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async find() {
|
|
31
|
+
// assertOptions({}, ['lookupDir'])
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/__tests__/testDirsAndFiles/static_test_migration_3/NotAFileThatShouldBeMigrated.ts
ADDED
|
File without changes
|
package/src/__tests__/testDirsAndFiles/static_test_migration_3/src/__tests__/AStaticTest2.test.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fake } from "@sprucelabs/spruce-test-fixtures";
|
|
2
|
+
import {
|
|
3
|
+
test,
|
|
4
|
+
assert,
|
|
5
|
+
} from "@sprucelabs/test-utils";
|
|
6
|
+
import AbstractWhateverTest from "./AbstractWhateverTest";
|
|
7
|
+
|
|
8
|
+
@fake.login()
|
|
9
|
+
export default class StaticTestFinderTest extends AbstractWhateverTest {
|
|
10
|
+
@test()
|
|
11
|
+
protected static async throwsWithMissing() {}
|
|
12
|
+
|
|
13
|
+
@test()
|
|
14
|
+
protected static async yourNextTest() {
|
|
15
|
+
assert.isTrue(false);
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/boot.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { CLI_HERO } from './constants'
|
|
|
7
7
|
import { FeatureInstallerImpl } from './features/FeatureInstaller'
|
|
8
8
|
import InFlightEntertainment from './InFlightEntertainment'
|
|
9
9
|
import TerminalInterface from './interfaces/TerminalInterface'
|
|
10
|
-
import
|
|
10
|
+
import CommandServiceImpl from './services/CommandService'
|
|
11
11
|
|
|
12
12
|
export async function run(argv: string[] = []): Promise<void> {
|
|
13
13
|
const program = new Command()
|
|
@@ -73,7 +73,7 @@ async function setupInFlightEntertainment(ui: TerminalInterface) {
|
|
|
73
73
|
TerminalInterface.doesSupportColor() &&
|
|
74
74
|
process.env.ENABLE_INSTALL_ENTERTAINMENT !== 'false'
|
|
75
75
|
) {
|
|
76
|
-
const command = new
|
|
76
|
+
const command = new CommandServiceImpl(
|
|
77
77
|
diskUtil.resolvePath(__dirname, '../')
|
|
78
78
|
)
|
|
79
79
|
InFlightEntertainment.setup({ command, ui })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SpruceSchemas } from '#spruce/schemas/schemas.types'
|
|
2
2
|
import bootSkillOptionsSchema from '#spruce/schemas/spruceCli/v2020_07_22/bootSkillOptions.schema'
|
|
3
3
|
import SpruceError from '../../../errors/SpruceError'
|
|
4
|
-
import
|
|
4
|
+
import CommandServiceImpl from '../../../services/CommandService'
|
|
5
5
|
import AbstractAction from '../../AbstractAction'
|
|
6
6
|
import { FeatureActionResponse } from '../../features.types'
|
|
7
7
|
|
|
@@ -64,7 +64,7 @@ export default class BootAction extends AbstractAction<OptionsSchema> {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
private async boot(
|
|
67
|
-
command:
|
|
67
|
+
command: CommandServiceImpl,
|
|
68
68
|
script: string,
|
|
69
69
|
resolve: (value: unknown) => void,
|
|
70
70
|
reject: (reason?: any) => void
|
|
@@ -7,19 +7,19 @@ import {
|
|
|
7
7
|
import { buildSchema } from '@sprucelabs/schema'
|
|
8
8
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
9
9
|
import SpruceError from '../../errors/SpruceError'
|
|
10
|
-
import
|
|
10
|
+
import CommandServiceImpl from '../../services/CommandService'
|
|
11
11
|
import JestJsonParser from '../../tests/JestJsonParser'
|
|
12
12
|
import { SpruceTestResults } from './test.types'
|
|
13
13
|
|
|
14
14
|
export default class TestRunner extends AbstractEventEmitter<TestRunnerContract> {
|
|
15
15
|
private cwd: string
|
|
16
|
-
private commandService:
|
|
16
|
+
private commandService: CommandServiceImpl
|
|
17
17
|
private wasKilled = false
|
|
18
18
|
private testResults: SpruceTestResults = { totalTestFiles: 0 }
|
|
19
19
|
|
|
20
20
|
public constructor(options: {
|
|
21
21
|
cwd: string
|
|
22
|
-
commandService:
|
|
22
|
+
commandService: CommandServiceImpl
|
|
23
23
|
}) {
|
|
24
24
|
super(testRunnerContract)
|
|
25
25
|
this.cwd = options.cwd
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import pathUtil from 'path'
|
|
2
|
+
import globby from '@sprucelabs/globby'
|
|
2
3
|
import { namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
4
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
4
5
|
import { SpruceSchemas } from '#spruce/schemas/schemas.types'
|
|
@@ -51,6 +52,9 @@ export default class CreateAction extends AbstractAction<OptionsSchema> {
|
|
|
51
52
|
'devDependencies.@sprucelabs/spruce-test-fixtures'
|
|
52
53
|
)
|
|
53
54
|
|
|
55
|
+
let doesStaticTestExist =
|
|
56
|
+
await this.doesStaticTestAlreadyExist(resolvedDestination)
|
|
57
|
+
|
|
54
58
|
const results = await writer.writeTest(resolvedDestination, {
|
|
55
59
|
...normalizedOptions,
|
|
56
60
|
type,
|
|
@@ -58,6 +62,7 @@ export default class CreateAction extends AbstractAction<OptionsSchema> {
|
|
|
58
62
|
parentTestClass,
|
|
59
63
|
isTestFixturesInstalled,
|
|
60
64
|
namePascal: namePascal ?? namesUtil.toPascal(nameCamel),
|
|
65
|
+
testType: doesStaticTestExist ? 'static' : 'instance',
|
|
61
66
|
})
|
|
62
67
|
|
|
63
68
|
return {
|
|
@@ -66,6 +71,18 @@ export default class CreateAction extends AbstractAction<OptionsSchema> {
|
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
|
|
74
|
+
private async doesStaticTestAlreadyExist(resolvedDestination: string) {
|
|
75
|
+
const matches = await globby(resolvedDestination + `/**/*.test.ts`)
|
|
76
|
+
let doesStaticTestExist = false
|
|
77
|
+
|
|
78
|
+
const match = matches[0]
|
|
79
|
+
if (match) {
|
|
80
|
+
const contents = diskUtil.readFile(matches[0])
|
|
81
|
+
doesStaticTestExist = contents.includes('static')
|
|
82
|
+
}
|
|
83
|
+
return doesStaticTestExist
|
|
84
|
+
}
|
|
85
|
+
|
|
69
86
|
private async promptForSubDir(resolvedDestination: string) {
|
|
70
87
|
const match = await this.ui.prompt({
|
|
71
88
|
type: 'directory',
|