@sprucelabs/spruce-cli 14.26.18 → 14.28.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 +38 -0
- package/build/.spruce/errors/errors.types.d.ts +19 -0
- package/build/.spruce/errors/options.types.d.ts +4 -1
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.d.ts +3 -0
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js +28 -0
- package/build/.spruce/errors/spruceCli/dependencyExists.schema.js.map +1 -0
- package/build/__tests__/behavioral/AddingADependency.test.d.ts +6 -3
- package/build/__tests__/behavioral/AddingADependency.test.js +116 -44
- package/build/__tests__/behavioral/AddingADependency.test.js.map +1 -1
- package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js +2 -2
- package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +1 -1
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js +4 -4
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/ManagingDependencies.test.js +3 -3
- package/build/__tests__/behavioral/ManagingDependencies.test.js.map +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js +1 -1
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingRemote.test.js +1 -1
- package/build/__tests__/behavioral/SettingRemote.test.js.map +1 -1
- package/build/__tests__/behavioral/SettingUpVscode.test.js +3 -3
- package/build/__tests__/behavioral/SettingUpVscode.test.js.map +1 -1
- package/build/__tests__/behavioral/TestingDataStores.test.js +2 -2
- package/build/__tests__/behavioral/TestingDataStores.test.js.map +1 -1
- package/build/__tests__/behavioral/UpgradingANodeModule.test.d.ts +1 -0
- package/build/__tests__/behavioral/UpgradingANodeModule.test.js +50 -3
- package/build/__tests__/behavioral/UpgradingANodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +2 -2
- package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.d.ts +3 -2
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.js +156 -106
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.js.map +1 -1
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +6 -9
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js.map +1 -1
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js +7 -4
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill.test.js +7 -7
- package/build/__tests__/behavioral/skill/UpgradingASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/skill/UpgradingASkill3.test.js +2 -2
- package/build/__tests__/behavioral/skill/UpgradingASkill3.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +3 -3
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js +2 -2
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js +3 -3
- package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
- package/build/errors/SpruceError.js +4 -0
- package/build/errors/SpruceError.js.map +1 -1
- package/build/errors/dependencyExists.builder.d.ts +11 -0
- package/build/errors/dependencyExists.builder.js +22 -0
- package/build/errors/dependencyExists.builder.js.map +1 -0
- package/build/features/AbstractAction.js +1 -1
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/dependencies/actions/AddAction.js +22 -15
- package/build/features/dependencies/actions/AddAction.js.map +1 -1
- package/build/features/event/actions/CreateAction.js +1 -1
- package/build/features/event/actions/CreateAction.js.map +1 -1
- package/build/features/node/NodeFeature.d.ts +1 -0
- package/build/features/node/NodeFeature.js +83 -64
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/node/actions/UpgradeAction.js +20 -9
- package/build/features/node/actions/UpgradeAction.js.map +1 -1
- package/build/features/node/writers/NodeWriter.d.ts +5 -2
- package/build/features/node/writers/NodeWriter.js +37 -22
- package/build/features/node/writers/NodeWriter.js.map +1 -1
- package/build/features/skill/updaters/Updater.js +3 -1
- package/build/features/skill/updaters/Updater.js.map +1 -1
- package/build/interfaces/SpyInterface.d.ts +1 -1
- package/build/interfaces/SpyInterface.js +2 -2
- package/build/interfaces/SpyInterface.js.map +1 -1
- package/build/services/DependencyService.d.ts +1 -0
- package/build/services/DependencyService.js +18 -0
- package/build/services/DependencyService.js.map +1 -1
- package/build/tests/AbstractCliTest.js +1 -1
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/utilities/uiAssert.utility.d.ts +7 -0
- package/build/tests/utilities/uiAssert.utility.js +85 -0
- package/build/tests/utilities/uiAssert.utility.js.map +1 -0
- package/build/writers/AbstractWriter.d.ts +10 -10
- package/build/writers/AbstractWriter.js.map +1 -1
- package/package.json +34 -32
- package/src/.spruce/errors/errors.types.ts +29 -0
- package/src/.spruce/errors/options.types.ts +4 -1
- package/src/.spruce/errors/spruceCli/dependencyExists.schema.ts +22 -0
- package/src/__tests__/behavioral/AddingADependency.test.ts +45 -8
- package/src/__tests__/behavioral/InstallingASkillAtAnOrg.test.ts +3 -3
- package/src/__tests__/behavioral/LoggingInAsASkill.test.ts +4 -4
- package/src/__tests__/behavioral/ManagingDependencies.test.ts +3 -3
- package/src/__tests__/behavioral/RememberingUpgradeSelections.test.ts +1 -1
- package/src/__tests__/behavioral/SettingRemote.test.ts +1 -1
- package/src/__tests__/behavioral/SettingUpVscode.test.ts +3 -3
- package/src/__tests__/behavioral/TestingDataStores.test.ts +2 -2
- package/src/__tests__/behavioral/UpgradingANodeModule.test.ts +24 -0
- package/src/__tests__/behavioral/events/CreatingAListener.test.ts +2 -2
- package/src/__tests__/behavioral/events/CreatingAnEvent.test.ts +44 -22
- package/src/__tests__/behavioral/events/KeepingEventsInSync2.test.ts +1 -1
- package/src/__tests__/behavioral/schemas/KeepingSchemasInSync.test.ts +2 -0
- package/src/__tests__/behavioral/skill/UpgradingASkill.test.ts +7 -7
- package/src/__tests__/behavioral/skill/UpgradingASkill3.test.ts +2 -2
- package/src/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.ts +1 -1
- package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +3 -3
- package/src/__tests__/behavioral/views/TestingViewControllers.test.ts +2 -2
- package/src/__tests__/implementation/ActionExecuter2.test.ts +3 -3
- package/src/errors/SpruceError.ts +4 -0
- package/src/errors/dependencyExists.builder.ts +12 -0
- package/src/features/AbstractAction.ts +1 -4
- package/src/features/dependencies/actions/AddAction.ts +12 -5
- package/src/features/event/actions/CreateAction.ts +4 -1
- package/src/features/node/NodeFeature.ts +31 -25
- package/src/features/node/actions/UpgradeAction.ts +8 -1
- package/src/features/node/writers/NodeWriter.ts +38 -23
- package/src/features/skill/updaters/Updater.ts +2 -1
- package/src/interfaces/SpyInterface.ts +1 -1
- package/src/services/DependencyService.ts +14 -0
- package/src/tests/AbstractCliTest.ts +1 -1
- package/src/tests/utilities/uiAssert.utility.ts +45 -0
- package/src/writers/AbstractWriter.ts +15 -10
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"skill": {
|
|
8
8
|
"namespace": "spruce-cli",
|
|
9
9
|
"upgradeIgnoreList": [
|
|
10
|
+
"chalk",
|
|
10
11
|
"emphasize",
|
|
11
12
|
"gifwrap",
|
|
12
13
|
"globby",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
]
|
|
18
19
|
},
|
|
19
20
|
"license": "MIT",
|
|
20
|
-
"version": "14.
|
|
21
|
+
"version": "14.28.1",
|
|
21
22
|
"bin": {
|
|
22
23
|
"spruce": "./build/index.js"
|
|
23
24
|
},
|
|
@@ -74,26 +75,26 @@
|
|
|
74
75
|
"@babel/cli": "^7.16.0",
|
|
75
76
|
"@babel/plugin-proposal-decorators": "^7.16.4",
|
|
76
77
|
"@babel/runtime": "^7.16.3",
|
|
77
|
-
"@jest/reporters": "^27.
|
|
78
|
-
"@sprucelabs/error": "^5.0.
|
|
79
|
-
"@sprucelabs/heartwood-view-controllers": "^
|
|
80
|
-
"@sprucelabs/jest-json-reporter": "^6.0.
|
|
81
|
-
"@sprucelabs/mercury-client": "^17.
|
|
82
|
-
"@sprucelabs/mercury-event-emitter": "^17.
|
|
83
|
-
"@sprucelabs/mercury-types": "^26.1.
|
|
84
|
-
"@sprucelabs/schema": "^25.4.
|
|
85
|
-
"@sprucelabs/spruce-core-schemas": "^22.6.
|
|
86
|
-
"@sprucelabs/spruce-event-plugin": "^
|
|
87
|
-
"@sprucelabs/spruce-event-utils": "^17.1.
|
|
88
|
-
"@sprucelabs/spruce-skill-booter": "^
|
|
89
|
-
"@sprucelabs/spruce-skill-utils": "^22.
|
|
90
|
-
"@sprucelabs/spruce-templates": "^14.
|
|
78
|
+
"@jest/reporters": "^27.4.0",
|
|
79
|
+
"@sprucelabs/error": "^5.0.303",
|
|
80
|
+
"@sprucelabs/heartwood-view-controllers": "^51.4.0",
|
|
81
|
+
"@sprucelabs/jest-json-reporter": "^6.0.256",
|
|
82
|
+
"@sprucelabs/mercury-client": "^17.2.7",
|
|
83
|
+
"@sprucelabs/mercury-event-emitter": "^17.2.7",
|
|
84
|
+
"@sprucelabs/mercury-types": "^26.1.939",
|
|
85
|
+
"@sprucelabs/schema": "^25.4.39",
|
|
86
|
+
"@sprucelabs/spruce-core-schemas": "^22.6.207",
|
|
87
|
+
"@sprucelabs/spruce-event-plugin": "^15.0.4",
|
|
88
|
+
"@sprucelabs/spruce-event-utils": "^17.1.213",
|
|
89
|
+
"@sprucelabs/spruce-skill-booter": "^15.0.4",
|
|
90
|
+
"@sprucelabs/spruce-skill-utils": "^22.1.19",
|
|
91
|
+
"@sprucelabs/spruce-templates": "^14.28.1",
|
|
91
92
|
"cfonts": "^2.10.0",
|
|
92
93
|
"chalk": "^4.1.2",
|
|
93
94
|
"chokidar": "^3.5.2",
|
|
94
95
|
"cli-table3": "^0.6.0",
|
|
95
96
|
"commander": "^7.2.0",
|
|
96
|
-
"core-js": "^3.19.
|
|
97
|
+
"core-js": "^3.19.2",
|
|
97
98
|
"emphasize": "^4.2.0",
|
|
98
99
|
"fs-extra": "^10.0.0",
|
|
99
100
|
"gifwrap": "SimenB/gifwrap#patch-1",
|
|
@@ -116,16 +117,16 @@
|
|
|
116
117
|
"uuid": "^8.3.2"
|
|
117
118
|
},
|
|
118
119
|
"devDependencies": {
|
|
119
|
-
"@sprucelabs/data-stores": "^7.1.
|
|
120
|
-
"@sprucelabs/jest-sheets-reporter": "^1.2.
|
|
121
|
-
"@sprucelabs/mercury-core-events": "^1.6.
|
|
122
|
-
"@sprucelabs/resolve-path-aliases": "^1.0.
|
|
123
|
-
"@sprucelabs/spruce-conversation-plugin": "^
|
|
124
|
-
"@sprucelabs/spruce-deploy-plugin": "^
|
|
125
|
-
"@sprucelabs/spruce-store-plugin": "^
|
|
126
|
-
"@sprucelabs/spruce-test-fixtures": "^
|
|
127
|
-
"@sprucelabs/test": "^7.7.
|
|
128
|
-
"@sprucelabs/test-utils": "^3.0.
|
|
120
|
+
"@sprucelabs/data-stores": "^7.1.29",
|
|
121
|
+
"@sprucelabs/jest-sheets-reporter": "^1.2.262",
|
|
122
|
+
"@sprucelabs/mercury-core-events": "^1.6.149",
|
|
123
|
+
"@sprucelabs/resolve-path-aliases": "^1.0.231",
|
|
124
|
+
"@sprucelabs/spruce-conversation-plugin": "^15.0.4",
|
|
125
|
+
"@sprucelabs/spruce-deploy-plugin": "^15.0.4",
|
|
126
|
+
"@sprucelabs/spruce-store-plugin": "^15.0.4",
|
|
127
|
+
"@sprucelabs/spruce-test-fixtures": "^15.0.4",
|
|
128
|
+
"@sprucelabs/test": "^7.7.239",
|
|
129
|
+
"@sprucelabs/test-utils": "^3.0.285",
|
|
129
130
|
"@types/blessed": "^0.1.19",
|
|
130
131
|
"@types/eslint": "^8.2.0",
|
|
131
132
|
"@types/fs-extra": "^9.0.13",
|
|
@@ -135,7 +136,7 @@
|
|
|
135
136
|
"@types/lodash": "^4.14.177",
|
|
136
137
|
"@types/md5": "^2.3.1",
|
|
137
138
|
"@types/mkdirp": "^1.0.2",
|
|
138
|
-
"@types/node": "^16.11.
|
|
139
|
+
"@types/node": "^16.11.11",
|
|
139
140
|
"@types/promise.allsettled": "^1.0.3",
|
|
140
141
|
"@types/ps-node": "^0.1.1",
|
|
141
142
|
"@types/rimraf": "^3.0.2",
|
|
@@ -150,13 +151,13 @@
|
|
|
150
151
|
"conventional-changelog-sprucelabs": "^1.1.2",
|
|
151
152
|
"dotenv": "^10.0.0",
|
|
152
153
|
"eslint": "^8.3.0",
|
|
153
|
-
"eslint-config-spruce": "^10.10.
|
|
154
|
+
"eslint-config-spruce": "^10.10.16",
|
|
154
155
|
"find-process": "^1.4.7",
|
|
155
|
-
"jest": "^27.
|
|
156
|
-
"jest-circus": "^27.
|
|
156
|
+
"jest": "^27.4.0",
|
|
157
|
+
"jest-circus": "^27.4.0",
|
|
157
158
|
"jest-junit": "^13.0.0",
|
|
158
159
|
"jest-reporters": "^0.0.2",
|
|
159
|
-
"prettier": "^2.
|
|
160
|
+
"prettier": "^2.5.0",
|
|
160
161
|
"ps-node": "^0.1.6",
|
|
161
162
|
"rimraf": "^3.0.2",
|
|
162
163
|
"ts-jest": "^27.0.7",
|
|
@@ -584,6 +585,7 @@
|
|
|
584
585
|
},
|
|
585
586
|
"yarn-upgrade-all": {
|
|
586
587
|
"ignore": [
|
|
588
|
+
"chalk",
|
|
587
589
|
"emphasize",
|
|
588
590
|
"gifwrap",
|
|
589
591
|
"globby",
|
|
@@ -593,5 +595,5 @@
|
|
|
593
595
|
"ora"
|
|
594
596
|
]
|
|
595
597
|
},
|
|
596
|
-
"gitHead": "
|
|
598
|
+
"gitHead": "12251ed6c15100dc96eb4779bcb454b2eaa592c1"
|
|
597
599
|
}
|
|
@@ -968,6 +968,35 @@ export declare namespace SpruceErrors.SpruceCli {
|
|
|
968
968
|
|
|
969
969
|
|
|
970
970
|
|
|
971
|
+
export declare namespace SpruceErrors.SpruceCli {
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
export interface DependencyExists {
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
'namespace': string
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export interface DependencyExistsSchema extends SpruceSchema.Schema {
|
|
981
|
+
id: 'dependencyExists',
|
|
982
|
+
namespace: 'SpruceCli',
|
|
983
|
+
name: 'Dependency exists',
|
|
984
|
+
fields: {
|
|
985
|
+
/** . */
|
|
986
|
+
'namespace': {
|
|
987
|
+
type: 'text',
|
|
988
|
+
isRequired: true,
|
|
989
|
+
options: undefined
|
|
990
|
+
},
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
export type DependencyExistsEntity = SchemaEntity<SpruceErrors.SpruceCli.DependencyExistsSchema>
|
|
995
|
+
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
971
1000
|
export declare namespace SpruceErrors.SpruceCli {
|
|
972
1001
|
|
|
973
1002
|
/** Autoloader creation failed */
|
|
@@ -94,6 +94,9 @@ export interface DirectoryEmptyErrorOptions extends SpruceErrors.SpruceCli.Direc
|
|
|
94
94
|
export interface DeployFailedErrorOptions extends SpruceErrors.SpruceCli.DeployFailed, ISpruceErrorOptions {
|
|
95
95
|
code: 'DEPLOY_FAILED'
|
|
96
96
|
}
|
|
97
|
+
export interface DependencyExistsErrorOptions extends SpruceErrors.SpruceCli.DependencyExists, ISpruceErrorOptions {
|
|
98
|
+
code: 'DEPENDENCY_EXISTS'
|
|
99
|
+
}
|
|
97
100
|
export interface CreateAutoloaderFailedErrorOptions extends SpruceErrors.SpruceCli.CreateAutoloaderFailed, ISpruceErrorOptions {
|
|
98
101
|
code: 'CREATE_AUTOLOADER_FAILED'
|
|
99
102
|
}
|
|
@@ -119,6 +122,6 @@ export interface ActionCancelledErrorOptions extends SpruceErrors.SpruceCli.Acti
|
|
|
119
122
|
code: 'ACTION_CANCELLED'
|
|
120
123
|
}
|
|
121
124
|
|
|
122
|
-
type ErrorOptions = | VscodeNotInstalledErrorOptions | TransportAlreadyExistsErrorOptions | ThemeExistsErrorOptions | TestFailedErrorOptions | StoreExistsErrorOptions | SkillViewExistsErrorOptions | SkillNotRegisteredErrorOptions | SkillNotFoundErrorOptions | SchemaTemplateItemBuildingFailedErrorOptions | SchemaFailedToImportErrorOptions | SchemaExistsErrorOptions | NotLoggedInErrorOptions | NotImplementedErrorOptions | NoSkillsRegisteredErrorOptions | NoOrganizationsFoundErrorOptions | MissingDependenciesErrorOptions | MercuryResponseErrorErrorOptions | LintFailedErrorOptions | InvalidTestDirectoryErrorOptions | InvalidFeatureCodeErrorOptions | InvalidEventContractErrorOptions | InvalidCommandErrorOptions | GenericErrorOptions | FileExistsErrorOptions | FeatureNotInstalledErrorOptions | FailedToImportErrorOptions | ExecutingCommandFailedErrorOptions | DockerNotStartedErrorOptions | DirectoryNotSkillErrorOptions | DirectoryEmptyErrorOptions | DeployFailedErrorOptions | CreateAutoloaderFailedErrorOptions | CommandNotImplementedErrorOptions | CommandBlockedErrorOptions | CommandAbortedErrorOptions | CacheNotEnabledErrorOptions | BuildFailedErrorOptions | BootErrorErrorOptions | ActionCancelledErrorOptions
|
|
125
|
+
type ErrorOptions = | VscodeNotInstalledErrorOptions | TransportAlreadyExistsErrorOptions | ThemeExistsErrorOptions | TestFailedErrorOptions | StoreExistsErrorOptions | SkillViewExistsErrorOptions | SkillNotRegisteredErrorOptions | SkillNotFoundErrorOptions | SchemaTemplateItemBuildingFailedErrorOptions | SchemaFailedToImportErrorOptions | SchemaExistsErrorOptions | NotLoggedInErrorOptions | NotImplementedErrorOptions | NoSkillsRegisteredErrorOptions | NoOrganizationsFoundErrorOptions | MissingDependenciesErrorOptions | MercuryResponseErrorErrorOptions | LintFailedErrorOptions | InvalidTestDirectoryErrorOptions | InvalidFeatureCodeErrorOptions | InvalidEventContractErrorOptions | InvalidCommandErrorOptions | GenericErrorOptions | FileExistsErrorOptions | FeatureNotInstalledErrorOptions | FailedToImportErrorOptions | ExecutingCommandFailedErrorOptions | DockerNotStartedErrorOptions | DirectoryNotSkillErrorOptions | DirectoryEmptyErrorOptions | DeployFailedErrorOptions | DependencyExistsErrorOptions | CreateAutoloaderFailedErrorOptions | CommandNotImplementedErrorOptions | CommandBlockedErrorOptions | CommandAbortedErrorOptions | CacheNotEnabledErrorOptions | BuildFailedErrorOptions | BootErrorErrorOptions | ActionCancelledErrorOptions
|
|
123
126
|
|
|
124
127
|
export default ErrorOptions
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SchemaRegistry } from '@sprucelabs/schema'
|
|
2
|
+
import { SpruceErrors } from '../errors.types'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const dependencyExistsSchema: SpruceErrors.SpruceCli.DependencyExistsSchema = {
|
|
7
|
+
id: 'dependencyExists',
|
|
8
|
+
namespace: 'SpruceCli',
|
|
9
|
+
name: 'Dependency exists',
|
|
10
|
+
fields: {
|
|
11
|
+
/** . */
|
|
12
|
+
'namespace': {
|
|
13
|
+
type: 'text',
|
|
14
|
+
isRequired: true,
|
|
15
|
+
options: undefined
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
SchemaRegistry.getInstance().trackSchema(dependencyExistsSchema)
|
|
21
|
+
|
|
22
|
+
export default dependencyExistsSchema
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { test, assert } from '@sprucelabs/test'
|
|
2
2
|
import { errorAssertUtil } from '@sprucelabs/test-utils'
|
|
3
3
|
import AbstractSkillTest from '../../tests/AbstractSkillTest'
|
|
4
|
+
import uiAssertUtil from '../../tests/utilities/uiAssert.utility'
|
|
4
5
|
|
|
5
6
|
export default class ConfiguringDependenciesTest extends AbstractSkillTest {
|
|
6
7
|
protected static skillCacheKey = 'skills'
|
|
8
|
+
private static parentSkill: {
|
|
9
|
+
id: string
|
|
10
|
+
slug: string
|
|
11
|
+
name: string
|
|
12
|
+
}
|
|
7
13
|
|
|
8
14
|
@test()
|
|
9
15
|
protected static async hasAddDependencyAction() {
|
|
@@ -11,7 +17,7 @@ export default class ConfiguringDependenciesTest extends AbstractSkillTest {
|
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
@test()
|
|
14
|
-
protected static async
|
|
20
|
+
protected static async errorsWhenPassedBadNamespace() {
|
|
15
21
|
await this.getSkillFixture().registerCurrentSkill({
|
|
16
22
|
name: 'current skill in adding deps',
|
|
17
23
|
})
|
|
@@ -26,30 +32,44 @@ export default class ConfiguringDependenciesTest extends AbstractSkillTest {
|
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
@test()
|
|
29
|
-
protected static async
|
|
30
|
-
const
|
|
35
|
+
protected static async succeedsWhenPassedGoodNamespace() {
|
|
36
|
+
const parentSkill = await this.getSkillFixture().seedDemoSkill({
|
|
31
37
|
name: 'dependent skill',
|
|
32
38
|
})
|
|
33
39
|
|
|
34
40
|
const results = await this.Action('dependency', 'add').execute({
|
|
35
|
-
namespace:
|
|
41
|
+
namespace: parentSkill.slug,
|
|
36
42
|
})
|
|
37
43
|
|
|
38
44
|
assert.isFalsy(results.errors)
|
|
39
45
|
|
|
46
|
+
this.parentSkill = parentSkill
|
|
47
|
+
|
|
40
48
|
const settings = this.Service('settings')
|
|
41
49
|
const dependencies = settings.get('dependencies')
|
|
42
50
|
|
|
43
51
|
assert.isEqualDeep(dependencies, [
|
|
44
52
|
{
|
|
45
|
-
id:
|
|
46
|
-
namespace:
|
|
53
|
+
id: parentSkill.id,
|
|
54
|
+
namespace: parentSkill.slug,
|
|
47
55
|
},
|
|
48
56
|
])
|
|
49
57
|
}
|
|
50
58
|
|
|
51
59
|
@test()
|
|
52
|
-
protected static async
|
|
60
|
+
protected static async cantAddDependencyTwice() {
|
|
61
|
+
const err = assert.doesThrow(() =>
|
|
62
|
+
this.Service('dependency').add({
|
|
63
|
+
id: this.parentSkill.id,
|
|
64
|
+
namespace: this.parentSkill.slug,
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
errorAssertUtil.assertError(err, 'DEPENDENCY_EXISTS')
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@test()
|
|
72
|
+
protected static async asksToSelectSkillWhenNoNamespacePassed() {
|
|
53
73
|
const otherSkill = await this.getSkillFixture().seedDemoSkill({
|
|
54
74
|
name: 'dependent skill',
|
|
55
75
|
})
|
|
@@ -58,7 +78,7 @@ export default class ConfiguringDependenciesTest extends AbstractSkillTest {
|
|
|
58
78
|
|
|
59
79
|
await this.waitForInput()
|
|
60
80
|
|
|
61
|
-
const last = this.ui.
|
|
81
|
+
const last = this.ui.getLastInvocation()
|
|
62
82
|
|
|
63
83
|
assert.doesInclude(last.options.options.choices, {
|
|
64
84
|
value: otherSkill.slug,
|
|
@@ -79,6 +99,23 @@ export default class ConfiguringDependenciesTest extends AbstractSkillTest {
|
|
|
79
99
|
})
|
|
80
100
|
}
|
|
81
101
|
|
|
102
|
+
@test()
|
|
103
|
+
protected static async doesNotShowSkillsThatAreAlreadySetAsADependency() {
|
|
104
|
+
await this.getPersonFixture().loginAsDemoPerson()
|
|
105
|
+
|
|
106
|
+
void this.Action('dependency', 'add').execute({})
|
|
107
|
+
|
|
108
|
+
await this.waitForInput()
|
|
109
|
+
|
|
110
|
+
uiAssertUtil.assertSelectDidNotRenderChoice(
|
|
111
|
+
this.ui,
|
|
112
|
+
this.parentSkill.slug,
|
|
113
|
+
this.parentSkill.name
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
this.ui.reset()
|
|
117
|
+
}
|
|
118
|
+
|
|
82
119
|
@test()
|
|
83
120
|
protected static async canAddSkillThatWasCreatedBySomeoneElse() {
|
|
84
121
|
const skill = await this.getSkillFixture().seedDemoSkill({
|
|
@@ -91,10 +91,10 @@ export default class InstallingASkillAtAnOrgTest extends AbstractCliTest {
|
|
|
91
91
|
await this.waitForInput()
|
|
92
92
|
|
|
93
93
|
assert.doesInclude(
|
|
94
|
-
this.ui.
|
|
94
|
+
this.ui.getLastInvocation().command,
|
|
95
95
|
'confirm',
|
|
96
96
|
`ui didn't get back a confirm, got back \n\n${assertUtil.stringify(
|
|
97
|
-
this.ui.
|
|
97
|
+
this.ui.getLastInvocation()
|
|
98
98
|
)}`
|
|
99
99
|
)
|
|
100
100
|
|
|
@@ -132,7 +132,7 @@ export default class InstallingASkillAtAnOrgTest extends AbstractCliTest {
|
|
|
132
132
|
|
|
133
133
|
await this.waitForInput()
|
|
134
134
|
|
|
135
|
-
assert.doesInclude(this.ui.
|
|
135
|
+
assert.doesInclude(this.ui.getLastInvocation().options, {
|
|
136
136
|
type: 'select',
|
|
137
137
|
})
|
|
138
138
|
|
|
@@ -33,7 +33,7 @@ export default class LoggingInAsASkillTest extends AbstractSkillTest {
|
|
|
33
33
|
|
|
34
34
|
await this.waitForInput()
|
|
35
35
|
|
|
36
|
-
assert.doesInclude(this.ui.
|
|
36
|
+
assert.doesInclude(this.ui.getLastInvocation().options.label, 'Phone')
|
|
37
37
|
|
|
38
38
|
this.ui.reset()
|
|
39
39
|
}
|
|
@@ -85,10 +85,10 @@ export default class LoggingInAsASkillTest extends AbstractSkillTest {
|
|
|
85
85
|
|
|
86
86
|
await this.waitForInput()
|
|
87
87
|
|
|
88
|
-
assert.doesInclude(this.ui.
|
|
89
|
-
assert.doesInclude(this.ui.
|
|
88
|
+
assert.doesInclude(this.ui.getLastInvocation().command, 'prompt')
|
|
89
|
+
assert.doesInclude(this.ui.getLastInvocation().options.type, 'select')
|
|
90
90
|
assert.isEqualDeep(
|
|
91
|
-
this.ui.
|
|
91
|
+
this.ui.getLastInvocation().options.options.choices,
|
|
92
92
|
[this.skill1, this.skill2].map((s) => ({
|
|
93
93
|
label: s.name,
|
|
94
94
|
value: s.id,
|
|
@@ -23,7 +23,7 @@ export default class ManagingDependenciesTest extends AbstractSkillTest {
|
|
|
23
23
|
|
|
24
24
|
await this.waitForInput()
|
|
25
25
|
|
|
26
|
-
const last = this.ui.
|
|
26
|
+
const last = this.ui.getLastInvocation()
|
|
27
27
|
|
|
28
28
|
assert.isEqual(last.options.type, 'select')
|
|
29
29
|
|
|
@@ -55,7 +55,7 @@ export default class ManagingDependenciesTest extends AbstractSkillTest {
|
|
|
55
55
|
|
|
56
56
|
await this.waitForInput()
|
|
57
57
|
|
|
58
|
-
const last = this.ui.
|
|
58
|
+
const last = this.ui.getLastInvocation()
|
|
59
59
|
|
|
60
60
|
assert.isEqualDeep(last.options.value, [skill1.id])
|
|
61
61
|
|
|
@@ -104,7 +104,7 @@ export default class ManagingDependenciesTest extends AbstractSkillTest {
|
|
|
104
104
|
|
|
105
105
|
await this.waitForInput()
|
|
106
106
|
|
|
107
|
-
const last = this.ui.
|
|
107
|
+
const last = this.ui.getLastInvocation()
|
|
108
108
|
|
|
109
109
|
assert.doesNotInclude(last.options.options.choices, {
|
|
110
110
|
value: skill.id,
|
|
@@ -65,7 +65,7 @@ export default class RememberingUpgradeSelectionsTest extends AbstractSkillTest
|
|
|
65
65
|
|
|
66
66
|
await this.waitForInput()
|
|
67
67
|
|
|
68
|
-
const last = this.ui.
|
|
68
|
+
const last = this.ui.getLastInvocation()
|
|
69
69
|
|
|
70
70
|
assert.doesInclude(last, {
|
|
71
71
|
'options.options.choices[].value': FILE_ACTION_ALWAYS_SKIP,
|
|
@@ -15,7 +15,7 @@ export default class SettingUpVscodeTest extends AbstractCliTest {
|
|
|
15
15
|
|
|
16
16
|
await this.waitForInput()
|
|
17
17
|
|
|
18
|
-
assert.isEqualDeep(this.ui.
|
|
18
|
+
assert.isEqualDeep(this.ui.getLastInvocation(), {
|
|
19
19
|
command: 'confirm',
|
|
20
20
|
options: 'Want me to setup debugging for you?',
|
|
21
21
|
})
|
|
@@ -24,7 +24,7 @@ export default class SettingUpVscodeTest extends AbstractCliTest {
|
|
|
24
24
|
|
|
25
25
|
await this.waitForInput()
|
|
26
26
|
|
|
27
|
-
assert.isEqualDeep(this.ui.
|
|
27
|
+
assert.isEqualDeep(this.ui.getLastInvocation(), {
|
|
28
28
|
command: 'confirm',
|
|
29
29
|
options:
|
|
30
30
|
'Want me to setup vscode settings for building, testing and linting on save?',
|
|
@@ -34,7 +34,7 @@ export default class SettingUpVscodeTest extends AbstractCliTest {
|
|
|
34
34
|
|
|
35
35
|
await this.waitForInput()
|
|
36
36
|
|
|
37
|
-
assert.isEqualDeep(this.ui.
|
|
37
|
+
assert.isEqualDeep(this.ui.getLastInvocation(), {
|
|
38
38
|
command: 'confirm',
|
|
39
39
|
options: 'Want me to setup tasks for building and testing?',
|
|
40
40
|
})
|
|
@@ -21,7 +21,7 @@ export default class TestingDataStoresTest extends AbstractSkillTest {
|
|
|
21
21
|
|
|
22
22
|
await this.waitForInput()
|
|
23
23
|
|
|
24
|
-
const last = this.ui.
|
|
24
|
+
const last = this.ui.getLastInvocation()
|
|
25
25
|
assert.isTruthy(last.options.options.choices)
|
|
26
26
|
assert.doesInclude(last.options.options.choices, {
|
|
27
27
|
label: 'AbstractStoreTest (requires install)',
|
|
@@ -43,7 +43,7 @@ export default class TestingDataStoresTest extends AbstractSkillTest {
|
|
|
43
43
|
|
|
44
44
|
await this.waitForInput()
|
|
45
45
|
|
|
46
|
-
const last = this.ui.
|
|
46
|
+
const last = this.ui.getLastInvocation()
|
|
47
47
|
assert.isTruthy(last.options.options.choices)
|
|
48
48
|
assert.doesInclude(last.options.options.choices, {
|
|
49
49
|
label: 'AbstractStoreTest',
|
|
@@ -2,6 +2,7 @@ import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
|
2
2
|
import { test, assert } from '@sprucelabs/test'
|
|
3
3
|
import CommandService from '../../services/CommandService'
|
|
4
4
|
import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
5
|
+
import uiAssertUtil from '../../tests/utilities/uiAssert.utility'
|
|
5
6
|
|
|
6
7
|
export default class UpgradingANodeModuleTest extends AbstractCliTest {
|
|
7
8
|
protected static async beforeEach() {
|
|
@@ -43,4 +44,27 @@ export default class UpgradingANodeModuleTest extends AbstractCliTest {
|
|
|
43
44
|
assert.isFalse(doesExist, `Should not have found ${search}`)
|
|
44
45
|
}
|
|
45
46
|
}
|
|
47
|
+
|
|
48
|
+
@test()
|
|
49
|
+
protected static async shouldReWriteNodeDirsAndSkipIndx() {
|
|
50
|
+
for (const file of ['tsconfig.json', 'src/index.ts']) {
|
|
51
|
+
const tsConfig = this.resolvePath(file)
|
|
52
|
+
diskUtil.writeFile(tsConfig, 'beenChanged')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
CommandService.setMockResponse(/yarn/gi, {
|
|
56
|
+
code: 0,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const promise = this.Action('node', 'upgrade').execute({})
|
|
60
|
+
|
|
61
|
+
await uiAssertUtil.assertRendersConfirmWriteFile(this.ui)
|
|
62
|
+
|
|
63
|
+
assert.isEqual(
|
|
64
|
+
diskUtil.readFile(this.resolvePath('src/index.ts')),
|
|
65
|
+
'beenChanged'
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
await promise
|
|
69
|
+
}
|
|
46
70
|
}
|
|
@@ -96,7 +96,7 @@ export default class CreatingAListenerTest extends AbstractEventTest {
|
|
|
96
96
|
|
|
97
97
|
await this.waitForInput()
|
|
98
98
|
|
|
99
|
-
let lastInvocation = this.ui.
|
|
99
|
+
let lastInvocation = this.ui.getLastInvocation()
|
|
100
100
|
|
|
101
101
|
assert.isEqual(lastInvocation.command, 'prompt')
|
|
102
102
|
assert.doesInclude(lastInvocation.options.label, 'namespace')
|
|
@@ -105,7 +105,7 @@ export default class CreatingAListenerTest extends AbstractEventTest {
|
|
|
105
105
|
|
|
106
106
|
await this.waitForInput()
|
|
107
107
|
|
|
108
|
-
lastInvocation = this.ui.
|
|
108
|
+
lastInvocation = this.ui.getLastInvocation()
|
|
109
109
|
|
|
110
110
|
assert.doesInclude(lastInvocation.options.label, 'event')
|
|
111
111
|
|
|
@@ -10,6 +10,7 @@ import { CliInterface } from '../../../cli'
|
|
|
10
10
|
import { FeatureActionResponse } from '../../../features/features.types'
|
|
11
11
|
import AbstractEventTest from '../../../tests/AbstractEventTest'
|
|
12
12
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
13
|
+
import uiAssertUtil from '../../../tests/utilities/uiAssert.utility'
|
|
13
14
|
import { RegisteredSkill } from '../../../types/cli.types'
|
|
14
15
|
import actionUtil from '../../../utilities/action.utility'
|
|
15
16
|
|
|
@@ -29,7 +30,16 @@ export default class CreatingAnEventTest extends AbstractEventTest {
|
|
|
29
30
|
@test()
|
|
30
31
|
protected static async cantCreateEventWithoutBeingRegistered() {
|
|
31
32
|
await this.FeatureFixture().installCachedFeatures('events')
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
const results = await this.Action('event', 'create').execute({
|
|
35
|
+
nameReadable: EVENT_NAME_READABLE,
|
|
36
|
+
nameKebab: EVENT_NAME,
|
|
37
|
+
nameCamel: EVENT_CAMEL,
|
|
38
|
+
version: this.expectedVersion,
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
assert.isArray(results.errors)
|
|
42
|
+
errorAssertUtil.assertError(results.errors[0], 'SKILL_NOT_REGISTERED')
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
@test()
|
|
@@ -71,7 +81,7 @@ export default class CreatingAnEventTest extends AbstractEventTest {
|
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
@test()
|
|
74
|
-
protected static async
|
|
84
|
+
protected static async createsEventWithPayloadsPermissionsAndOptions() {
|
|
75
85
|
const { results, cli, skill } = await this.createEvent()
|
|
76
86
|
assert.isFalsy(results.errors)
|
|
77
87
|
|
|
@@ -137,27 +147,50 @@ export default createFormEmitPayloadBuilder
|
|
|
137
147
|
assert.isFalsy(syncResults.errors)
|
|
138
148
|
}
|
|
139
149
|
|
|
140
|
-
|
|
150
|
+
@test()
|
|
151
|
+
protected static async asksForVersionIfPreviousVersionExistsOnDifferentDay() {
|
|
152
|
+
await this.createEvent({
|
|
153
|
+
version: versionUtil.generateVersion('2020_01_10').constValue,
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
void this.Action('event', 'create').execute({
|
|
157
|
+
nameReadable: EVENT_NAME_READABLE,
|
|
158
|
+
nameKebab: EVENT_NAME,
|
|
159
|
+
nameCamel: EVENT_CAMEL,
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
await uiAssertUtil.assertRendersSelect(this.ui)
|
|
163
|
+
|
|
164
|
+
this.ui.reset()
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private static async createEvent(options?: { version?: string }) {
|
|
141
168
|
const cli = await this.FeatureFixture().installCachedFeatures('events')
|
|
142
169
|
|
|
143
|
-
const skill = await this.
|
|
144
|
-
{
|
|
145
|
-
name: 'my new skill',
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
phone: process.env.DEMO_NUMBER_CREATING_AN_EVENT,
|
|
149
|
-
}
|
|
150
|
-
)
|
|
170
|
+
const skill = await this.registerCurrentSkill()
|
|
151
171
|
|
|
152
172
|
const results = await this.Action('event', 'create').execute({
|
|
153
173
|
nameReadable: EVENT_NAME_READABLE,
|
|
154
174
|
nameKebab: EVENT_NAME,
|
|
155
175
|
nameCamel: EVENT_CAMEL,
|
|
176
|
+
version: this.expectedVersion,
|
|
177
|
+
...options,
|
|
156
178
|
})
|
|
157
179
|
|
|
158
180
|
return { results, cli, skill }
|
|
159
181
|
}
|
|
160
182
|
|
|
183
|
+
private static async registerCurrentSkill() {
|
|
184
|
+
return await this.getSkillFixture().registerCurrentSkill(
|
|
185
|
+
{
|
|
186
|
+
name: 'my new skill',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
phone: process.env.DEMO_NUMBER_CREATING_AN_EVENT,
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
161
194
|
private static async assertCreatesOptionsFile(
|
|
162
195
|
results: FeatureActionResponse
|
|
163
196
|
) {
|
|
@@ -219,17 +252,6 @@ export default createFormEmitPayloadBuilder
|
|
|
219
252
|
}
|
|
220
253
|
}
|
|
221
254
|
|
|
222
|
-
protected static async assertCantCreateWithoutBeingRegistered() {
|
|
223
|
-
const results = await this.Action('event', 'create').execute({
|
|
224
|
-
nameReadable: EVENT_NAME_READABLE,
|
|
225
|
-
nameKebab: EVENT_NAME,
|
|
226
|
-
nameCamel: EVENT_CAMEL,
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
assert.isArray(results.errors)
|
|
230
|
-
errorAssertUtil.assertError(results.errors[0], 'SKILL_NOT_REGISTERED')
|
|
231
|
-
}
|
|
232
|
-
|
|
233
255
|
private static async assertReturnsEventFromHealthCheck(
|
|
234
256
|
cli: CliInterface,
|
|
235
257
|
skill: RegisteredSkill
|
|
@@ -231,6 +231,8 @@ export default class KeepsSchemasInSyncTest extends AbstractSchemaTest {
|
|
|
231
231
|
nameCamel: 'testSchema',
|
|
232
232
|
})
|
|
233
233
|
|
|
234
|
+
assert.isFalsy(createResponse.errors)
|
|
235
|
+
|
|
234
236
|
const builderPath = testUtil.assertFileByNameInGeneratedFiles(
|
|
235
237
|
'testSchema.builder.ts',
|
|
236
238
|
createResponse.files
|