@sprucelabs/spruce-cli 14.29.0 → 14.29.4

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/__tests__/behavioral/events/CreatingAListener.test.d.ts +1 -0
  3. package/build/__tests__/behavioral/events/CreatingAListener.test.js +67 -24
  4. package/build/__tests__/behavioral/events/CreatingAListener.test.js.map +1 -1
  5. package/build/__tests__/behavioral/{ListeningToAnEventYouCreate.test.d.ts → events/ListeningToAnEventYouCreate.test.d.ts} +1 -1
  6. package/build/__tests__/behavioral/{ListeningToAnEventYouCreate.test.js → events/ListeningToAnEventYouCreate.test.js} +2 -2
  7. package/build/__tests__/behavioral/events/ListeningToAnEventYouCreate.test.js.map +1 -0
  8. package/build/__tests__/implementation/LintService.test.d.ts +5 -0
  9. package/build/__tests__/implementation/LintService.test.js +130 -0
  10. package/build/__tests__/implementation/LintService.test.js.map +1 -0
  11. package/build/errors/SpruceError.js +8 -4
  12. package/build/errors/SpruceError.js.map +1 -1
  13. package/build/features/node/NodeFeature.js +1 -1
  14. package/build/features/node/NodeFeature.js.map +1 -1
  15. package/build/features/store/StoreFeature.js +10 -5
  16. package/build/features/store/StoreFeature.js.map +1 -1
  17. package/build/schemas/v2020_07_22/personWithToken.builder.js +1 -0
  18. package/build/schemas/v2020_07_22/personWithToken.builder.js.map +1 -1
  19. package/build/services/GameService.js +14 -10
  20. package/build/services/GameService.js.map +1 -1
  21. package/build/services/LintService.d.ts +2 -2
  22. package/build/services/LintService.js +30 -14
  23. package/build/services/LintService.js.map +1 -1
  24. package/build/services/ServiceFactory.js +8 -2
  25. package/build/services/ServiceFactory.js.map +1 -1
  26. package/package.json +34 -34
  27. package/src/__tests__/behavioral/events/CreatingAListener.test.ts +20 -0
  28. package/src/__tests__/behavioral/{ListeningToAnEventYouCreate.test.ts → events/ListeningToAnEventYouCreate.test.ts} +2 -2
  29. package/src/__tests__/implementation/LintService.test.ts +34 -0
  30. package/src/errors/SpruceError.ts +9 -5
  31. package/src/features/node/NodeFeature.ts +2 -1
  32. package/src/features/store/StoreFeature.ts +4 -1
  33. package/src/schemas/v2020_07_22/personWithToken.builder.ts +1 -0
  34. package/src/services/GameService.ts +1 -0
  35. package/src/services/LintService.ts +17 -5
  36. package/src/services/ServiceFactory.ts +2 -3
  37. package/build/__tests__/behavioral/ListeningToAnEventYouCreate.test.js.map +0 -1
  38. package/build/__tests__/behavioral/README.md +0 -8
  39. package/build/__tests__/implementation/README.md +0 -5
  40. package/build/components/README.md +0 -5
  41. package/src/__tests__/behavioral/README.md +0 -8
  42. package/src/__tests__/implementation/README.md +0 -5
  43. package/src/components/README.md +0 -5
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  ]
19
19
  },
20
20
  "license": "MIT",
21
- "version": "14.29.0",
21
+ "version": "14.29.4",
22
22
  "bin": {
23
23
  "spruce": "./build/index.js"
24
24
  },
@@ -75,20 +75,20 @@
75
75
  "@babel/cli": "^7.16.0",
76
76
  "@babel/plugin-proposal-decorators": "^7.16.4",
77
77
  "@babel/runtime": "^7.16.3",
78
- "@jest/reporters": "^27.4.2",
79
- "@sprucelabs/error": "^5.0.317",
80
- "@sprucelabs/heartwood-view-controllers": "^51.6.51",
81
- "@sprucelabs/jest-json-reporter": "^6.0.265",
82
- "@sprucelabs/mercury-client": "^17.4.29",
83
- "@sprucelabs/mercury-event-emitter": "^17.4.29",
84
- "@sprucelabs/mercury-types": "^26.1.992",
85
- "@sprucelabs/schema": "^25.4.67",
86
- "@sprucelabs/spruce-core-schemas": "^22.6.250",
87
- "@sprucelabs/spruce-event-plugin": "^18.1.0",
88
- "@sprucelabs/spruce-event-utils": "^17.1.272",
89
- "@sprucelabs/spruce-skill-booter": "^18.1.0",
90
- "@sprucelabs/spruce-skill-utils": "^22.1.50",
91
- "@sprucelabs/spruce-templates": "^14.29.0",
78
+ "@jest/reporters": "^27.4.4",
79
+ "@sprucelabs/error": "^5.0.332",
80
+ "@sprucelabs/heartwood-view-controllers": "^51.14.1",
81
+ "@sprucelabs/jest-json-reporter": "^6.0.276",
82
+ "@sprucelabs/mercury-client": "^17.4.85",
83
+ "@sprucelabs/mercury-event-emitter": "^17.4.85",
84
+ "@sprucelabs/mercury-types": "^26.1.1050",
85
+ "@sprucelabs/schema": "^25.4.102",
86
+ "@sprucelabs/spruce-core-schemas": "^22.6.299",
87
+ "@sprucelabs/spruce-event-plugin": "^18.3.3",
88
+ "@sprucelabs/spruce-event-utils": "^17.1.339",
89
+ "@sprucelabs/spruce-skill-booter": "^18.3.3",
90
+ "@sprucelabs/spruce-skill-utils": "^22.1.89",
91
+ "@sprucelabs/spruce-templates": "^14.29.4",
92
92
  "@typescript-eslint/eslint-plugin": "^5.6.0",
93
93
  "@typescript-eslint/parser": "^5.6.0",
94
94
  "cfonts": "^2.10.0",
@@ -119,26 +119,26 @@
119
119
  "uuid": "^8.3.2"
120
120
  },
121
121
  "devDependencies": {
122
- "@sprucelabs/data-stores": "^7.2.0",
123
- "@sprucelabs/jest-sheets-reporter": "^1.2.268",
124
- "@sprucelabs/mercury-core-events": "^1.6.215",
125
- "@sprucelabs/resolve-path-aliases": "^1.0.236",
126
- "@sprucelabs/spruce-conversation-plugin": "^18.1.0",
127
- "@sprucelabs/spruce-deploy-plugin": "^18.1.0",
128
- "@sprucelabs/spruce-store-plugin": "^18.1.0",
129
- "@sprucelabs/spruce-test-fixtures": "^18.1.0",
130
- "@sprucelabs/test": "^7.7.248",
131
- "@sprucelabs/test-utils": "^3.0.301",
122
+ "@sprucelabs/data-stores": "^7.2.1",
123
+ "@sprucelabs/jest-sheets-reporter": "^1.2.276",
124
+ "@sprucelabs/mercury-core-events": "^1.6.289",
125
+ "@sprucelabs/resolve-path-aliases": "^1.0.240",
126
+ "@sprucelabs/spruce-conversation-plugin": "^18.3.3",
127
+ "@sprucelabs/spruce-deploy-plugin": "^18.3.3",
128
+ "@sprucelabs/spruce-store-plugin": "^18.3.3",
129
+ "@sprucelabs/spruce-test-fixtures": "^18.3.3",
130
+ "@sprucelabs/test": "^7.7.258",
131
+ "@sprucelabs/test-utils": "^3.0.320",
132
132
  "@types/blessed": "^0.1.19",
133
133
  "@types/eslint": "^8.2.1",
134
134
  "@types/fs-extra": "^9.0.13",
135
135
  "@types/inflection": "^1.13.0",
136
136
  "@types/inquirer": "^8.1.3",
137
137
  "@types/jsonwebtoken": "^8.5.6",
138
- "@types/lodash": "^4.14.177",
138
+ "@types/lodash": "^4.14.178",
139
139
  "@types/md5": "^2.3.1",
140
140
  "@types/mkdirp": "^1.0.2",
141
- "@types/node": "^16.11.11",
141
+ "@types/node": "^16.11.12",
142
142
  "@types/promise.allsettled": "^1.0.3",
143
143
  "@types/ps-node": "^0.1.1",
144
144
  "@types/rimraf": "^3.0.2",
@@ -152,21 +152,21 @@
152
152
  "concurrently": "^6.4.0",
153
153
  "conventional-changelog-sprucelabs": "^1.1.2",
154
154
  "dotenv": "^10.0.0",
155
- "eslint": "^8.4.0",
156
- "eslint-config-spruce": "^10.10.16",
155
+ "eslint": "^8.4.1",
156
+ "eslint-config-spruce": "^10.11.0",
157
157
  "find-process": "^1.4.7",
158
- "jest": "^27.4.3",
159
- "jest-circus": "^27.4.2",
158
+ "jest": "^27.4.4",
159
+ "jest-circus": "^27.4.4",
160
160
  "jest-junit": "^13.0.0",
161
161
  "jest-reporters": "^0.0.2",
162
162
  "prettier": "^2.5.1",
163
163
  "ps-node": "^0.1.6",
164
164
  "rimraf": "^3.0.2",
165
- "ts-jest": "^27.1.0",
165
+ "ts-jest": "^27.1.1",
166
166
  "ts-node": "^10.4.0",
167
167
  "tsc-watch": "^4.5.0",
168
168
  "tsconfig-paths": "^3.12.0",
169
- "typescript": "^4.5.2"
169
+ "typescript": "^4.5.3"
170
170
  },
171
171
  "testSkillCache": {
172
172
  "everything": [
@@ -597,5 +597,5 @@
597
597
  "ora"
598
598
  ]
599
599
  },
600
- "gitHead": "b3d42f18072662e082727a4ac9b60f3ec707db3d"
600
+ "gitHead": "daab330a93577997638df78ec958e91799938d1f"
601
601
  }
@@ -265,6 +265,26 @@ export default class CreatingAListenerTest extends AbstractEventTest {
265
265
  )
266
266
  }
267
267
 
268
+ @test()
269
+ protected static async listeningToAnEventWithNoEmitTargetOrPayloadGeneratesValidListener() {
270
+ const { listenerPath } =
271
+ await this.setupSkillsInstallAtOrgRegisterEventContractAndGenerateListener(
272
+ {
273
+ isGlobal: true,
274
+ responsePayloadSchema: {
275
+ id: 'test',
276
+ fields: {
277
+ id: {
278
+ type: 'id',
279
+ },
280
+ },
281
+ },
282
+ }
283
+ )
284
+
285
+ await this.Service('typeChecker').check(listenerPath)
286
+ }
287
+
268
288
  private static async installEventsAndCreateListener() {
269
289
  const cli = await this.installEventFeature('events')
270
290
 
@@ -1,8 +1,8 @@
1
1
  import { eventNameUtil } from '@sprucelabs/spruce-event-utils'
2
2
  import { diskUtil } from '@sprucelabs/spruce-skill-utils'
3
3
  import { test, assert } from '@sprucelabs/test'
4
- import AbstractEventTest from '../../tests/AbstractEventTest'
5
- import testUtil from '../../tests/utilities/test.utility'
4
+ import AbstractEventTest from '../../../tests/AbstractEventTest'
5
+ import testUtil from '../../../tests/utilities/test.utility'
6
6
 
7
7
  export default class ListeningToAnEventYouCreateTest extends AbstractEventTest {
8
8
  @test()
@@ -0,0 +1,34 @@
1
+ import { test, assert } from '@sprucelabs/test'
2
+ import CommandService from '../../services/CommandService'
3
+ import LintService from '../../services/LintService'
4
+ import AbstractCliTest from '../../tests/AbstractCliTest'
5
+
6
+ export default class LintServiceTest extends AbstractCliTest {
7
+ @test()
8
+ protected static async throwsWhenLintReturnsMessage() {
9
+ LintService.enableLinting()
10
+
11
+ await this.FeatureFixture().installCachedFeatures('skills')
12
+
13
+ CommandService.setMockResponse(/node/, {
14
+ code: 0,
15
+ 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`,
16
+ })
17
+
18
+ await assert.doesThrowAsync(() => this.Service('lint').fix('./go'))
19
+ }
20
+
21
+ @test()
22
+ protected static async worksWhenNoMessagesReturned() {
23
+ LintService.enableLinting()
24
+
25
+ await this.FeatureFixture().installCachedFeatures('skills')
26
+
27
+ CommandService.setMockResponse(/node/, {
28
+ code: 0,
29
+ 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`,
30
+ })
31
+
32
+ await this.Service('lint').fix('./go')
33
+ }
34
+ }
@@ -68,12 +68,16 @@ export default class SpruceError extends AbstractSpruceError<ErrorOptions> {
68
68
  break
69
69
 
70
70
  case 'LINT_FAILED':
71
- message = `Lint failed on pattern ${options.pattern}.`
71
+ message = options.friendlyMessage
72
72
 
73
- if (options.originalError) {
74
- message += `\n\nOriginal error:${
75
- options.originalError.stack ?? options.originalError.message
76
- }`
73
+ if (!message) {
74
+ message = `Lint failed on pattern ${options.pattern}.`
75
+
76
+ if (options.originalError) {
77
+ message += `\n\nOriginal error:${
78
+ options.originalError.stack ?? options.originalError.message
79
+ }`
80
+ }
77
81
  }
78
82
 
79
83
  break
@@ -59,12 +59,13 @@ export default class NodeFeature<
59
59
  return {}
60
60
  })
61
61
  }
62
+
62
63
  private async handleUpgrade(): Promise<FeatureActionResponse> {
63
64
  try {
64
65
  this.ui.startLoading('Cleaning build...')
65
66
  await this.Service('command').execute('yarn clean.build')
66
67
 
67
- this.ui.startLoading('Rebuilding...')
68
+ this.ui.startLoading('Building for development...')
68
69
  await this.Service('command').execute('yarn build.dev')
69
70
 
70
71
  return {
@@ -70,7 +70,10 @@ export default class StoreFeature extends AbstractFeature {
70
70
  ui: this.ui,
71
71
  headline: 'Resyncing data stores...',
72
72
  })
73
- return this.Action('store', 'sync').execute({})
73
+
74
+ const results = await this.Action('store', 'sync').execute({})
75
+
76
+ return results
74
77
  }
75
78
 
76
79
  return {}
@@ -1,4 +1,5 @@
1
1
  import { buildSchema } from '@sprucelabs/schema'
2
+ // eslint-disable-next-line spruce/prohibit-import-of-schema-in-builders
2
3
  import personSchema from '#spruce/schemas/spruce/v2020_07_22/person.schema'
3
4
 
4
5
  export default buildSchema({
@@ -20,6 +20,7 @@ export default class GameService {
20
20
 
21
21
  public async play(introductionSentences: string[] = []) {
22
22
  const sentencesToPlay = [...introductionSentences]
23
+ await this.ui.stopLoading()
23
24
  this.killed = false
24
25
 
25
26
  while (sentencesToPlay.length > 0) {
@@ -6,7 +6,7 @@ import CommandService from './CommandService'
6
6
 
7
7
  export default class LintService {
8
8
  public cwd: string
9
- private command: CommandService
9
+ private getCommand: () => CommandService
10
10
 
11
11
  private static isLintingEnabled = true
12
12
 
@@ -18,9 +18,9 @@ export default class LintService {
18
18
  this.isLintingEnabled = true
19
19
  }
20
20
 
21
- public constructor(cwd: string, commandService: CommandService) {
21
+ public constructor(cwd: string, commandServiceFactory: () => CommandService) {
22
22
  this.cwd = cwd
23
- this.command = commandService
23
+ this.getCommand = commandServiceFactory
24
24
  }
25
25
 
26
26
  public fix = async (pattern: string): Promise<string[]> => {
@@ -37,12 +37,13 @@ export default class LintService {
37
37
 
38
38
  let fixedFiles: any = {}
39
39
  const fixedPaths: string[] = []
40
+
40
41
  try {
41
42
  // const cli = new ESLint({ fix: true, cwd: this.cwd, cache: true })
42
43
  // fixedFiles = await cli.lintFiles([pattern])
43
44
  const script = `"(async function lint() { try { const { ESLint } = require('eslint'); const cli = new ESLint({ fix: true, cwd: '${this.cwd}', }); const result = await cli.lintFiles(['${pattern}']); console.log(JSON.stringify(result)); } catch (err) { console.log(err.toString()); }})()"`
44
45
 
45
- const { stdout } = await this.command.execute('node', {
46
+ const { stdout } = await this.getCommand().execute('node', {
46
47
  args: ['-e', script],
47
48
  })
48
49
 
@@ -58,9 +59,20 @@ export default class LintService {
58
59
  if (fixedFiles) {
59
60
  for (let i = 0; i < fixedFiles.length; i += 1) {
60
61
  const fixedFile = fixedFiles[i]
61
- if (fixedFile && fixedFile.output) {
62
+
63
+ if (fixedFile?.output) {
62
64
  await fs.writeFile(fixedFile.filePath, fixedFile.output)
63
65
  fixedPaths.push(fixedFile.filePath)
66
+ } else if (fixedFile?.messages && fixedFile?.errorCount > 0) {
67
+ throw new SpruceError({
68
+ code: 'LINT_FAILED',
69
+ pattern,
70
+ friendlyMessage: `Lint error with '${
71
+ fixedFile.filePath
72
+ }':\n\n${fixedFile.messages
73
+ .map((m: any) => m?.message)
74
+ .join('\n')}`,
75
+ })
64
76
  }
65
77
  }
66
78
  }
@@ -55,8 +55,7 @@ export default class ServiceFactory {
55
55
  command: new CommandService(cwd),
56
56
  }) as ServiceMap[S]
57
57
  case 'lint':
58
- return new LintService(
59
- cwd,
58
+ return new LintService(cwd, () =>
60
59
  this.Service(cwd, 'command')
61
60
  ) as ServiceMap[S]
62
61
  case 'command': {
@@ -80,7 +79,7 @@ export default class ServiceFactory {
80
79
  const commandService = new CommandService(cwd)
81
80
  return new BuildService(
82
81
  commandService,
83
- new LintService(cwd, this.Service(cwd, 'command'))
82
+ new LintService(cwd, () => this.Service(cwd, 'command'))
84
83
  ) as ServiceMap[S]
85
84
  }
86
85
  case 'eventSettings':
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/__tests__/behavioral/ListeningToAnEventYouCreate.test.ts"],"names":["ListeningToAnEventYouCreateTest","registerCurrentSkillAndInstallToOrg","currentSkill","eventName","version","fqen","eventNameUtil","join","eventNamespace","slug","source","resolveTestPath","destination","resolvePath","diskUtil","copyDir","listenPromise","Action","execute","waitForInput","ui","sendInput","results","assert","isFalsy","errors","match","testUtil","assertFileByNameInGeneratedFiles","files","doesInclude","assertClientIsProperlyTyped","sourceFile","contents","readFile","replace","destinationFile","writeFile","Service","check","AbstractEventTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,+B,WACnB,iB;;;;;;;;;;;;;qHAAD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEgC,KAAKC,mCAAL,EAFhC;;AAAA;AAAA;AAESC,gBAAAA,YAFT,yBAESA,YAFT;AAIOC,gBAAAA,SAJP,GAImB,sBAJnB;AAKOC,gBAAAA,OALP,GAKiB,aALjB;AAOOC,gBAAAA,IAPP,GAOcC,gCAAcC,IAAd,CAAmB;AAC/BJ,kBAAAA,SAAS,EAATA,SAD+B;AAE/BK,kBAAAA,cAAc,EAAEN,YAAY,CAACO,IAFE;AAG/BL,kBAAAA,OAAO,EAAPA;AAH+B,iBAAnB,CAPd;AAaOM,gBAAAA,MAbP,GAagB,KAAKC,eAAL,CAAqB,sCAArB,CAbhB;AAcOC,gBAAAA,WAdP,GAcqB,KAAKC,WAAL,CAAiB,KAAjB,CAdrB;AAAA;AAAA,uBAgBOC,2BAASC,OAAT,CAAiBL,MAAjB,EAAyBE,WAAzB,CAhBP;;AAAA;AAkBOI,gBAAAA,aAlBP,GAkBuB,KAAKC,MAAL,CAAY,OAAZ,EAAqB,QAArB,EAA+BC,OAA/B,CAAuC,EAAvC,CAlBvB;AAAA;AAAA,uBAoBO,KAAKC,YAAL,EApBP;;AAAA;AAAA;AAAA,uBAqBO,KAAKC,EAAL,CAAQC,SAAR,CAAkBnB,YAAY,CAACO,IAA/B,CArBP;;AAAA;AAAA;AAAA,uBAuBO,KAAKU,YAAL,EAvBP;;AAAA;AAAA;AAAA,uBAwBO,KAAKC,EAAL,CAAQC,SAAR,CAAkBhB,IAAlB,CAxBP;;AAAA;AAAA;AAAA,uBA0BuBW,aA1BvB;;AAAA;AA0BOM,gBAAAA,OA1BP;;AA4BCC,6BAAOC,OAAP,CAAeF,OAAO,CAACG,MAAvB;;AAEMC,gBAAAA,KA9BP,GA8BeC,kBAASC,gCAAT,WACVzB,SADU,cACGC,OADH,mBAEbkB,OAAO,CAACO,KAFK,CA9Bf;;AAmCCN,6BAAOO,WAAP,CACCJ,KADD,EAECZ,2BAASD,WAAT,CAAqB,WAArB,EAAkCX,YAAY,CAACO,IAA/C,CAFD;;AAnCD;AAAA,uBAwCO,KAAKsB,2BAAL,CAAiC7B,YAAY,CAACO,IAA9C,CAxCP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;uHA2CA,kBAAiDD,cAAjD;AAAA;AAAA;AAAA;AAAA;AAAA;AACOwB,gBAAAA,UADP,GACoB,KAAKnB,WAAL,CAAiB,6BAAjB,CADpB;AAEOoB,gBAAAA,QAFP,GAEkBnB,2BACfoB,QADe,CACNF,UADM,EAEfG,OAFe,CAEP,oBAFO,EAEe3B,cAFf,CAFlB;AAMO4B,gBAAAA,eANP,GAMyB,KAAKvB,WAAL,CAAiB,yBAAjB,CANzB;;AAOCC,2CAASuB,SAAT,CAAmBD,eAAnB,EAAoCH,QAApC;;AAPD;AAAA,uBASO,KAAKK,OAAL,CAAa,aAAb,EAA4BC,KAA5B,CAAkCH,eAAlC,CATP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EA5C4DI,8B","sourcesContent":["import { eventNameUtil } from '@sprucelabs/spruce-event-utils'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport AbstractEventTest from '../../tests/AbstractEventTest'\nimport testUtil from '../../tests/utilities/test.utility'\n\nexport default class ListeningToAnEventYouCreateTest extends AbstractEventTest {\n\t@test()\n\tprotected static async canListenToEventWeCreated() {\n\t\tconst { currentSkill } = await this.registerCurrentSkillAndInstallToOrg()\n\n\t\tconst eventName = 'register-skill-views'\n\t\tconst version = 'v2021_04_11'\n\n\t\tconst fqen = eventNameUtil.join({\n\t\t\teventName,\n\t\t\teventNamespace: currentSkill.slug,\n\t\t\tversion,\n\t\t})\n\n\t\tconst source = this.resolveTestPath('skill_register_skill_views_event/src')\n\t\tconst destination = this.resolvePath('src')\n\n\t\tawait diskUtil.copyDir(source, destination)\n\n\t\tconst listenPromise = this.Action('event', 'listen').execute({})\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput(currentSkill.slug)\n\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput(fqen)\n\n\t\tconst results = await listenPromise\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst match = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t`${eventName}.${version}.listener.ts`,\n\t\t\tresults.files\n\t\t)\n\n\t\tassert.doesInclude(\n\t\t\tmatch,\n\t\t\tdiskUtil.resolvePath('listeners', currentSkill.slug)\n\t\t)\n\n\t\tawait this.assertClientIsProperlyTyped(currentSkill.slug)\n\t}\n\n\tprivate static async assertClientIsProperlyTyped(eventNamespace: string) {\n\t\tconst sourceFile = this.resolvePath('src/client-type-test.ts.hbs')\n\t\tconst contents = diskUtil\n\t\t\t.readFile(sourceFile)\n\t\t\t.replace('{{eventNamespace}}', eventNamespace)\n\n\t\tconst destinationFile = this.resolvePath('src/client-type-test.ts')\n\t\tdiskUtil.writeFile(destinationFile, contents)\n\n\t\tawait this.Service('typeChecker').check(destinationFile)\n\t}\n}\n"],"file":"ListeningToAnEventYouCreate.test.js"}
@@ -1,8 +0,0 @@
1
-
2
- # Behavioral tests
3
-
4
- These are the tests that matter. They should test everything just under the interface. Interface tests can go into implementation since they'll often change.
5
-
6
- If all these pass, we ship.
7
-
8
-
@@ -1,5 +0,0 @@
1
- # Implementation Tests
2
-
3
- These tests help you build whatever you're building to solve the behavioral tests.
4
-
5
- Implementation tests can safely be deleted when they break when you are changing the implementation. At that point, you can create new ones.
@@ -1,5 +0,0 @@
1
- # Components
2
-
3
- Components are ways to collect lots of input form a user that you can reuse in multiple Commands.
4
-
5
- Commands and components are the only places you should be asking for input.
@@ -1,8 +0,0 @@
1
-
2
- # Behavioral tests
3
-
4
- These are the tests that matter. They should test everything just under the interface. Interface tests can go into implementation since they'll often change.
5
-
6
- If all these pass, we ship.
7
-
8
-
@@ -1,5 +0,0 @@
1
- # Implementation Tests
2
-
3
- These tests help you build whatever you're building to solve the behavioral tests.
4
-
5
- Implementation tests can safely be deleted when they break when you are changing the implementation. At that point, you can create new ones.
@@ -1,5 +0,0 @@
1
- # Components
2
-
3
- Components are ways to collect lots of input form a user that you can reuse in multiple Commands.
4
-
5
- Commands and components are the only places you should be asking for input.