@sprucelabs/spruce-cli 14.21.12 → 14.21.13
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 +8 -0
- package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js.map +1 -1
- package/build/__tests__/behavioral/WatchingSkillViews.test.js.map +1 -1
- package/build/__tests__/implementation/GlobalEmitter.d.ts +1 -1
- package/build/__tests__/implementation/GlobalEmitter.js +6 -6
- package/build/__tests__/implementation/GlobalEmitter.js.map +1 -1
- package/build/__tests__/testDirsAndFiles/mercury-types-package.json +2 -2
- package/build/errors/SpruceError.js +10 -3
- package/build/errors/SpruceError.js.map +1 -1
- package/build/features/test/TestReporter.js +1 -1
- package/build/features/test/TestReporter.js.map +1 -1
- package/build/features/vscode/actions/SetupAction.js +1 -0
- package/build/features/vscode/actions/SetupAction.js.map +1 -1
- package/build/services/LintService.js +23 -23
- package/build/services/LintService.js.map +1 -1
- package/package.json +23 -22
- package/src/__tests__/behavioral/SettingLogTransportsInASkill.test.ts +1 -1
- package/src/__tests__/behavioral/WatchingSkillViews.test.ts +1 -0
- package/src/__tests__/implementation/GlobalEmitter.ts +1 -1
- package/src/__tests__/testDirsAndFiles/mercury-types-package.json +2 -2
- package/src/errors/SpruceError.ts +7 -0
- package/src/features/test/TestReporter.ts +1 -1
- package/src/features/vscode/actions/SetupAction.ts +1 -0
- package/src/services/LintService.ts +6 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [14.21.13](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.21.12...v14.21.13) (2021-10-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [14.21.12](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.21.11...v14.21.12) (2021-10-09)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/__tests__/behavioral/SettingLogTransportsInASkill.test.ts"],"names":["SettingLogTransportsInASkillTest","action","Action","assert","isFunction","execute","createTransport","results","isFalsy","errors","nameReadable","nameCamel","namesUtil","toCamel","match","testUtil","assertFileByNameInGeneratedFiles","files","doesInclude","resolvePath","isTrue","diskUtil","doesFileExist","isTruthy","errorAssertUtil","assertError","name","transportContents","createTransportWithContents","Service","build","boot","meta","kill","cwd","writeFile","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,gC,WAGnB,iB,UAMA,iB,UAMA,gBAAK,wBAAL,EAA+B,KAA/B,C,UACA,gBAAK,wBAAL,EAA+B,OAA/B,C,UAiBA,iB,UASA,iB;;;;;;;;;;;;;qHAvCD;AAAA;AAAA;AAAA;AAAA;AAAA;AAEOC,gBAAAA,MAFP,GAEgB,KAAKC,MAAL,CAAY,KAAZ,EAAmB,iBAAnB,CAFhB;;AAGCC,6BAAOC,UAAP,CAAkBH,MAAM,CAACI,OAAzB;;AAHD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;gHAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEuB,KAAKC,eAAL,EAFvB;;AAAA;AAEOC,gBAAAA,OAFP;;AAGCJ,6BAAOK,OAAP,CAAeD,OAAO,CAACE,MAAvB;;AAHD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;gHAMA,kBAE4CC,YAF5C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAGuB,KAAKJ,eAAL,CAAqBI,YAArB,CAHvB;;AAAA;AAGOH,gBAAAA,OAHP;AAIOI,gBAAAA,SAJP,GAImBC,4BAAUC,OAAV,CAAkBH,YAAlB,CAJnB;AAKOI,gBAAAA,KALP,GAKeC,kBAASC,gCAAT,WACVL,SADU,0BAEbJ,OAAO,CAACU,KAFK,CALf;;AAUCd,6BAAOe,WAAP,CACCJ,KADD,EAEC,KAAKK,WAAL,CAAiB,mBAAjB,YAAyCR,SAAzC,yBAFD;;AAKAR,6BAAOiB,MAAP,CAAcC,2BAASC,aAAT,CAAuBR,KAAvB,CAAd;;AAfD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;gIAkBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEuB,KAAKR,eAAL,CAAqB,OAArB,CAFvB;;AAAA;AAEOC,gBAAAA,OAFP;;AAGCJ,6BAAOoB,QAAP,CAAgBhB,OAAO,CAACE,MAAxB;;AACAe,2CAAgBC,WAAhB,CAA4BlB,OAAO,CAACE,MAAR,CAAe,CAAf,CAA5B,EAA+C,0BAA/C,EAA2E;AAC1EiB,kBAAAA,IAAI,EAAE;AADoE,iBAA3E;;AAJD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;iHASA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEOC,gBAAAA,iBAFP;AAAA;AAAA,uBAsBO,KAAKC,2BAAL,CAAiCD,iBAAjC,EAAoD,MAApD,CAtBP;;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/behavioral/SettingLogTransportsInASkill.test.ts"],"names":["SettingLogTransportsInASkillTest","action","Action","assert","isFunction","execute","createTransport","results","isFalsy","errors","nameReadable","nameCamel","namesUtil","toCamel","match","testUtil","assertFileByNameInGeneratedFiles","files","doesInclude","resolvePath","isTrue","diskUtil","doesFileExist","isTruthy","errorAssertUtil","assertError","name","transportContents","createTransportWithContents","Service","build","boot","meta","kill","cwd","writ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EAA0Ba,iBAA1B;;AAVD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;2GAaA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAqCjB,gBAAAA,YAArC,8DAAoD,OAApD;AACOT,gBAAAA,MADP,GACgB,KAAKC,MAAL,CAAY,KAAZ,EAAmB,iBAAnB,CADhB;AAAA;AAAA,uBAEuBD,MAAM,CAACI,OAAP,CAAe;AACpCK,kBAAAA,YAAY,EAAZA,YADoC;AAEpCC,kBAAAA,SAAS,EAAEC,4BAAUC,OAAV,CAAkBH,YAAlB;AAFyB,iBAAf,CAFvB;;AAAA;AAEOH,gBAAAA,OAFP;AAAA,kDAMQA,OANR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAzF6D6B,8B,8DAC5B,Q","sourcesContent":["import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport AbstractSkillTest from '../../tests/AbstractSkillTest'\nimport testUtil from '../../tests/utilities/test.utility'\n\nexport default class SettingLogTransportsInASkillTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'skills'\n\n\t@test()\n\tprotected static async hasCreateTransportCommand() {\n\t\tconst action = this.Action('log', 'createTransport')\n\t\tassert.isFunction(action.execute)\n\t}\n\n\t@test()\n\tprotected static async needsNameOfTransport() {\n\t\tconst results = await this.createTransport()\n\t\tassert.isFalsy(results.errors)\n\t}\n\n\t@test('can create transport 1', 'Sms')\n\t@test('can create transport 2', 'Email')\n\tprotected static async createsTransportFile(nameReadable: string) {\n\t\tconst results = await this.createTransport(nameReadable)\n\t\tconst nameCamel = namesUtil.toCamel(nameReadable)\n\t\tconst match = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t`${nameCamel}Transport.plugin.ts`,\n\t\t\tresults.files\n\t\t)\n\n\t\tassert.doesInclude(\n\t\t\tmatch,\n\t\t\tthis.resolvePath('src/logTransports', `${nameCamel}Transport.plugin.ts`)\n\t\t)\n\n\t\tassert.isTrue(diskUtil.doesFileExist(match))\n\t}\n\n\t@test()\n\tprotected static async cantCreateTransportThatAlreadyExists() {\n\t\tconst results = await this.createTransport('Slack')\n\t\tassert.isTruthy(results.errors)\n\t\terrorAssertUtil.assertError(results.errors[0], 'TRANSPORT_ALREADY_EXISTS', {\n\t\t\tname: 'Slack',\n\t\t})\n\t}\n\n\t@test()\n\tprotected static async logsWriteToTransports() {\n\t\tconst transportContents = `\n\t\timport { diskUtil, Level, LogTransport } from '@sprucelabs/spruce-skill-utils'\n\t\t\n\t\texport default function (): {\n\t\t\tlevels: Level[]\n\t\t\ttransport: LogTransport\n\t\t} | null {\n\t\t\treturn {\n\t\t\t\tlevels: ['ERROR', 'INFO', 'WARN'],\n\t\t\t\ttransport: (...messageParts: string[]) => {\n\t\t\t\t\tconst message = messageParts.join(' ')\n\t\t\t\t\tdiskUtil.writeFile(\n\t\t\t\t\t\tdiskUtil.resolvePath(__dirname, '..', '..', 'log.txt'),\n\t\t\t\t\t\tmessage\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\t`\n\n\t\tawait this.createTransportWithContents(transportContents, 'File')\n\t\tawait this.Service('build').build()\n\n\t\tconst boot = await this.Action('skill', 'boot').execute({})\n\n\t\tawait boot.meta?.kill()\n\n\t\tassert.isTrue(\n\t\t\tdiskUtil.doesFileExist(diskUtil.resolvePath(this.cwd, 'log.txt'))\n\t\t)\n\t}\n\n\tprivate static async createTransportWithContents(\n\t\ttransportContents: string,\n\t\tnameReadable: string\n\t) {\n\t\tconst results = await this.createTransport(nameReadable)\n\t\tconst match = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t`${namesUtil.toCamel(nameReadable)}Transport.plugin.ts`,\n\t\t\tresults.files\n\t\t)\n\n\t\tdiskUtil.writeFile(match, transportContents)\n\t}\n\n\tprivate static async createTransport(nameReadable = 'Slack') {\n\t\tconst action = this.Action('log', 'createTransport')\n\t\tconst results = await action.execute({\n\t\t\tnameReadable,\n\t\t\tnameCamel: namesUtil.toCamel(nameReadable),\n\t\t})\n\t\treturn results\n\t}\n}\n"],"file":"SettingLogTransportsInASkill.test.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/__tests__/behavioral/WatchingSkillViews.test.ts"],"names":["WatchingSkillViewsTest","oldBootExecute","BootAction","prototype","execute","getFeatureInstaller","isInstalled","SettingsService","isMarkedAsInstalled","assert","isFunction","Action","wasHit","CommandService","setMockResponse","code","callback","watchAction","wait","isTrue","kill","hitCount","isEqual","emitFileChangeEvent","passedOptions","options","shouldReturnImmediately","actionPromise","didWait","waitPromise","Promise","resolve","setTimeout","isFalse","watchFeature","getFeature","wasStarted","wasStopped","startWatching","stopWatching","FeatureFixture","installCachedFeatures","getSkillFixture","registerCurrentSkill","name","getViewFixture","createViewController","nameKebab","namePascal","Service","build","results","isFalsy","errors","pid","getPid","meta","bootPromise","assertProcessRunning","doesThrowAsync","reject","ps","lookup","err","length","emitter","getEmitter","emit","changes","schemaId","version","values","action","path","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;IAEqBA,sB,WAgBnB,iB,UAKA,iB,UAmBA,iB,UAwBA,iB,UAwBA,iB,UAyBA,iB,UA8BA,iB,UAiCA,iB;;;;;;;;;;;;;qGA5KD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAEC,qBAAKC,cAAL,GAAsBC,uBAAWC,SAAX,CAAqBC,OAA3C;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;sGAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAEC,qBAAKC,mBAAL,GAA2BC,WAA3B,8FAAyC;AAAA;AAAA;AAAA;AAAA;AAAA,4DAAY,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GP6B,sBAAAA,IAAI,EAAE;AAHC;AAHT,mBADQ;AADsC,iBAA1C,CAHP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAlOmDC,8B,8DAClB,O","sourcesContent":["import { SettingsService } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport ps from 'ps-node'\nimport BootAction from '../../features/skill/actions/BootAction'\nimport WatchAction from '../../features/view/actions/WatchAction'\nimport CommandService from '../../services/CommandService'\nimport AbstractSkillTest from '../../tests/AbstractSkillTest'\n\nexport default class WatchingSkillViewsTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'views'\n\tprotected static oldBootExecute: any\n\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tthis.oldBootExecute = BootAction.prototype.execute\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tthis.getFeatureInstaller().isInstalled = async () => true\n\t\tSettingsService.prototype.isMarkedAsInstalled = () => true\n\t\tBootAction.prototype.execute = this.oldBootExecute\n\t}\n\n\t@test()\n\tprotected static async hasWatchSkillViewsEvent() {\n\t\tassert.isFunction(this.Action('view', 'watch').execute)\n\t}\n\n\t@test()\n\tprotected static async shouldCallBoot() {\n\t\tlet wasHit = false\n\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t\tcallback: () => {\n\t\t\t\twasHit = true\n\t\t\t},\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tvoid watchAction.execute({})\n\t\tawait this.wait(10)\n\t\tassert.isTrue(wasHit)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async shouldCallBootAgainOnFileChange() {\n\t\tlet hitCount = 0\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t\tcallback: () => {\n\t\t\t\thitCount++\n\t\t\t},\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\n\t\tvoid watchAction.execute({})\n\n\t\tawait this.wait(10)\n\n\t\tassert.isEqual(hitCount, 1)\n\n\t\tawait this.emitFileChangeEvent()\n\n\t\tassert.isEqual(hitCount, 2)\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async changesDuringBootOfSkillKillSkill() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\n\t\tlet passedOptions: any = null\n\n\t\t//@ts-ignore\n\t\tBootAction.prototype.execute = (options: any) => {\n\t\t\tpassedOptions = options\n\t\t}\n\n\t\tvoid watchAction.execute()\n\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(passedOptions.shouldReturnImmediately)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async holdsOnAction() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst actionPromise = watchAction.execute()\n\t\tlet didWait = false\n\t\tconst waitPromise = new Promise((resolve) => {\n\t\t\tsetTimeout(async () => {\n\t\t\t\tdidWait = true\n\t\t\t\tawait watchAction.kill()\n\t\t\t\tresolve(null)\n\t\t\t}, 1000)\n\t\t})\n\n\t\tawait actionPromise\n\t\tawait waitPromise\n\n\t\tassert.isTrue(didWait)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async canKillAction() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst actionPromise = watchAction.execute()\n\n\t\tlet didWait = false\n\t\tconst waitPromise = new Promise((resolve) => {\n\t\t\tsetTimeout(() => {\n\t\t\t\tdidWait = true\n\t\t\t\tresolve(null)\n\t\t\t}, 1000)\n\t\t})\n\n\t\tawait this.wait(100)\n\n\t\tawait watchAction.kill()\n\n\t\tawait actionPromise\n\n\t\tassert.isFalse(didWait)\n\n\t\tawait waitPromise\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async makeSureWatcherIsStartedAndStopped() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchFeature = this.getFeatureInstaller().getFeature('watch')\n\t\tlet wasStarted = false\n\t\tlet wasStopped = false\n\n\t\twatchFeature.startWatching = async () => {\n\t\t\twasStarted = true\n\t\t}\n\n\t\twatchFeature.stopWatching = async () => {\n\t\t\twasStopped = true\n\t\t}\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tvoid watchAction.execute()\n\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(wasStarted)\n\t\tassert.isFalse(wasStopped)\n\n\t\tawait watchAction.kill()\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(wasStarted)\n\t\tassert.isTrue(wasStopped)\n\t}\n\n\t@test()\n\tprotected static async killingActionKillsProcess() {\n\t\tawait this.FeatureFixture().installCachedFeatures('events')\n\t\tawait this.getSkillFixture().registerCurrentSkill({\n\t\t\tname: `Watching skill views`,\n\t\t})\n\n\t\tawait this.getViewFixture().createViewController({\n\t\t\tnameKebab: 'root',\n\t\t\tnamePascal: 'Root',\n\t\t})\n\n\t\tawait this.Action('view', 'sync').execute({})\n\t\tawait this.Service('build').build()\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst results = await watchAction.execute({ shouldReturnImmediately: true })\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tlet pid = watchAction.getPid()\n\n\t\twhile (!pid) {\n\t\t\tawait this.wait(100)\n\t\t\tpid = watchAction.getPid()\n\t\t}\n\n\t\tawait results.meta?.bootPromise\n\n\t\tawait this.assertProcessRunning(pid)\n\n\t\tawait watchAction.kill()\n\n\t\tawait this.wait(500)\n\n\t\tawait assert.doesThrowAsync(() => this.assertProcessRunning(pid as number))\n\t}\n\n\tprivate static async assertProcessRunning(pid: number) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tps.lookup({ pid }, (err: any, results: any) => {\n\t\t\t\tif (err || results.length !== 1) {\n\t\t\t\t\treject('boot process not running')\n\t\t\t\t}\n\n\t\t\t\tresolve(results)\n\t\t\t})\n\t\t})\n\t}\n\n\tprivate static async emitFileChangeEvent() {\n\t\tconst emitter = this.getEmitter()\n\n\t\tawait emitter.emit('watcher.did-detect-change', {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\tschemaId: 'generatedFile',\n\t\t\t\t\tversion: 'v2020_07_22',\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\taction: 'updated',\n\t\t\t\t\t\tname: 'Cool name!',\n\t\t\t\t\t\tpath: '/',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n}\n"],"file":"WatchingSkillViews.test.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/behavioral/WatchingSkillViews.test.ts"],"names":["WatchingSkillViewsTest","oldBootExecute","BootAction","prototype","execute","getFeatureInstaller","isInstalled","SettingsService","isMarkedAsInstalled","assert","isFunction","Action","wasHit","CommandService","setMockResponse","code","callback","watchAction","wait","isTrue","kill","hitCount","isEqual","emitFileChangeEvent","passedOptions","options","shouldReturnImmediately","actionPromise","didWait","waitPromise","Promise","resolve","setTimeout","isFalse","watchFeature","getFeature","wasStarted","wasStopped","startWatching","stopWatching","FeatureFixture","installCachedFeatures","getSkillFixture","registerCurrentSkill","name","getViewFixture","createViewController","nameKebab","namePascal","Service","build","results","isFalsy","errors","pid","getPid","meta","bootPromise","assertProcessRunning","doesThrowAsync","reject","ps","lookup","err","length","emitter","getEmitter","emit","changes","schemaId","version","values","action","path","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;IAEqBA,sB,WAgBn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K,CADP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;+GAYA;AAAA;AAAA;AAAA;AAAA;AAAA;AACOc,gBAAAA,OADP,GACiB,KAAKC,UAAL,EADjB;AAAA;AAAA,uBAGOD,OAAO,CAACE,IAAR,CAAa,2BAAb,EAA0C;AAC/CC,kBAAAA,OAAO,EAAE,CACR;AACCC,oBAAAA,QAAQ,EAAE,eADX;AAECC,oBAAAA,OAAO,EAAE,aAFV;AAGCC,oBAAAA,MAAM,EAAE;AACPC,sBAAAA,MAAM,EAAE,SADD;AAEP5B,sBAAAA,IAAI,EAAE,YAFC;AAGP6B,sBAAAA,IAAI,EAAE;AAHC;AAHT,mBADQ;AADsC,iBAA1C,CAHP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAnOmDC,8B,8DAClB,O","sourcesContent":["import { SettingsService } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport ps from 'ps-node'\nimport BootAction from '../../features/skill/actions/BootAction'\nimport WatchAction from '../../features/view/actions/WatchAction'\nimport CommandService from '../../services/CommandService'\nimport AbstractSkillTest from '../../tests/AbstractSkillTest'\n\nexport default class WatchingSkillViewsTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'views'\n\tprotected static oldBootExecute: any\n\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tthis.oldBootExecute = BootAction.prototype.execute\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tthis.getFeatureInstaller().isInstalled = async () => true\n\t\tSettingsService.prototype.isMarkedAsInstalled = () => true\n\t\tBootAction.prototype.execute = this.oldBootExecute\n\t}\n\n\t@test()\n\tprotected static async hasWatchSkillViewsEvent() {\n\t\tassert.isFunction(this.Action('view', 'watch').execute)\n\t}\n\n\t@test()\n\tprotected static async shouldCallBoot() {\n\t\tlet wasHit = false\n\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t\tcallback: () => {\n\t\t\t\twasHit = true\n\t\t\t},\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tvoid watchAction.execute({})\n\t\tawait this.wait(10)\n\t\tassert.isTrue(wasHit)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async shouldCallBootAgainOnFileChange() {\n\t\tlet hitCount = 0\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t\tcallback: () => {\n\t\t\t\thitCount++\n\t\t\t},\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\n\t\tvoid watchAction.execute({})\n\n\t\tawait this.wait(10)\n\n\t\tassert.isEqual(hitCount, 1)\n\n\t\tawait this.emitFileChangeEvent()\n\n\t\tassert.isEqual(hitCount, 2)\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async changesDuringBootOfSkillKillSkill() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\n\t\tlet passedOptions: any = null\n\n\t\t//@ts-ignore\n\t\tBootAction.prototype.execute = (options: any) => {\n\t\t\tpassedOptions = options\n\t\t}\n\n\t\tvoid watchAction.execute()\n\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(passedOptions.shouldReturnImmediately)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async holdsOnAction() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst actionPromise = watchAction.execute()\n\t\tlet didWait = false\n\t\tconst waitPromise = new Promise((resolve) => {\n\t\t\tsetTimeout(async () => {\n\t\t\t\tdidWait = true\n\t\t\t\tawait watchAction.kill()\n\t\t\t\tresolve(null)\n\t\t\t}, 1000)\n\t\t})\n\n\t\tawait actionPromise\n\t\tawait waitPromise\n\n\t\tassert.isTrue(didWait)\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async canKillAction() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst actionPromise = watchAction.execute()\n\n\t\tlet didWait = false\n\t\tconst waitPromise = new Promise((resolve) => {\n\t\t\tsetTimeout(() => {\n\t\t\t\tdidWait = true\n\t\t\t\tresolve(null)\n\t\t\t}, 1000)\n\t\t})\n\n\t\tawait this.wait(100)\n\n\t\tawait watchAction.kill()\n\n\t\tawait actionPromise\n\n\t\tassert.isFalse(didWait)\n\n\t\tawait waitPromise\n\n\t\tawait watchAction.kill()\n\t}\n\n\t@test()\n\tprotected static async makeSureWatcherIsStartedAndStopped() {\n\t\tCommandService.setMockResponse(/yarn boot/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst watchFeature = this.getFeatureInstaller().getFeature('watch')\n\t\tlet wasStarted = false\n\t\tlet wasStopped = false\n\n\t\twatchFeature.startWatching = async () => {\n\t\t\twasStarted = true\n\t\t}\n\n\t\twatchFeature.stopWatching = async () => {\n\t\t\twasStopped = true\n\t\t}\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tvoid watchAction.execute()\n\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(wasStarted)\n\t\tassert.isFalse(wasStopped)\n\n\t\tawait watchAction.kill()\n\t\tawait this.wait(100)\n\n\t\tassert.isTrue(wasStarted)\n\t\tassert.isTrue(wasStopped)\n\t}\n\n\t@test()\n\tprotected static async killingActionKillsProcess() {\n\t\tawait this.FeatureFixture().installCachedFeatures('events')\n\t\tawait this.getSkillFixture().registerCurrentSkill({\n\t\t\tname: `Watching skill views`,\n\t\t})\n\n\t\tawait this.getViewFixture().createViewController({\n\t\t\tnameKebab: 'root',\n\t\t\tnamePascal: 'Root',\n\t\t})\n\n\t\tawait this.Action('view', 'sync').execute({})\n\n\t\tawait this.Service('build').build()\n\n\t\tconst watchAction = this.Action('view', 'watch') as WatchAction\n\t\tconst results = await watchAction.execute({ shouldReturnImmediately: true })\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tlet pid = watchAction.getPid()\n\n\t\twhile (!pid) {\n\t\t\tawait this.wait(100)\n\t\t\tpid = watchAction.getPid()\n\t\t}\n\n\t\tawait results.meta?.bootPromise\n\n\t\tawait this.assertProcessRunning(pid)\n\n\t\tawait watchAction.kill()\n\n\t\tawait this.wait(500)\n\n\t\tawait assert.doesThrowAsync(() => this.assertProcessRunning(pid as number))\n\t}\n\n\tprivate static async assertProcessRunning(pid: number) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\tps.lookup({ pid }, (err: any, results: any) => {\n\t\t\t\tif (err || results.length !== 1) {\n\t\t\t\t\treject('boot process not running')\n\t\t\t\t}\n\n\t\t\t\tresolve(results)\n\t\t\t})\n\t\t})\n\t}\n\n\tprivate static async emitFileChangeEvent() {\n\t\tconst emitter = this.getEmitter()\n\n\t\tawait emitter.emit('watcher.did-detect-change', {\n\t\t\tchanges: [\n\t\t\t\t{\n\t\t\t\t\tschemaId: 'generatedFile',\n\t\t\t\t\tversion: 'v2020_07_22',\n\t\t\t\t\tvalues: {\n\t\t\t\t\t\taction: 'updated',\n\t\t\t\t\t\tname: 'Cool name!',\n\t\t\t\t\t\tpath: '/',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n}\n"],"file":"WatchingSkillViews.test.js"}
|
|
@@ -44,9 +44,9 @@ var GlobalEmitterTest = (_dec = (0, _test.test)(), (_class = /*#__PURE__*/functi
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
(0, _createClass2["default"])(GlobalEmitterTest, null, [{
|
|
47
|
-
key: "
|
|
47
|
+
key: "globalEmitterEmitsSEquentally",
|
|
48
48
|
value: function () {
|
|
49
|
-
var
|
|
49
|
+
var _globalEmitterEmitsSEquentally = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
50
50
|
var emitter;
|
|
51
51
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
52
52
|
while (1) {
|
|
@@ -64,14 +64,14 @@ var GlobalEmitterTest = (_dec = (0, _test.test)(), (_class = /*#__PURE__*/functi
|
|
|
64
64
|
}, _callee, this);
|
|
65
65
|
}));
|
|
66
66
|
|
|
67
|
-
function
|
|
68
|
-
return
|
|
67
|
+
function globalEmitterEmitsSEquentally() {
|
|
68
|
+
return _globalEmitterEmitsSEquentally.apply(this, arguments);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
return
|
|
71
|
+
return globalEmitterEmitsSEquentally;
|
|
72
72
|
}()
|
|
73
73
|
}]);
|
|
74
74
|
return GlobalEmitterTest;
|
|
75
|
-
}(_AbstractCliTest2["default"]), ((0, _applyDecoratedDescriptor2["default"])(_class, "
|
|
75
|
+
}(_AbstractCliTest2["default"]), ((0, _applyDecoratedDescriptor2["default"])(_class, "globalEmitterEmitsSEquentally", [_dec], Object.getOwnPropertyDescriptor(_class, "globalEmitterEmitsSEquentally"), _class)), _class));
|
|
76
76
|
exports["default"] = GlobalEmitterTest;
|
|
77
77
|
//# sourceMappingURL=GlobalEmitter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/__tests__/implementation/GlobalEmitter.ts"],"names":["GlobalEmitterTest","emitter","getEmitter","assert","isTrue","shouldEmitSequentally","AbstractCliTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;;;IAEqBA,iB,WACnB,iB;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/implementation/GlobalEmitter.ts"],"names":["GlobalEmitterTest","emitter","getEmitter","assert","isTrue","shouldEmitSequentally","AbstractCliTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;;;IAEqBA,iB,WACnB,iB;;;;;;;;;;;;;yHAAD;AAAA;AAAA;AAAA;AAAA;AAAA;AAEOC,gBAAAA,OAFP,GAEiB,KAAKC,UAAL,EAFjB,EAIC;;AACAC,6BAAOC,MAAP,CAAcH,OAAO,CAACI,qBAAtB;;AALD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAD8CC,4B","sourcesContent":["import { test, assert } from '@sprucelabs/test'\nimport AbstractCliTest from '../../tests/AbstractCliTest'\n\nexport default class GlobalEmitterTest extends AbstractCliTest {\n\t@test()\n\tprotected static async globalEmitterEmitsSEquentally() {\n\t\tconst emitter = this.getEmitter()\n\n\t\t//@ts-ignore\n\t\tassert.isTrue(emitter.shouldEmitSequentally)\n\t}\n}\n"],"file":"GlobalEmitter.js"}
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"chokidar-cli": "^2.1.0",
|
|
59
59
|
"concurrently": "^5.3.0",
|
|
60
60
|
"conventional-changelog-sprucelabs": "^1.1.2",
|
|
61
|
-
"eslint": "^
|
|
62
|
-
"eslint-config-spruce": "10.
|
|
61
|
+
"eslint": "^8.0.0",
|
|
62
|
+
"eslint-config-spruce": "^10.10.14",
|
|
63
63
|
"jest": "^26.6.3",
|
|
64
64
|
"jest-circus": "^26.6.3",
|
|
65
65
|
"prettier": "^2.2.0",
|
|
@@ -50,7 +50,7 @@ var SpruceError = /*#__PURE__*/function (_AbstractSpruceError) {
|
|
|
50
50
|
value:
|
|
51
51
|
/** An easy to understand version of the errors */
|
|
52
52
|
function friendlyMessage() {
|
|
53
|
-
var _options$friendlyMess, _options$originalErro2, _options$originalErro3, _options$friendlyMess2, _options$originalErro4, _options$originalErro5, _options$
|
|
53
|
+
var _options$friendlyMess, _options$originalErro2, _options$originalErro3, _options$friendlyMess2, _options$originalErro4, _options$originalErro5, _options$originalErro7, _ref, _options$friendlyMess3, _options$originalErro8;
|
|
54
54
|
|
|
55
55
|
var options = this.options;
|
|
56
56
|
var message;
|
|
@@ -109,6 +109,13 @@ var SpruceError = /*#__PURE__*/function (_AbstractSpruceError) {
|
|
|
109
109
|
|
|
110
110
|
case 'LINT_FAILED':
|
|
111
111
|
message = "Lint failed on pattern ".concat(options.pattern, ".");
|
|
112
|
+
|
|
113
|
+
if (options.originalError) {
|
|
114
|
+
var _options$originalErro6;
|
|
115
|
+
|
|
116
|
+
message += "\n\nOriginal error:".concat((_options$originalErro6 = options.originalError.stack) !== null && _options$originalErro6 !== void 0 ? _options$originalErro6 : options.originalError.message);
|
|
117
|
+
}
|
|
118
|
+
|
|
112
119
|
break;
|
|
113
120
|
|
|
114
121
|
case 'EXECUTING_COMMAND_FAILED':
|
|
@@ -213,11 +220,11 @@ var SpruceError = /*#__PURE__*/function (_AbstractSpruceError) {
|
|
|
213
220
|
break;
|
|
214
221
|
|
|
215
222
|
case 'INVALID_EVENT_CONTRACT':
|
|
216
|
-
message = "The event named `".concat(options.fullyQualifiedEventName, "` is not valid. Check ").concat(options.brokenProperty, ". The original error is:\n\n").concat((_options$
|
|
223
|
+
message = "The event named `".concat(options.fullyQualifiedEventName, "` is not valid. Check ").concat(options.brokenProperty, ". The original error is:\n\n").concat((_options$originalErro7 = options.originalError) === null || _options$originalErro7 === void 0 ? void 0 : _options$originalErro7.message);
|
|
217
224
|
break;
|
|
218
225
|
|
|
219
226
|
case 'BOOT_ERROR':
|
|
220
|
-
message = "Booting your skill failed: ".concat((_ref = (_options$friendlyMess3 = options.friendlyMessage) !== null && _options$friendlyMess3 !== void 0 ? _options$friendlyMess3 : (_options$
|
|
227
|
+
message = "Booting your skill failed: ".concat((_ref = (_options$friendlyMess3 = options.friendlyMessage) !== null && _options$friendlyMess3 !== void 0 ? _options$friendlyMess3 : (_options$originalErro8 = options.originalError) === null || _options$originalErro8 === void 0 ? void 0 : _options$originalErro8.message) !== null && _ref !== void 0 ? _ref : 'Not sure why, tho.');
|
|
221
228
|
break;
|
|
222
229
|
|
|
223
230
|
case 'DEPLOY_FAILED':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/errors/SpruceError.ts"],"names":["SpruceError","options","message","code","args","length","join","friendlyMessage","originalError","stack","name","command","file","pattern","cmd","cwd","stderr","cleanStdErr","stdout","schemaId","destination","featureCode","fileName","testName","errorMessage","split","map","line","errors","responseErrors","errorMessages","err","push","fullyQualifiedEventName","brokenProperty","dependencies","d","hint","namesUtil","toPascal","schemaNamespace","fieldName","JSON","stringify","fieldOptions","replace","trim","AbstractSpruceError"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;;;IAGqBA,W;;;;;;;;;;;;;AACpB;AACA,+BAAiC;AAAA;;AAChC,UAAQC,OAAR,GAAoB,IAApB,CAAQA,OAAR;AACA,UAAIC,OAAJ;;AAEA,cAAQD,OAAR,aAAQA,OAAR,uBAAQA,OAAO,CAAEE,IAAjB;AACC,aAAK,iBAAL;AACC,cAAI,CAACF,OAAO,CAACG,IAAT,IAAiBH,OAAO,CAACG,IAAR,CAAaC,MAAb,KAAwB,CAA7C,EAAgD;AAC/CH,YAAAA,OAAO,qEAAP;AACA,WAFD,MAEO;AACNA,YAAAA,OAAO,gEAA+CD,OAAO,CAACG,IAAR,CAAaE,IAAb,CACrD,GADqD,CAA/C,MAAP;AAGA;;AACDJ,UAAAA,OAAO,IAAI,8BAAX;AACA;;AAED,aAAK,SAAL;AACCA,UAAAA,OAAO,4BAAGD,OAAO,CAACM,eAAX,yEAA8B,cAArC;;AAEA,cAAIN,OAAO,CAACO,aAAZ,EAA2B;AAAA;;AAC1BN,YAAAA,OAAO,2CACND,OAAO,CAACO,aAAR,CAAsBC,KADhB,yEACyBR,OAAO,CAACO,aAAR,CAAsBE,IAD/C,CAAP;AAGA;;AACD;;AACD,aAAK,iBAAL;AACCR,UAAAA,OAAO,GAAG,EAAV;;AACA,cAAID,OAAO,CAACM,eAAZ,EAA6B;AAC5BL,YAAAA,OAAO,kBAAWD,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OAAO,oGAAP;AACA;;AAED,aAAK,iBAAL;AACCA,UAAAA,OAAO,aAAMD,OAAO,CAACU,OAAd,0BAAqCV,OAAO,CAACoC,IAA7C,CAAP;AACA;;AAED,aAAK,mBAAL;AACCnC,UAAAA,OAAO,0DAAmDD,OAAO,CAACS,IAA3D,MAAP;AACA;;AAED,aAAK,cAAL;AACCR,UAAAA,OAAO,gEAAP;AACA;;AAED,aAAK,mBAAL;AACCA,UAAAA,OAAO,GAAG,gDAAV;AACA;;AAED,aAAK,oBAAL;AACCA,UAAAA,OAAO,GAAG,sDAAV;AACA;;AAED,aAAK,sCAAL;AACCA,UAAAA,OAAO,uDAAgDoC,4BAAUC,QAAV,CACtDtC,OAAO,CAACuC,eAD8C,CAAhD,cAEFvC,OAAO,CAACkB,QAFN,iDAGNlB,OAAO,CAACwC,SAHF,qCAIoBC,IAAI,CAACC,SAAL,CAC1B1C,OAAO,CAAC2C,YADkB,CAJpB,sLAAP;AAOA;;AAED,aAAK,kBAAL;AACC1C,UAAAA,OAAO,GAAG,mCAAV;AACA;;AAED,aAAK,0BAAL;AACCA,UAAAA,OAAO,gCAAyBD,OAAO,CAACS,IAAjC,sBAAP;AACA;;AAED;AACCR,UAAAA,OAAO,qHAAP;AA7OF;;AAgPA,aAAOA,OAAP;AACA;;;WAED,qBAAoBc,MAApB,EAAoC;AACnC,aAAOA,MAAM,CAAC6B,OAAP,CAAe,wCAAf,EAAyD,EAAzD,EAA6DC,IAA7D,EAAP;AACA;;;EA3PuCC,iB","sourcesContent":["import AbstractSpruceError from '@sprucelabs/error'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport upperFirst from 'lodash/upperFirst'\nimport ErrorOptions from '#spruce/errors/options.types'\n\nexport default class SpruceError extends AbstractSpruceError<ErrorOptions> {\n\t/** An easy to understand version of the errors */\n\tpublic friendlyMessage(): string {\n\t\tconst { options } = this\n\t\tlet message\n\n\t\tswitch (options?.code) {\n\t\t\tcase 'INVALID_COMMAND':\n\t\t\t\tif (!options.args || options.args.length === 0) {\n\t\t\t\t\tmessage = `Hey friend 👋.. I don't support the command you tried.`\n\t\t\t\t} else {\n\t\t\t\t\tmessage = `Hey friend 👋. I don't know the command: ${options.args.join(\n\t\t\t\t\t\t' '\n\t\t\t\t\t)}.`\n\t\t\t\t}\n\t\t\t\tmessage += ' Try running `spruce --help`'\n\t\t\t\tbreak\n\n\t\t\tcase 'GENERIC':\n\t\t\t\tmessage = options.friendlyMessage ?? 'Oh shoot! 🤔'\n\n\t\t\t\tif (options.originalError) {\n\t\t\t\t\tmessage += `\\n\\n${\n\t\t\t\t\t\toptions.originalError.stack ?? options.originalError.name\n\t\t\t\t\t}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'NOT_IMPLEMENTED':\n\t\t\t\tmessage = ''\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'COMMAND_NOT_IMPLEMENTED':\n\t\t\t\tmessage = `${options.command} has not yet been implemented. ${\n\t\t\t\t\toptions.args ? `Args: ${options.args.join(', ')}` : ''\n\t\t\t\t}`\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_FAILED_TO_IMPORT':\n\t\t\t\tmessage = `Error importing \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BUILD_FAILED':\n\t\t\t\tmessage = `Build${\n\t\t\t\t\toptions.file ? `ing ${options.file}` : ''\n\t\t\t\t} failed. It looks like you're not running 'yarn watch'. Run it and then run 'spruce all:sync'.`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FAILED_TO_IMPORT':\n\t\t\t\tmessage =\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\t`Failed to import \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'LINT_FAILED':\n\t\t\t\tmessage = `Lint failed on pattern ${options.pattern}.`\n\t\t\t\tbreak\n\n\t\t\tcase 'EXECUTING_COMMAND_FAILED':\n\t\t\t\tif (this.originalError && this.originalError.message) {\n\t\t\t\t\tmessage = this.originalError.message + '\\n\\n'\n\t\t\t\t} else {\n\t\t\t\t\tmessage = ''\n\t\t\t\t}\n\t\t\t\tmessage += `Executing command failed '${options.cmd}'.\\n\\n`\n\t\t\t\tif (options.cwd) {\n\t\t\t\t\tmessage += `cwd: ${options.cwd}\\n\\n`\n\t\t\t\t}\n\n\t\t\t\tif (options.stderr) {\n\t\t\t\t\tmessage += this.cleanStdErr(options.stderr) + '\\n\\n'\n\t\t\t\t}\n\n\t\t\t\tif (options.stdout) {\n\t\t\t\t\tmessage += options.stdout\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'CREATE_AUTOLOADER_FAILED':\n\t\t\t\tmessage = 'A Could not create an autoloader just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_EMPTY':\n\t\t\t\tmessage = 'A directory empty just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'FILE_EXISTS':\n\t\t\t\tmessage = 'A fail already exists.'\n\t\t\t\tbreak\n\n\t\t\tcase 'VSCODE_NOT_INSTALLED':\n\t\t\t\tmessage =\n\t\t\t\t\t\"vscode's 'code' is not installed.\\n\\nMac instructions: https://code.visualstudio.com/docs/setup/mac\\n\\nLinux instructions: https://code.visualstudio.com/docs/setup/linux\\n\\nWindows instructions: https://code.visualstudio.com/docs/setup/windows\"\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_EXISTS':\n\t\t\t\tmessage = `A schema called ${options.schemaId} already exists at ${options.destination}`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_ABORTED':\n\t\t\t\tmessage = 'Aborted! See ya later! ✌️'\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_FEATURE_CODE':\n\t\t\t\tmessage = `Oh no! I couldn't find a feature with the code '${options.featureCode}'.`\n\t\t\t\tbreak\n\n\t\t\tcase 'TEST_FAILED':\n\t\t\t\tmessage = `${options.fileName}\\n - ${\n\t\t\t\t\toptions.testName\n\t\t\t\t}\\n\\n${options.errorMessage\n\t\t\t\t\t.split('\\n')\n\t\t\t\t\t.map((line) => ` ${line}`)\n\t\t\t\t\t.join('\\n')}`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FEATURE_NOT_INSTALLED':\n\t\t\t\tmessage = `\\`${upperFirst(\n\t\t\t\t\toptions.featureCode\n\t\t\t\t)}\\` feature is not installed. Install it first, then try again.`\n\t\t\t\tbreak\n\n\t\t\tcase 'MERCURY_RESPONSE_ERROR': {\n\t\t\t\tconst errors = options.responseErrors\n\t\t\t\tmessage = `Got ${\n\t\t\t\t\terrors.length === 1 ? 'an error' : `${errors.length} errors`\n\t\t\t\t} from the server:\\n\\n`\n\n\t\t\t\tconst errorMessages: string[] = []\n\t\t\t\tfor (const err of errors) {\n\t\t\t\t\terrorMessages.push(err.message)\n\t\t\t\t}\n\n\t\t\t\tmessage += errorMessages.join('\\n')\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'INVALID_TEST_DIRECTORY':\n\t\t\t\tmessage = `You are missing dependencies I need to run tests. Try \\`spruce test.install\\` to reinstall.`\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_NOT_SKILL':\n\t\t\t\tmessage = 'The directory you are in is not a skill!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_REGISTERED':\n\t\t\t\tmessage = `Dang! I can't continue until you register your skill! Run \\`spruce login\\` and then \\`spruce register.skill\\` to get the ball rolling!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_ORGANIZATIONS_FOUND':\n\t\t\t\tmessage =\n\t\t\t\t\t\"It looks like you don't have any organizations setup yet. Try `spruce create.organization` first.\"\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_EVENT_CONTRACT':\n\t\t\t\tmessage = `The event named \\`${options.fullyQualifiedEventName}\\` is not valid. Check ${options.brokenProperty}. The original error is:\\n\\n${options.originalError?.message}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BOOT_ERROR':\n\t\t\t\tmessage = `Booting your skill failed: ${\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\toptions.originalError?.message ??\n\t\t\t\t\t'Not sure why, tho.'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'DEPLOY_FAILED':\n\t\t\t\tmessage = 'Deploy halted!'\n\t\t\t\tbreak\n\n\t\t\tcase 'MISSING_DEPENDENCIES':\n\t\t\t\tmessage = `Looks like you're missing some dependencies:\\n\\n${options.dependencies\n\t\t\t\t\t.map((d) => `${d.name}: ${d.hint}`)\n\t\t\t\t\t.join('\\n')}`\n\t\t\t\tbreak\n\n\t\t\tcase 'STORE_EXISTS':\n\t\t\t\tmessage = 'A Store exists just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'NOT_LOGGED_IN':\n\t\t\t\tmessage = 'You have to be logged in to do that!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_FOUND':\n\t\t\t\tmessage = `I couldn't find that skill!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_SKILLS_REGISTERED':\n\t\t\t\tmessage = `Whoa! Looks like you haven't registered your skill yet! Try \\`spruce register\\` to get that done!`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_BLOCKED':\n\t\t\t\tmessage = `${options.command} is blocked! ${options.hint}`\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_VIEW_EXISTS':\n\t\t\t\tmessage = `A skill view controller already exists named ${options.name}!`\n\t\t\t\tbreak\n\n\t\t\tcase 'THEME_EXISTS':\n\t\t\t\tmessage = `Yikes! You can't create a new theme. One per skill for now.`\n\t\t\t\tbreak\n\n\t\t\tcase 'CACHE_NOT_ENABLED':\n\t\t\t\tmessage = \"Cache is not enabled, so it can't be disabled!\"\n\t\t\t\tbreak\n\n\t\t\tcase 'DOCKER_NOT_STARTED':\n\t\t\t\tmessage = 'Docker has not been started! Start it and try again!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_TEMPLATE_ITEM_BUILDING_FAILED':\n\t\t\t\tmessage = `Failed to build schema template item for '${namesUtil.toPascal(\n\t\t\t\t\toptions.schemaNamespace\n\t\t\t\t)}.${options.schemaId}'. The field I had an issue on was '${\n\t\t\t\t\toptions.fieldName\n\t\t\t\t}'. It's options are:\\n\\n${JSON.stringify(\n\t\t\t\t\toptions.fieldOptions\n\t\t\t\t)}.\\n\\nChances are you have a circular reference in your schemas. You'll need to extract shared fields to a new file and have your schemas mix those in, vs referencing eath other.`\n\t\t\t\tbreak\n\n\t\t\tcase 'ACTION_CANCELLED':\n\t\t\t\tmessage = 'A Action cancelled just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'TRANSPORT_ALREADY_EXISTS':\n\t\t\t\tmessage = `A transport named '${options.name}' already exists!`\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tmessage = super.friendlyMessage()\n\t\t}\n\n\t\treturn message\n\t}\n\n\tprivate cleanStdErr(stderr: string) {\n\t\treturn stderr.replace('warning package.json: No license field', '').trim()\n\t}\n}\n"],"file":"SpruceError.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/errors/SpruceError.ts"],"names":["SpruceError","options","message","code","args","length","join","friendlyMessage","originalError","stack","name","command","file","pattern","cmd","cwd","stderr","cleanStdErr","stdout","schemaId","destination","featureCode","fileName","testName","errorMessage","split","map","line","errors","responseErrors","errorMessages","err","push","fullyQualifiedEventName","brokenProperty","dependencies","d","hint","namesUtil","toPascal","schemaNamespace","fieldName","JSON","stringify","fieldOptions","replace","trim","AbstractSpruceError"],"mappings":";;;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CAACS,IAA3D,MAAP;AACA;;AAED,aAAK,cAAL;AACCR,UAAAA,OAAO,gEAAP;AACA;;AAED,aAAK,mBAAL;AACCA,UAAAA,OAAO,GAAG,gDAAV;AACA;;AAED,aAAK,oBAAL;AACCA,UAAAA,OAAO,GAAG,sDAAV;AACA;;AAED,aAAK,sCAAL;AACCA,UAAAA,OAAO,uDAAgDoC,4BAAUC,QAAV,CACtDtC,OAAO,CAACuC,eAD8C,CAAhD,cAEFvC,OAAO,CAACkB,QAFN,iDAGNlB,OAAO,CAACwC,SAHF,qCAIoBC,IAAI,CAACC,SAAL,CAC1B1C,OAAO,CAAC2C,YADkB,CAJpB,sLAAP;AAOA;;AAED,aAAK,kBAAL;AACC1C,UAAAA,OAAO,GAAG,mCAAV;AACA;;AAED,aAAK,0BAAL;AACCA,UAAAA,OAAO,gCAAyBD,OAAO,CAACS,IAAjC,sBAAP;AACA;;AAED;AACCR,UAAAA,OAAO,qHAAP;AApPF;;AAuPA,aAAOA,OAAP;AACA;;;WAED,qBAAoBc,MAApB,EAAoC;AACnC,aAAOA,MAAM,CAAC6B,OAAP,CAAe,wCAAf,EAAyD,EAAzD,EAA6DC,IAA7D,EAAP;AACA;;;EAlQuCC,iB","sourcesContent":["import AbstractSpruceError from '@sprucelabs/error'\nimport { namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport upperFirst from 'lodash/upperFirst'\nimport ErrorOptions from '#spruce/errors/options.types'\n\nexport default class SpruceError extends AbstractSpruceError<ErrorOptions> {\n\t/** An easy to understand version of the errors */\n\tpublic friendlyMessage(): string {\n\t\tconst { options } = this\n\t\tlet message\n\n\t\tswitch (options?.code) {\n\t\t\tcase 'INVALID_COMMAND':\n\t\t\t\tif (!options.args || options.args.length === 0) {\n\t\t\t\t\tmessage = `Hey friend 👋.. I don't support the command you tried.`\n\t\t\t\t} else {\n\t\t\t\t\tmessage = `Hey friend 👋. I don't know the command: ${options.args.join(\n\t\t\t\t\t\t' '\n\t\t\t\t\t)}.`\n\t\t\t\t}\n\t\t\t\tmessage += ' Try running `spruce --help`'\n\t\t\t\tbreak\n\n\t\t\tcase 'GENERIC':\n\t\t\t\tmessage = options.friendlyMessage ?? 'Oh shoot! 🤔'\n\n\t\t\t\tif (options.originalError) {\n\t\t\t\t\tmessage += `\\n\\n${\n\t\t\t\t\t\toptions.originalError.stack ?? options.originalError.name\n\t\t\t\t\t}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'NOT_IMPLEMENTED':\n\t\t\t\tmessage = ''\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'COMMAND_NOT_IMPLEMENTED':\n\t\t\t\tmessage = `${options.command} has not yet been implemented. ${\n\t\t\t\t\toptions.args ? `Args: ${options.args.join(', ')}` : ''\n\t\t\t\t}`\n\t\t\t\tif (options.friendlyMessage) {\n\t\t\t\t\tmessage += `\\n\\n${options.friendlyMessage}`\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_FAILED_TO_IMPORT':\n\t\t\t\tmessage = `Error importing \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BUILD_FAILED':\n\t\t\t\tmessage = `Build${\n\t\t\t\t\toptions.file ? `ing ${options.file}` : ''\n\t\t\t\t} failed. It looks like you're not running 'yarn watch'. Run it and then run 'spruce all:sync'.`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FAILED_TO_IMPORT':\n\t\t\t\tmessage =\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\t`Failed to import \"${options.file}\". Original error:\\n\\n${\n\t\t\t\t\t\toptions.originalError?.message ?? '**MISSING**'\n\t\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'LINT_FAILED':\n\t\t\t\tmessage = `Lint failed on pattern ${options.pattern}.`\n\n\t\t\t\tif (options.originalError) {\n\t\t\t\t\tmessage += `\\n\\nOriginal error:${\n\t\t\t\t\t\toptions.originalError.stack ?? options.originalError.message\n\t\t\t\t\t}`\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'EXECUTING_COMMAND_FAILED':\n\t\t\t\tif (this.originalError && this.originalError.message) {\n\t\t\t\t\tmessage = this.originalError.message + '\\n\\n'\n\t\t\t\t} else {\n\t\t\t\t\tmessage = ''\n\t\t\t\t}\n\t\t\t\tmessage += `Executing command failed '${options.cmd}'.\\n\\n`\n\t\t\t\tif (options.cwd) {\n\t\t\t\t\tmessage += `cwd: ${options.cwd}\\n\\n`\n\t\t\t\t}\n\n\t\t\t\tif (options.stderr) {\n\t\t\t\t\tmessage += this.cleanStdErr(options.stderr) + '\\n\\n'\n\t\t\t\t}\n\n\t\t\t\tif (options.stdout) {\n\t\t\t\t\tmessage += options.stdout\n\t\t\t\t}\n\n\t\t\t\tbreak\n\n\t\t\tcase 'CREATE_AUTOLOADER_FAILED':\n\t\t\t\tmessage = 'A Could not create an autoloader just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_EMPTY':\n\t\t\t\tmessage = 'A directory empty just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'FILE_EXISTS':\n\t\t\t\tmessage = 'A fail already exists.'\n\t\t\t\tbreak\n\n\t\t\tcase 'VSCODE_NOT_INSTALLED':\n\t\t\t\tmessage =\n\t\t\t\t\t\"vscode's 'code' is not installed.\\n\\nMac instructions: https://code.visualstudio.com/docs/setup/mac\\n\\nLinux instructions: https://code.visualstudio.com/docs/setup/linux\\n\\nWindows instructions: https://code.visualstudio.com/docs/setup/windows\"\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_EXISTS':\n\t\t\t\tmessage = `A schema called ${options.schemaId} already exists at ${options.destination}`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_ABORTED':\n\t\t\t\tmessage = 'Aborted! See ya later! ✌️'\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_FEATURE_CODE':\n\t\t\t\tmessage = `Oh no! I couldn't find a feature with the code '${options.featureCode}'.`\n\t\t\t\tbreak\n\n\t\t\tcase 'TEST_FAILED':\n\t\t\t\tmessage = `${options.fileName}\\n - ${\n\t\t\t\t\toptions.testName\n\t\t\t\t}\\n\\n${options.errorMessage\n\t\t\t\t\t.split('\\n')\n\t\t\t\t\t.map((line) => ` ${line}`)\n\t\t\t\t\t.join('\\n')}`\n\n\t\t\t\tbreak\n\n\t\t\tcase 'FEATURE_NOT_INSTALLED':\n\t\t\t\tmessage = `\\`${upperFirst(\n\t\t\t\t\toptions.featureCode\n\t\t\t\t)}\\` feature is not installed. Install it first, then try again.`\n\t\t\t\tbreak\n\n\t\t\tcase 'MERCURY_RESPONSE_ERROR': {\n\t\t\t\tconst errors = options.responseErrors\n\t\t\t\tmessage = `Got ${\n\t\t\t\t\terrors.length === 1 ? 'an error' : `${errors.length} errors`\n\t\t\t\t} from the server:\\n\\n`\n\n\t\t\t\tconst errorMessages: string[] = []\n\t\t\t\tfor (const err of errors) {\n\t\t\t\t\terrorMessages.push(err.message)\n\t\t\t\t}\n\n\t\t\t\tmessage += errorMessages.join('\\n')\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'INVALID_TEST_DIRECTORY':\n\t\t\t\tmessage = `You are missing dependencies I need to run tests. Try \\`spruce test.install\\` to reinstall.`\n\t\t\t\tbreak\n\n\t\t\tcase 'DIRECTORY_NOT_SKILL':\n\t\t\t\tmessage = 'The directory you are in is not a skill!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_REGISTERED':\n\t\t\t\tmessage = `Dang! I can't continue until you register your skill! Run \\`spruce login\\` and then \\`spruce register.skill\\` to get the ball rolling!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_ORGANIZATIONS_FOUND':\n\t\t\t\tmessage =\n\t\t\t\t\t\"It looks like you don't have any organizations setup yet. Try `spruce create.organization` first.\"\n\t\t\t\tbreak\n\n\t\t\tcase 'INVALID_EVENT_CONTRACT':\n\t\t\t\tmessage = `The event named \\`${options.fullyQualifiedEventName}\\` is not valid. Check ${options.brokenProperty}. The original error is:\\n\\n${options.originalError?.message}`\n\t\t\t\tbreak\n\n\t\t\tcase 'BOOT_ERROR':\n\t\t\t\tmessage = `Booting your skill failed: ${\n\t\t\t\t\toptions.friendlyMessage ??\n\t\t\t\t\toptions.originalError?.message ??\n\t\t\t\t\t'Not sure why, tho.'\n\t\t\t\t}`\n\t\t\t\tbreak\n\n\t\t\tcase 'DEPLOY_FAILED':\n\t\t\t\tmessage = 'Deploy halted!'\n\t\t\t\tbreak\n\n\t\t\tcase 'MISSING_DEPENDENCIES':\n\t\t\t\tmessage = `Looks like you're missing some dependencies:\\n\\n${options.dependencies\n\t\t\t\t\t.map((d) => `${d.name}: ${d.hint}`)\n\t\t\t\t\t.join('\\n')}`\n\t\t\t\tbreak\n\n\t\t\tcase 'STORE_EXISTS':\n\t\t\t\tmessage = 'A Store exists just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'NOT_LOGGED_IN':\n\t\t\t\tmessage = 'You have to be logged in to do that!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_NOT_FOUND':\n\t\t\t\tmessage = `I couldn't find that skill!`\n\t\t\t\tbreak\n\n\t\t\tcase 'NO_SKILLS_REGISTERED':\n\t\t\t\tmessage = `Whoa! Looks like you haven't registered your skill yet! Try \\`spruce register\\` to get that done!`\n\t\t\t\tbreak\n\n\t\t\tcase 'COMMAND_BLOCKED':\n\t\t\t\tmessage = `${options.command} is blocked! ${options.hint}`\n\t\t\t\tbreak\n\n\t\t\tcase 'SKILL_VIEW_EXISTS':\n\t\t\t\tmessage = `A skill view controller already exists named ${options.name}!`\n\t\t\t\tbreak\n\n\t\t\tcase 'THEME_EXISTS':\n\t\t\t\tmessage = `Yikes! You can't create a new theme. One per skill for now.`\n\t\t\t\tbreak\n\n\t\t\tcase 'CACHE_NOT_ENABLED':\n\t\t\t\tmessage = \"Cache is not enabled, so it can't be disabled!\"\n\t\t\t\tbreak\n\n\t\t\tcase 'DOCKER_NOT_STARTED':\n\t\t\t\tmessage = 'Docker has not been started! Start it and try again!'\n\t\t\t\tbreak\n\n\t\t\tcase 'SCHEMA_TEMPLATE_ITEM_BUILDING_FAILED':\n\t\t\t\tmessage = `Failed to build schema template item for '${namesUtil.toPascal(\n\t\t\t\t\toptions.schemaNamespace\n\t\t\t\t)}.${options.schemaId}'. The field I had an issue on was '${\n\t\t\t\t\toptions.fieldName\n\t\t\t\t}'. It's options are:\\n\\n${JSON.stringify(\n\t\t\t\t\toptions.fieldOptions\n\t\t\t\t)}.\\n\\nChances are you have a circular reference in your schemas. You'll need to extract shared fields to a new file and have your schemas mix those in, vs referencing eath other.`\n\t\t\t\tbreak\n\n\t\t\tcase 'ACTION_CANCELLED':\n\t\t\t\tmessage = 'A Action cancelled just happened!'\n\t\t\t\tbreak\n\n\t\t\tcase 'TRANSPORT_ALREADY_EXISTS':\n\t\t\t\tmessage = `A transport named '${options.name}' already exists!`\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tmessage = super.friendlyMessage()\n\t\t}\n\n\t\treturn message\n\t}\n\n\tprivate cleanStdErr(stderr: string) {\n\t\treturn stderr.replace('warning package.json: No license field', '').trim()\n\t}\n}\n"],"file":"SpruceError.js"}
|
|
@@ -226,7 +226,7 @@ var TestReporter = /*#__PURE__*/function () {
|
|
|
226
226
|
value: function updateOrientation() {
|
|
227
227
|
var frame = this.window.getFrame();
|
|
228
228
|
|
|
229
|
-
if (frame.width * 0.
|
|
229
|
+
if (frame.width * 0.5 > frame.height) {
|
|
230
230
|
this.orientation = 'landscape';
|
|
231
231
|
} else {
|
|
232
232
|
this.orientation = 'portrait';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/test/TestReporter.ts"],"names":["TestReporter","options","totalTestFiles","customErrors","cwd","filterPattern","handleRestart","handleStartStop","handleQuit","handleRerunTestFile","handleOpenTestFile","handleFilterChange","handleFilterPatternChange","status","handleToggleDebug","handletoggleStandardWatch","isDebugging","watchMode","handleToggleSmartWatch","errorLogItemGenerator","TestLogItemGenerator","widgetFactory","WidgetFactory","pattern","filterInput","setValue","clearFilterPatternButton","setText","buildPatternButtonText","menu","setTextForItem","durationSec","clearInterval","countDownTimeInterval","undefined","remaining","renderCountdownTime","time","setWatchLabel","setInterval","stopCountdownTimer","setWatchMode","label","isWatching","started","window","Widget","hideCursor","getFrame","width","minWidth","Error","on","handleGlobalKeypress","bind","destroy","handleWindowResize","dropInTopLayout","dropInProgressBar","dropInMenu","dropInBottomLayout","dropInStatusBar","dropInTestLog","dropInFilterControls","updateOrientation","setIsDebugging","setStatus","updateInterval","handleUpdateInterval","frame","height","orientation","parent","left","top","shouldLockWidthWithParent","items","value","handleMenuSelect","updateMenuLabels","closeSelectTestPopup","bottomLayout","updateLayout","setStatusLabel","refreshResults","restartLabel","payload","lastResults","updateLogs","getFocusedWidget","key","process","exit","getChildById","testLog","isScrollEnabled","shouldLockHeightWithParent","handleClickTestLog","testFile","getFileForLine","row","column","dropInSelectTestPopup","selectTestPopup","Math","max","text","open","rerun","cancel","openTestFile","line","getScrollY","testFiles","file","path","c","tests","length","topLayout","bar","progress","buttonWidth","shouldLockRightWithParent","rows","columns","id","statusBar","shouldLockBottomWithParent","backgroundColor","foregroundColor","results","updateProgressBar","percentPassing","generatePercentPassing","percentComplete","generatePercentComplete","setTitle","resultsToLogContents","logContent","errorContent","errorLog","destroyErrorLog","dropInErrorLog","cleanedLog","replace","RegExp","forEach","generateLogItemForFile","generateErrorLogItemForFile","map","err","chalk","red","join","orientationWhenErrorLogWasShown","getRows","addRow","setRowHeight","addColumn","setColumnWidth","rowIdx","columnIdx","cell","shouldAutoScrollWhenAppendingContent","padding","removeColumn","removeRow","totalTestFilesComplete","testsRemaining","generateProgressStats","percent","totalTests","totalPassedTests","totalTime","setLabel","durationUtil","msToFriendly","setProgress","test","duration","floor","isNaN","round","totalPassed","getTotalTestFilesRun","totalSkipped","totalTodo","table","computeCells","draw","resetStartTimes","message","push"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AASA;;AAEA;;;;;;;;;;;;IA2BqBA,Y;AAyCpB,wBAAmBC,OAAnB,EAAkD;AAAA;;AAAA;AAAA,sDAxChC,KAwCgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0DAjCP;AAC1CC,MAAAA,cAAc,EAAE,CAD0B;AAE1CC,MAAAA,YAAY,EAAE;AAF4B,KAiCO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0DAnB5B,KAmB4B;AAAA,wDAlBnB,KAkBmB;AAAA,qDAjBf,OAiBe;AAAA;AAAA;AAAA,0DAdH,WAcG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uDAH/B,EAG+B;AAAA,8EAFiB,WAEjB;AACjD,SAAKC,GAAL,GAAWH,OAAX,aAAWA,OAAX,uBAAWA,OAAO,CAAEG,GAApB;AACA,SAAKC,aAAL,GAAqBJ,OAArB,aAAqBA,OAArB,uBAAqBA,OAAO,CAAEI,aAA9B;AACA,SAAKC,aAAL,GAAqBL,OAArB,aAAqBA,OAArB,uBAAqBA,OAAO,CAAEK,aAA9B;AACA,SAAKC,eAAL,GAAuBN,OAAvB,aAAuBA,OAAvB,uBAAuBA,OAAO,CAAEM,eAAhC;AACA,SAAKC,UAAL,GAAkBP,OAAlB,aAAkBA,OAAlB,uBAAkBA,OAAO,CAAEO,UAA3B;AACA,SAAKC,mBAAL,GAA2BR,OAA3B,aAA2BA,OAA3B,uBAA2BA,OAAO,CAAEQ,mBAApC;AACA,SAAKC,kBAAL,GAA0BT,OAA1B,aAA0BA,OAA1B,uBAA0BA,OAAO,CAAES,kBAAnC;AACA,SAAKC,kBAAL,GAA0BV,OAA1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B,2BAECvD,OAAO,CAACwD,SAFT,mEAEsB,CAFtB,CADD;AAKA;;;WAED,kBAAgB;AAAA;;AACf,0BAAKC,KAAL,4DAAYC,YAAZ;AACA,2BAAKD,KAAL,8DAAYE,IAAZ;AACA;;;;mGAED;AAAA;AAAA;AAAA;AAAA;AACC9J,gBAAAA,aAAa,CAAC,KAAKmC,cAAN,CAAb;AADD;AAAA,uBAEO,KAAKtB,MAAL,CAAYU,OAAZ,EAFP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAKA,iBAAe;AACd,WAAKuC,OAAL,CAAanE,OAAb,CAAqB,EAArB;AACA,WAAK4D,WAAL,GAAmB;AAClBrF,QAAAA,cAAc,EAAE,CADE;AAElBC,QAAAA,YAAY,EAAE;AAFI,OAAnB;AAIA,WAAK2I,eAAL;AACA,WAAK3H,qBAAL,CAA2B4K,eAA3B;AACA;;;WAED,wBAAsBrF,IAAtB,EAAoC;AACnC,WAAKqB,SAAL,CAAepG,OAAf,CAAuB+E,IAAvB;AACA;;;WAED,qBAAmBsF,OAAnB,EAAoC;AACnC,WAAKzG,WAAL,CAAiBpF,YAAjB,CAA8B8L,IAA9B,CAAmCD,OAAnC;AACA;;;;;;;AAEF,SAASpK,sBAAT,CAAgCL,OAAhC,EAAqE;AACpE,SAAOA,OAAO,GAAG,KAAH,GAAW,KAAzB;AACA","sourcesContent":["import chalk from 'chalk'\nimport durationUtil from '../../utilities/duration.utility'\nimport { ButtonWidget } from '../../widgets/types/button.types'\nimport { InputWidget } from '../../widgets/types/input.types'\nimport { LayoutWidget } from '../../widgets/types/layout.types'\nimport { MenuBarWidget } from '../../widgets/types/menuBar.types'\nimport { PopupWidget } from '../../widgets/types/popup.types'\nimport { ProgressBarWidget } from '../../widgets/types/progressBar.types'\nimport { TextWidget } from '../../widgets/types/text.types'\nimport { WindowWidget } from '../../widgets/types/window.types'\nimport WidgetFactory from '../../widgets/WidgetFactory'\nimport { SpruceTestResults, TestRunnerStatus } from './test.types'\nimport TestLogItemGenerator from './TestLogItemGenerator'\n\ninterface TestReporterOptions {\n\thandleStartStop?: () => void\n\thandleRestart?: () => void\n\thandleQuit?: () => void\n\tonRequestOpenTestFile?: () => void\n\thandleRerunTestFile?: (fileName: string) => void\n\thandleOpenTestFile?: (fileName: string) => void\n\thandleFilterPatternChange?: (pattern?: string) => void\n\thandleToggleDebug?: () => void\n\thandletoggleStandardWatch?: () => void\n\thandleToggleSmartWatch?: () => void\n\tfilterPattern?: string\n\tisDebugging?: boolean\n\twatchMode?: WatchMode\n\tstatus?: TestRunnerStatus\n\tcwd?: string\n}\n\ntype TestReporterResults = SpruceTestResults & {\n\tcustomErrors: string[]\n}\n\nexport type TestReporterOrientation = 'landscape' | 'portrait'\nexport type WatchMode = 'off' | 'standard' | 'smart'\n\nexport default class TestReporter {\n\tprivate started = false\n\tprivate table?: any\n\tprivate bar!: ProgressBarWidget\n\tprivate bottomLayout!: LayoutWidget\n\tprivate testLog!: TextWidget\n\tprivate errorLog?: TextWidget\n\tprivate errorLogItemGenerator: TestLogItemGenerator\n\tprivate lastResults: TestReporterResults = {\n\t\ttotalTestFiles: 0,\n\t\tcustomErrors: [],\n\t}\n\tprivate updateInterval?: any\n\tprivate menu!: MenuBarWidget\n\tprivate statusBar!: TextWidget\n\tprivate window!: WindowWidget\n\tprivate widgetFactory: WidgetFactory\n\tprivate selectTestPopup?: PopupWidget\n\tprivate topLayout!: LayoutWidget\n\tprivate filterInput!: InputWidget\n\tprivate filterPattern?: string\n\tprivate clearFilterPatternButton!: ButtonWidget\n\tprivate isDebugging = false\n\tprivate watchMode: WatchMode = 'off'\n\tprivate status: TestRunnerStatus = 'ready'\n\tprivate countDownTimeInterval?: number\n\tprivate cwd: string | undefined\n\tprivate orientation: TestReporterOrientation = 'landscape'\n\n\tprivate handleStartStop?: () => void\n\tprivate handleRestart?: () => void\n\tprivate handleQuit?: () => void\n\tprivate handleRerunTestFile?: (fileName: string) => void\n\tprivate handleFilterChange?: (pattern?: string) => void\n\tprivate handleOpenTestFile?: (testFile: string) => void\n\tprivate handleToggleDebug?: () => void\n\tprivate handletoggleStandardWatch?: () => void\n\tprivate handleToggleSmartWatch?: () => any\n\tprivate minWidth = 50\n\tprivate orientationWhenErrorLogWasShown: TestReporterOrientation = 'landscape'\n\n\tpublic constructor(options?: TestReporterOptions) {\n\t\tthis.cwd = options?.cwd\n\t\tthis.filterPattern = options?.filterPattern\n\t\tthis.handleRestart = options?.handleRestart\n\t\tthis.handleStartStop = options?.handleStartStop\n\t\tthis.handleQuit = options?.handleQuit\n\t\tthis.handleRerunTestFile = options?.handleRerunTestFile\n\t\tthis.handleOpenTestFile = options?.handleOpenTestFile\n\t\tthis.handleFilterChange = options?.handleFilterPatternChange\n\t\tthis.status = options?.status ?? 'ready'\n\t\tthis.handleToggleDebug = options?.handleToggleDebug\n\t\tthis.handletoggleStandardWatch = options?.handletoggleStandardWatch\n\t\tthis.isDebugging = options?.isDebugging ?? false\n\t\tthis.watchMode = options?.watchMode ?? 'off'\n\t\tthis.handleToggleSmartWatch = options?.handleToggleSmartWatch\n\n\t\tthis.errorLogItemGenerator = new TestLogItemGenerator()\n\t\tthis.widgetFactory = new WidgetFactory()\n\t}\n\n\tpublic setFilterPattern(pattern: string | undefined) {\n\t\tthis.filterPattern = pattern\n\t\tthis.filterInput.setValue(pattern ?? '')\n\t\tthis.clearFilterPatternButton.setText(buildPatternButtonText(pattern))\n\t}\n\n\tpublic setIsDebugging(isDebugging: boolean) {\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleDebug',\n\t\t\t`Debug ^${isDebugging ? 'k' : 'w'}^#^${isDebugging ? 'g' : 'r'}${\n\t\t\t\tisDebugging ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\t\tthis.isDebugging = isDebugging\n\t}\n\n\tpublic startCountdownTimer(durationSec: number) {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\n\t\tlet remaining = durationSec\n\n\t\tfunction renderCountdownTime(time: number) {\n\t\t\treturn `Starting ${time} `\n\t\t}\n\n\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\n\t\tthis.countDownTimeInterval = setInterval(() => {\n\t\t\tremaining--\n\n\t\t\tif (remaining < 0) {\n\t\t\t\tthis.stopCountdownTimer()\n\t\t\t} else {\n\t\t\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\t\t\t}\n\t\t}, 1000) as any\n\t}\n\n\tpublic stopCountdownTimer() {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\t\tthis.setWatchMode(this.watchMode)\n\t}\n\n\tpublic setWatchMode(watchMode: WatchMode) {\n\t\tthis.watchMode = watchMode\n\t\tif (!this.countDownTimeInterval) {\n\t\t\tlet label = watchMode === 'smart' ? 'Smart Watch' : 'Standard Watch'\n\t\t\tif (watchMode === 'off') {\n\t\t\t\tlabel = 'Not Watching'\n\t\t\t}\n\t\t\tthis.setWatchLabel(label)\n\t\t}\n\t}\n\n\tprivate setWatchLabel(label: string) {\n\t\tconst isWatching = this.watchMode !== 'off'\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'watchDropdown',\n\t\t\t`${label} ^${isWatching ? 'k' : 'w'}^#^${isWatching ? 'g' : 'r'}${\n\t\t\t\tisWatching ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleStandardWatch',\n\t\t\tthis.watchMode === 'standard' ? '√ Standard' : 'Standard'\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleSmartWatch',\n\t\t\tthis.watchMode === 'smart' ? '√ Smart' : 'Smart'\n\t\t)\n\t}\n\n\tpublic async start() {\n\t\tthis.started = true\n\n\t\tthis.window = this.widgetFactory.Widget('window', {})\n\t\tthis.window.hideCursor()\n\n\t\tconst { width } = this.window.getFrame()\n\t\tif (width < this.minWidth) {\n\t\t\tthrow new Error(\n\t\t\t\t`Your screen must be at least ${this.minWidth} characters wide.`\n\t\t\t)\n\t\t}\n\n\t\tvoid this.window.on('key', this.handleGlobalKeypress.bind(this))\n\t\tvoid this.window.on('kill', this.destroy.bind(this))\n\t\tvoid this.window.on('resize', this.handleWindowResize.bind(this))\n\n\t\tthis.dropInTopLayout()\n\t\tthis.dropInProgressBar()\n\t\tthis.dropInMenu()\n\t\tthis.dropInBottomLayout()\n\t\tthis.dropInStatusBar()\n\t\tthis.dropInTestLog()\n\t\tthis.dropInFilterControls()\n\n\t\tthis.updateOrientation()\n\n\t\tthis.setIsDebugging(this.isDebugging)\n\t\tthis.setWatchMode(this.watchMode)\n\t\tthis.setStatus(this.status)\n\n\t\tthis.updateInterval = setInterval(\n\t\t\tthis.handleUpdateInterval.bind(this),\n\t\t\t1000\n\t\t)\n\t}\n\n\tprivate handleWindowResize() {\n\t\tthis.updateOrientation()\n\t}\n\n\tprivate updateOrientation() {\n\t\tconst frame = this.window.getFrame()\n\n\t\tif (frame.width * 0.6 > frame.height) {\n\t\t\tthis.orientation = 'landscape'\n\t\t} else {\n\t\t\tthis.orientation = 'portrait'\n\t\t}\n\t}\n\n\tprivate dropInMenu() {\n\t\tthis.menu = this.widgetFactory.Widget('menuBar', {\n\t\t\tparent: this.window,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\titems: [\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Restart ',\n\t\t\t\t\tvalue: 'restart',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Debug ',\n\t\t\t\t\tvalue: 'toggleDebug',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Not Watching ',\n\t\t\t\t\tvalue: 'watchDropdown',\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Watch all',\n\t\t\t\t\t\t\tvalue: 'toggleStandardWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Smart watch',\n\t\t\t\t\t\t\tvalue: 'toggleSmartWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Quit',\n\t\t\t\t\tvalue: 'quit',\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\n\t\tvoid this.menu.on('select', this.handleMenuSelect.bind(this))\n\t}\n\n\tpublic setStatus(status: TestRunnerStatus) {\n\t\tthis.status = status\n\n\t\tthis.updateMenuLabels()\n\t\tthis.closeSelectTestPopup()\n\t\tthis.bottomLayout.updateLayout()\n\n\t\tif (status === 'ready') {\n\t\t\tthis.setStatusLabel('Starting...')\n\t\t} else if (this.status === 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t\tthis.setStatusLabel('')\n\t\t} else if (this.status === 'running') {\n\t\t\tthis.setStatusLabel('Running tests...')\n\t\t}\n\t}\n\n\tprivate updateMenuLabels() {\n\t\tlet restartLabel = 'Start ^#^r › ^'\n\t\tswitch (this.status) {\n\t\t\tcase 'running':\n\t\t\t\trestartLabel = 'Stop ^k^#^g › ^'\n\t\t\t\tbreak\n\t\t\tcase 'stopped':\n\t\t\t\trestartLabel = `Start ^w^#^r › ^`\n\t\t\t\tbreak\n\t\t\tcase 'ready':\n\t\t\t\trestartLabel = 'Booting ^#^K › ^'\n\t\t\t\tbreak\n\t\t}\n\n\t\tthis.menu.setTextForItem('restart', restartLabel)\n\t}\n\n\tprivate handleMenuSelect(payload: { value: string }) {\n\t\tswitch (payload.value) {\n\t\t\tcase 'quit':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tbreak\n\t\t\tcase 'restart':\n\t\t\t\tthis.handleStartStop?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleDebug':\n\t\t\t\tthis.handleToggleDebug?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleStandardWatch':\n\t\t\t\tthis.handletoggleStandardWatch?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleSmartWatch':\n\t\t\t\tthis.handleToggleSmartWatch?.()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate handleUpdateInterval() {\n\t\tif (this.status !== 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t}\n\t}\n\n\tprivate refreshResults() {\n\t\tif (this.lastResults) {\n\t\t\tthis.updateLogs()\n\t\t}\n\t}\n\n\tprivate async handleGlobalKeypress(payload: { key: string }) {\n\t\tif (this.window.getFocusedWidget() === this.filterInput) {\n\t\t\treturn\n\t\t}\n\n\t\tswitch (payload.key) {\n\t\t\tcase 'ENTER':\n\t\t\t\tthis.handleRestart?.()\n\t\t\t\tbreak\n\t\t\tcase 'CTRL_C':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tprocess.exit()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate dropInTestLog() {\n\t\tconst parent = this.bottomLayout.getChildById('results')\n\n\t\tif (parent) {\n\t\t\tthis.testLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent,\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tleft: 0,\n\t\t\t\ttop: 0,\n\t\t\t\theight: '100%',\n\t\t\t\twidth: '100%',\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t})\n\n\t\t\tvoid this.testLog.on('click', this.handleClickTestLog.bind(this))\n\t\t}\n\t}\n\n\tprivate async handleClickTestLog(payload: { row: number; column: number }) {\n\t\tconst testFile = this.getFileForLine(payload.row)\n\t\tconst { row, column } = payload\n\n\t\tthis.closeSelectTestPopup()\n\n\t\tif (testFile) {\n\t\t\tthis.dropInSelectTestPopup({ testFile, column, row })\n\t\t}\n\t}\n\n\tprivate closeSelectTestPopup() {\n\t\tif (this.selectTestPopup) {\n\t\t\tvoid this.selectTestPopup.destroy()\n\t\t\tthis.selectTestPopup = undefined\n\t\t}\n\t}\n\n\tprivate dropInSelectTestPopup(options: {\n\t\ttestFile: string\n\t\tcolumn: number\n\t\trow: number\n\t}) {\n\t\tconst { testFile, row, column } = options\n\n\t\tthis.selectTestPopup = this.widgetFactory.Widget('popup', {\n\t\t\tparent: this.window,\n\t\t\tleft: Math.max(1, column - 25),\n\t\t\ttop: Math.max(4, row - 2),\n\t\t\twidth: 50,\n\t\t\theight: 10,\n\t\t})\n\n\t\tthis.widgetFactory.Widget('text', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 1,\n\t\t\theight: 4,\n\t\t\twidth: this.selectTestPopup.getFrame().width - 2,\n\t\t\ttext: `What do you wanna do with:\\n\\n${testFile}`,\n\t\t})\n\n\t\tconst open = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 6,\n\t\t\ttext: 'Open',\n\t\t})\n\n\t\tconst rerun = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 20,\n\t\t\ttop: 6,\n\t\t\ttext: 'Test',\n\t\t})\n\n\t\tconst cancel = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 37,\n\t\t\ttop: 6,\n\t\t\ttext: 'Nevermind',\n\t\t})\n\n\t\tvoid rerun.on('click', () => {\n\t\t\tthis.handleRerunTestFile?.(testFile)\n\t\t\tthis.closeSelectTestPopup()\n\t\t})\n\t\tvoid cancel.on('click', this.closeSelectTestPopup.bind(this))\n\t\tvoid open.on('click', () => {\n\t\t\tthis.openTestFile(testFile)\n\t\t})\n\t}\n\n\tprivate openTestFile(testFile: string) {\n\t\tthis.handleOpenTestFile?.(testFile)\n\t\tthis.closeSelectTestPopup()\n\t}\n\n\tpublic getFileForLine(row: number): string | undefined {\n\t\tlet line = this.testLog.getScrollY()\n\n\t\tfor (let file of this.lastResults.testFiles ?? []) {\n\t\t\tif (line === row) {\n\t\t\t\treturn file.path\n\t\t\t}\n\n\t\t\tline++\n\n\t\t\tfor (let c = 0; c < (file.tests ?? []).length; c++) {\n\t\t\t\tif (line === row) {\n\t\t\t\t\treturn file.path\n\t\t\t\t}\n\n\t\t\t\tline++\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\tprivate dropInProgressBar() {\n\t\tconst parent = this.topLayout.getChildById('progress') ?? this.window\n\t\tthis.bar = this.widgetFactory.Widget('progressBar', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\twidth: parent.getFrame().width,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tlabel: 'Ready and waiting...',\n\t\t\tprogress: 0,\n\t\t})\n\t}\n\n\tprivate dropInFilterControls() {\n\t\tconst parent = this.topLayout.getChildById('filter') ?? this.window\n\n\t\tconst buttonWidth = 3\n\t\tthis.filterInput = this.widgetFactory.Widget('input', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\tlabel: 'Pattern',\n\t\t\twidth: parent.getFrame().width - buttonWidth,\n\t\t\theight: 1,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tvalue: this.filterPattern,\n\t\t})\n\n\t\tvoid this.filterInput.on('cancel', () => {\n\t\t\tthis.filterInput.setValue(this.filterPattern ?? '')\n\t\t})\n\n\t\tvoid this.filterInput.on('submit', (payload) => {\n\t\t\tthis.handleFilterChange?.(payload.value ?? undefined)\n\t\t})\n\n\t\tthis.clearFilterPatternButton = this.widgetFactory.Widget('button', {\n\t\t\tparent,\n\t\t\tleft: this.filterInput.getFrame().width,\n\t\t\twidth: buttonWidth,\n\t\t\ttop: 0,\n\t\t\ttext: buildPatternButtonText(this.filterPattern),\n\t\t\tshouldLockRightWithParent: true,\n\t\t})\n\n\t\tvoid this.clearFilterPatternButton.on('click', () => {\n\t\t\tif (this.filterPattern || this.filterPattern?.length === 0) {\n\t\t\t\tthis.handleFilterChange?.(undefined)\n\t\t\t} else {\n\t\t\t\tthis.filterInput.setValue('')\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate dropInBottomLayout() {\n\t\tthis.bottomLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 4,\n\t\t\theight: this.window.getFrame().height - 5,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: true,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'results',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tprivate dropInStatusBar() {\n\t\tthis.statusBar = this.widgetFactory.Widget('text', {\n\t\t\tparent: this.window,\n\t\t\ttop: this.window.getFrame().height - 1,\n\t\t\twidth: '100%',\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockBottomWithParent: true,\n\t\t\tbackgroundColor: 'yellow',\n\t\t\tforegroundColor: 'black',\n\t\t\ttext: '...',\n\t\t})\n\t}\n\n\tprivate dropInTopLayout() {\n\t\tthis.topLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 1,\n\t\t\theight: 3,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: false,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'progress',\n\t\t\t\t\t\t\twidth: 50,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'filter',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tpublic updateResults(results: SpruceTestResults) {\n\t\tif (!this.started) {\n\t\t\tthrow new Error('You must call start() before anything else.')\n\t\t}\n\n\t\tthis.lastResults = {\n\t\t\t...this.lastResults,\n\t\t\t...results,\n\t\t}\n\n\t\tthis.updateProgressBar(results)\n\n\t\tconst percentPassing = this.generatePercentPassing(results)\n\t\tconst percentComplete = this.generatePercentComplete(results)\n\n\t\tthis.window.setTitle(\n\t\t\t`Testing: ${percentComplete}% complete.${\n\t\t\t\tpercentComplete > 0 ? ` ${percentPassing}% passing.` : ''\n\t\t\t}`\n\t\t)\n\n\t\tthis.updateLogs()\n\t}\n\n\tprivate updateLogs() {\n\t\tif (this.selectTestPopup) {\n\t\t\treturn\n\t\t}\n\n\t\tlet { logContent, errorContent } = this.resultsToLogContents(\n\t\t\tthis.lastResults\n\t\t)\n\n\t\tthis.testLog.setText(logContent)\n\n\t\tif (!errorContent) {\n\t\t\tthis.errorLog && this.destroyErrorLog()\n\t\t} else {\n\t\t\t!this.errorLog && this.dropInErrorLog()\n\t\t\tconst cleanedLog = this.cwd\n\t\t\t\t? errorContent.replace(new RegExp(this.cwd + '/', 'gim'), '')\n\t\t\t\t: errorContent\n\n\t\t\tthis.errorLog?.setText(cleanedLog)\n\t\t}\n\t}\n\n\tprivate resultsToLogContents(results: SpruceTestResults) {\n\t\tlet logContent = ''\n\t\tlet errorContent = ''\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tlogContent += this.errorLogItemGenerator.generateLogItemForFile(\n\t\t\t\tfile,\n\t\t\t\tthis.status\n\t\t\t)\n\t\t\terrorContent +=\n\t\t\t\tthis.errorLogItemGenerator.generateErrorLogItemForFile(file)\n\t\t})\n\n\t\tif (this.lastResults.customErrors.length > 0) {\n\t\t\terrorContent =\n\t\t\t\tthis.lastResults.customErrors.map((err) => chalk.red(err)).join(`\\n`) +\n\t\t\t\t`\\n${errorContent}`\n\t\t}\n\n\t\treturn { logContent, errorContent }\n\t}\n\n\tprivate dropInErrorLog() {\n\t\tthis.orientationWhenErrorLogWasShown = this.orientation\n\n\t\tif (this.bottomLayout.getRows().length === 1) {\n\t\t\tif (this.orientation === 'portrait') {\n\t\t\t\tthis.bottomLayout.addRow({\n\t\t\t\t\tid: 'row_2',\n\t\t\t\t\tcolumns: [{ id: 'errors', width: '100%' }],\n\t\t\t\t})\n\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '50%')\n\t\t\t\tthis.bottomLayout.setRowHeight(1, '50%')\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.addColumn(0, { id: 'errors', width: '50%' })\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '50%',\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.bottomLayout.updateLayout()\n\n\t\t\tconst cell = this.bottomLayout.getChildById('errors')\n\n\t\t\tif (!cell) {\n\t\t\t\tthrow new Error('Pulling child error')\n\t\t\t}\n\n\t\t\tthis.errorLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent: cell,\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tshouldAutoScrollWhenAppendingContent: false,\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t\tpadding: { left: 1 },\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate destroyErrorLog() {\n\t\tif (this.errorLog) {\n\t\t\tvoid this.errorLog?.destroy()\n\t\t\tthis.errorLog = undefined\n\n\t\t\tif (this.orientationWhenErrorLogWasShown === 'landscape') {\n\t\t\t\tthis.bottomLayout.removeColumn(0, 1)\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.removeRow(1)\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '100%')\n\t\t\t}\n\t\t\tthis.bottomLayout.updateLayout()\n\t\t}\n\t}\n\n\tprivate updateProgressBar(results: SpruceTestResults) {\n\t\tif (results.totalTestFilesComplete ?? 0 > 0) {\n\t\t\tconst testsRemaining =\n\t\t\t\tresults.totalTestFiles - (results.totalTestFilesComplete ?? 0)\n\n\t\t\tif (testsRemaining === 0) {\n\t\t\t\tconst { percent, totalTests, totalPassedTests, totalTime } =\n\t\t\t\t\tthis.generateProgressStats(results)\n\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`Finished! ${totalPassedTests} of ${totalTests} (${percent}%) passed in ${durationUtil.msToFriendly(\n\t\t\t\t\t\ttotalTime\n\t\t\t\t\t)}.${percent < 100 ? ` Don't give up! 💪` : ''}`\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`${results.totalTestFilesComplete} of ${\n\t\t\t\t\t\tresults.totalTestFiles\n\t\t\t\t\t} (${this.generatePercentComplete(\n\t\t\t\t\t\tresults\n\t\t\t\t\t)}%) complete. ${testsRemaining} remaining...`\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tthis.bar.setLabel('0%')\n\t\t}\n\n\t\tthis.bar.setProgress(this.generatePercentComplete(results) / 100)\n\t}\n\n\tprivate generateProgressStats(results: SpruceTestResults): {\n\t\tpercent: number\n\t\ttotalTests: number\n\t\ttotalPassedTests: number\n\t\ttotalTime: number\n\t} {\n\t\tlet totalTests = 0\n\t\tlet totalPassedTests = 0\n\t\tlet totalTime = 0\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tfile.tests?.forEach((test) => {\n\t\t\t\ttotalTime += test.duration\n\t\t\t\tif (test.status === 'passed') {\n\t\t\t\t\ttotalPassedTests++\n\t\t\t\t}\n\n\t\t\t\tif (test.status === 'passed' || test.status === 'failed') {\n\t\t\t\t\ttotalTests++\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\tconst percent = Math.floor((totalPassedTests / totalTests) * 100)\n\t\treturn {\n\t\t\tpercent: percent > 0 ? percent : 0,\n\t\t\ttotalTests,\n\t\t\ttotalPassedTests,\n\t\t\ttotalTime,\n\t\t}\n\t}\n\n\tprivate generatePercentComplete(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalTestFilesComplete ?? 0) / results.totalTestFiles\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\t\treturn Math.round(percent * 100)\n\t}\n\n\tprivate generatePercentPassing(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalPassed ?? 0) / this.getTotalTestFilesRun(results)\n\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\n\t\treturn Math.floor(percent * 100)\n\t}\n\n\tprivate getTotalTestFilesRun(results: SpruceTestResults) {\n\t\treturn (\n\t\t\t(results.totalTests ?? 0) -\n\t\t\t(results.totalSkipped ?? 0) -\n\t\t\t(results.totalTodo ?? 0)\n\t\t)\n\t}\n\n\tpublic render() {\n\t\tthis.table?.computeCells()\n\t\tthis.table?.draw()\n\t}\n\n\tpublic async destroy() {\n\t\tclearInterval(this.updateInterval)\n\t\tawait this.window.destroy()\n\t}\n\n\tpublic reset() {\n\t\tthis.testLog.setText('')\n\t\tthis.lastResults = {\n\t\t\ttotalTestFiles: 0,\n\t\t\tcustomErrors: [],\n\t\t}\n\t\tthis.destroyErrorLog()\n\t\tthis.errorLogItemGenerator.resetStartTimes()\n\t}\n\n\tpublic setStatusLabel(text: string) {\n\t\tthis.statusBar.setText(text)\n\t}\n\n\tpublic appendError(message: string) {\n\t\tthis.lastResults.customErrors.push(message)\n\t}\n}\nfunction buildPatternButtonText(pattern: string | undefined): string {\n\treturn pattern ? ' x ' : ' - '\n}\n"],"file":"TestReporter.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/features/test/TestReporter.ts"],"names":["TestReporter","options","totalTestFiles","customErrors","cwd","filterPattern","handleRestart","handleStartStop","handleQuit","handleRerunTestFile","handleOpenTestFile","handleFilterChange","handleFilterPatternChange","status","handleToggleDebug","handletoggleStandardWatch","isDebugging","watchMode","handleToggleSmartWatch","errorLogItemGenerator","TestLogItemGenerator","widgetFactory","WidgetFactory","pattern","filterInput","setValue","clearFilterPatternButton","setText","buildPatternButtonText","menu","setTextForItem","durationSec","clearInterval","countDownTimeInterval","undefined","remaining","renderCountdownTime","time","setWatchLabel","setInterval","stopCountdownTimer","setWatchMode","label","isWatching","started","window","Widget","hideCursor","getFrame","width","minWidth","Error","on","handleGlobalKeypress","bind","destroy","handleWindowResize","dropInTopLayout","dropInProgressBar","dropInMenu","dropInBottomLayout","dropInStatusBar","dropInTestLog","dropInFilterControls","updateOrientation","setIsDebugging","setStatus","updateInterval","handleUpdateInterval","frame","height","orientation","parent","left","top","shouldLockWidthWithParent","items","value","handleMenuSelect","updateMenuLabels","closeSelectTestPopup","bottomLayout","updateLayout","setStatusLabel","refreshResults","restartLabel","payload","lastResults","updateLogs","getFocusedWidget","key","process","exit","getChildById","testLog","isScrollEnabled","shouldLockHeightWithParent","handleClickTestLog","testFile","getFileForLine","row","column","dropInSelectTestPopup","selectTestPopup","Math","max","text","open","rerun","cancel","openTestFile","line","getScrollY","testFiles","file","path","c","tests","length","topLayout","bar","progress","buttonWidth","shouldLockRightWithParent","rows","columns","id","statusBar","shouldLockBottomWithParent","backgroundColor","foregroundColor","results","updateProgressBar","percentPassing","generatePercentPassing","percentComplete","generatePercentComplete","setTitle","resultsToLogContents","logContent","errorContent","errorLog","destroyErrorLog","dropInErrorLog","cleanedLog","replace","RegExp","forEach","generateLogItemForFile","generateErrorLogItemForFile","map","err","chalk","red","join","orientationWhenErrorLogWasShown","getRows","addRow","setRowHeight","addColumn","setColumnWidth","rowIdx","columnIdx","cell","shouldAutoScrollWhenAppendingContent","padding","removeColumn","removeRow","totalTestFilesComplete","testsRemaining","generateProgressStats","percent","totalTests","totalPassedTests","totalTime","setLabel","durationUtil","msToFriendly","setProgress","test","duration","floor","isNaN","round","totalPassed","getTotalTestFilesRun","totalSkipped","totalTodo","table","computeCells","draw","resetStartTimes","message","push"],"mappings":";;;;;;;;;;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,8DAAYE,IAAZ;AACA;;;;mGAED;AAAA;AAAA;AAAA;AAAA;AACC9J,gBAAAA,aAAa,CAAC,KAAKmC,cAAN,CAAb;AADD;AAAA,uBAEO,KAAKtB,MAAL,CAAYU,OAAZ,EAFP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAKA,iBAAe;AACd,WAAKuC,OAAL,CAAanE,OAAb,CAAqB,EAArB;AACA,WAAK4D,WAAL,GAAmB;AAClBrF,QAAAA,cAAc,EAAE,CADE;AAElBC,QAAAA,YAAY,EAAE;AAFI,OAAnB;AAIA,WAAK2I,eAAL;AACA,WAAK3H,qBAAL,CAA2B4K,eAA3B;AACA;;;WAED,wBAAsBrF,IAAtB,EAAoC;AACnC,WAAKqB,SAAL,CAAepG,OAAf,CAAuB+E,IAAvB;AACA;;;WAED,qBAAmBsF,OAAnB,EAAoC;AACnC,WAAKzG,WAAL,CAAiBpF,YAAjB,CAA8B8L,IAA9B,CAAmCD,OAAnC;AACA;;;;;;;AAEF,SAASpK,sBAAT,CAAgCL,OAAhC,EAAqE;AACpE,SAAOA,OAAO,GAAG,KAAH,GAAW,KAAzB;AACA","sourcesContent":["import chalk from 'chalk'\nimport durationUtil from '../../utilities/duration.utility'\nimport { ButtonWidget } from '../../widgets/types/button.types'\nimport { InputWidget } from '../../widgets/types/input.types'\nimport { LayoutWidget } from '../../widgets/types/layout.types'\nimport { MenuBarWidget } from '../../widgets/types/menuBar.types'\nimport { PopupWidget } from '../../widgets/types/popup.types'\nimport { ProgressBarWidget } from '../../widgets/types/progressBar.types'\nimport { TextWidget } from '../../widgets/types/text.types'\nimport { WindowWidget } from '../../widgets/types/window.types'\nimport WidgetFactory from '../../widgets/WidgetFactory'\nimport { SpruceTestResults, TestRunnerStatus } from './test.types'\nimport TestLogItemGenerator from './TestLogItemGenerator'\n\ninterface TestReporterOptions {\n\thandleStartStop?: () => void\n\thandleRestart?: () => void\n\thandleQuit?: () => void\n\tonRequestOpenTestFile?: () => void\n\thandleRerunTestFile?: (fileName: string) => void\n\thandleOpenTestFile?: (fileName: string) => void\n\thandleFilterPatternChange?: (pattern?: string) => void\n\thandleToggleDebug?: () => void\n\thandletoggleStandardWatch?: () => void\n\thandleToggleSmartWatch?: () => void\n\tfilterPattern?: string\n\tisDebugging?: boolean\n\twatchMode?: WatchMode\n\tstatus?: TestRunnerStatus\n\tcwd?: string\n}\n\ntype TestReporterResults = SpruceTestResults & {\n\tcustomErrors: string[]\n}\n\nexport type TestReporterOrientation = 'landscape' | 'portrait'\nexport type WatchMode = 'off' | 'standard' | 'smart'\n\nexport default class TestReporter {\n\tprivate started = false\n\tprivate table?: any\n\tprivate bar!: ProgressBarWidget\n\tprivate bottomLayout!: LayoutWidget\n\tprivate testLog!: TextWidget\n\tprivate errorLog?: TextWidget\n\tprivate errorLogItemGenerator: TestLogItemGenerator\n\tprivate lastResults: TestReporterResults = {\n\t\ttotalTestFiles: 0,\n\t\tcustomErrors: [],\n\t}\n\tprivate updateInterval?: any\n\tprivate menu!: MenuBarWidget\n\tprivate statusBar!: TextWidget\n\tprivate window!: WindowWidget\n\tprivate widgetFactory: WidgetFactory\n\tprivate selectTestPopup?: PopupWidget\n\tprivate topLayout!: LayoutWidget\n\tprivate filterInput!: InputWidget\n\tprivate filterPattern?: string\n\tprivate clearFilterPatternButton!: ButtonWidget\n\tprivate isDebugging = false\n\tprivate watchMode: WatchMode = 'off'\n\tprivate status: TestRunnerStatus = 'ready'\n\tprivate countDownTimeInterval?: number\n\tprivate cwd: string | undefined\n\tprivate orientation: TestReporterOrientation = 'landscape'\n\n\tprivate handleStartStop?: () => void\n\tprivate handleRestart?: () => void\n\tprivate handleQuit?: () => void\n\tprivate handleRerunTestFile?: (fileName: string) => void\n\tprivate handleFilterChange?: (pattern?: string) => void\n\tprivate handleOpenTestFile?: (testFile: string) => void\n\tprivate handleToggleDebug?: () => void\n\tprivate handletoggleStandardWatch?: () => void\n\tprivate handleToggleSmartWatch?: () => any\n\tprivate minWidth = 50\n\tprivate orientationWhenErrorLogWasShown: TestReporterOrientation = 'landscape'\n\n\tpublic constructor(options?: TestReporterOptions) {\n\t\tthis.cwd = options?.cwd\n\t\tthis.filterPattern = options?.filterPattern\n\t\tthis.handleRestart = options?.handleRestart\n\t\tthis.handleStartStop = options?.handleStartStop\n\t\tthis.handleQuit = options?.handleQuit\n\t\tthis.handleRerunTestFile = options?.handleRerunTestFile\n\t\tthis.handleOpenTestFile = options?.handleOpenTestFile\n\t\tthis.handleFilterChange = options?.handleFilterPatternChange\n\t\tthis.status = options?.status ?? 'ready'\n\t\tthis.handleToggleDebug = options?.handleToggleDebug\n\t\tthis.handletoggleStandardWatch = options?.handletoggleStandardWatch\n\t\tthis.isDebugging = options?.isDebugging ?? false\n\t\tthis.watchMode = options?.watchMode ?? 'off'\n\t\tthis.handleToggleSmartWatch = options?.handleToggleSmartWatch\n\n\t\tthis.errorLogItemGenerator = new TestLogItemGenerator()\n\t\tthis.widgetFactory = new WidgetFactory()\n\t}\n\n\tpublic setFilterPattern(pattern: string | undefined) {\n\t\tthis.filterPattern = pattern\n\t\tthis.filterInput.setValue(pattern ?? '')\n\t\tthis.clearFilterPatternButton.setText(buildPatternButtonText(pattern))\n\t}\n\n\tpublic setIsDebugging(isDebugging: boolean) {\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleDebug',\n\t\t\t`Debug ^${isDebugging ? 'k' : 'w'}^#^${isDebugging ? 'g' : 'r'}${\n\t\t\t\tisDebugging ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\t\tthis.isDebugging = isDebugging\n\t}\n\n\tpublic startCountdownTimer(durationSec: number) {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\n\t\tlet remaining = durationSec\n\n\t\tfunction renderCountdownTime(time: number) {\n\t\t\treturn `Starting ${time} `\n\t\t}\n\n\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\n\t\tthis.countDownTimeInterval = setInterval(() => {\n\t\t\tremaining--\n\n\t\t\tif (remaining < 0) {\n\t\t\t\tthis.stopCountdownTimer()\n\t\t\t} else {\n\t\t\t\tthis.setWatchLabel(renderCountdownTime(remaining))\n\t\t\t}\n\t\t}, 1000) as any\n\t}\n\n\tpublic stopCountdownTimer() {\n\t\tclearInterval(this.countDownTimeInterval)\n\t\tthis.countDownTimeInterval = undefined\n\t\tthis.setWatchMode(this.watchMode)\n\t}\n\n\tpublic setWatchMode(watchMode: WatchMode) {\n\t\tthis.watchMode = watchMode\n\t\tif (!this.countDownTimeInterval) {\n\t\t\tlet label = watchMode === 'smart' ? 'Smart Watch' : 'Standard Watch'\n\t\t\tif (watchMode === 'off') {\n\t\t\t\tlabel = 'Not Watching'\n\t\t\t}\n\t\t\tthis.setWatchLabel(label)\n\t\t}\n\t}\n\n\tprivate setWatchLabel(label: string) {\n\t\tconst isWatching = this.watchMode !== 'off'\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'watchDropdown',\n\t\t\t`${label} ^${isWatching ? 'k' : 'w'}^#^${isWatching ? 'g' : 'r'}${\n\t\t\t\tisWatching ? ' • ' : ' • '\n\t\t\t}^`\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleStandardWatch',\n\t\t\tthis.watchMode === 'standard' ? '√ Standard' : 'Standard'\n\t\t)\n\n\t\tthis.menu.setTextForItem(\n\t\t\t'toggleSmartWatch',\n\t\t\tthis.watchMode === 'smart' ? '√ Smart' : 'Smart'\n\t\t)\n\t}\n\n\tpublic async start() {\n\t\tthis.started = true\n\n\t\tthis.window = this.widgetFactory.Widget('window', {})\n\t\tthis.window.hideCursor()\n\n\t\tconst { width } = this.window.getFrame()\n\t\tif (width < this.minWidth) {\n\t\t\tthrow new Error(\n\t\t\t\t`Your screen must be at least ${this.minWidth} characters wide.`\n\t\t\t)\n\t\t}\n\n\t\tvoid this.window.on('key', this.handleGlobalKeypress.bind(this))\n\t\tvoid this.window.on('kill', this.destroy.bind(this))\n\t\tvoid this.window.on('resize', this.handleWindowResize.bind(this))\n\n\t\tthis.dropInTopLayout()\n\t\tthis.dropInProgressBar()\n\t\tthis.dropInMenu()\n\t\tthis.dropInBottomLayout()\n\t\tthis.dropInStatusBar()\n\t\tthis.dropInTestLog()\n\t\tthis.dropInFilterControls()\n\n\t\tthis.updateOrientation()\n\n\t\tthis.setIsDebugging(this.isDebugging)\n\t\tthis.setWatchMode(this.watchMode)\n\t\tthis.setStatus(this.status)\n\n\t\tthis.updateInterval = setInterval(\n\t\t\tthis.handleUpdateInterval.bind(this),\n\t\t\t1000\n\t\t)\n\t}\n\n\tprivate handleWindowResize() {\n\t\tthis.updateOrientation()\n\t}\n\n\tprivate updateOrientation() {\n\t\tconst frame = this.window.getFrame()\n\n\t\tif (frame.width * 0.5 > frame.height) {\n\t\t\tthis.orientation = 'landscape'\n\t\t} else {\n\t\t\tthis.orientation = 'portrait'\n\t\t}\n\t}\n\n\tprivate dropInMenu() {\n\t\tthis.menu = this.widgetFactory.Widget('menuBar', {\n\t\t\tparent: this.window,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\titems: [\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Restart ',\n\t\t\t\t\tvalue: 'restart',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Debug ',\n\t\t\t\t\tvalue: 'toggleDebug',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Not Watching ',\n\t\t\t\t\tvalue: 'watchDropdown',\n\t\t\t\t\titems: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Watch all',\n\t\t\t\t\t\t\tvalue: 'toggleStandardWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: 'Smart watch',\n\t\t\t\t\t\t\tvalue: 'toggleSmartWatch',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: 'Quit',\n\t\t\t\t\tvalue: 'quit',\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\n\t\tvoid this.menu.on('select', this.handleMenuSelect.bind(this))\n\t}\n\n\tpublic setStatus(status: TestRunnerStatus) {\n\t\tthis.status = status\n\n\t\tthis.updateMenuLabels()\n\t\tthis.closeSelectTestPopup()\n\t\tthis.bottomLayout.updateLayout()\n\n\t\tif (status === 'ready') {\n\t\t\tthis.setStatusLabel('Starting...')\n\t\t} else if (this.status === 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t\tthis.setStatusLabel('')\n\t\t} else if (this.status === 'running') {\n\t\t\tthis.setStatusLabel('Running tests...')\n\t\t}\n\t}\n\n\tprivate updateMenuLabels() {\n\t\tlet restartLabel = 'Start ^#^r › ^'\n\t\tswitch (this.status) {\n\t\t\tcase 'running':\n\t\t\t\trestartLabel = 'Stop ^k^#^g › ^'\n\t\t\t\tbreak\n\t\t\tcase 'stopped':\n\t\t\t\trestartLabel = `Start ^w^#^r › ^`\n\t\t\t\tbreak\n\t\t\tcase 'ready':\n\t\t\t\trestartLabel = 'Booting ^#^K › ^'\n\t\t\t\tbreak\n\t\t}\n\n\t\tthis.menu.setTextForItem('restart', restartLabel)\n\t}\n\n\tprivate handleMenuSelect(payload: { value: string }) {\n\t\tswitch (payload.value) {\n\t\t\tcase 'quit':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tbreak\n\t\t\tcase 'restart':\n\t\t\t\tthis.handleStartStop?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleDebug':\n\t\t\t\tthis.handleToggleDebug?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleStandardWatch':\n\t\t\t\tthis.handletoggleStandardWatch?.()\n\t\t\t\tbreak\n\t\t\tcase 'toggleSmartWatch':\n\t\t\t\tthis.handleToggleSmartWatch?.()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate handleUpdateInterval() {\n\t\tif (this.status !== 'stopped') {\n\t\t\tthis.refreshResults()\n\t\t}\n\t}\n\n\tprivate refreshResults() {\n\t\tif (this.lastResults) {\n\t\t\tthis.updateLogs()\n\t\t}\n\t}\n\n\tprivate async handleGlobalKeypress(payload: { key: string }) {\n\t\tif (this.window.getFocusedWidget() === this.filterInput) {\n\t\t\treturn\n\t\t}\n\n\t\tswitch (payload.key) {\n\t\t\tcase 'ENTER':\n\t\t\t\tthis.handleRestart?.()\n\t\t\t\tbreak\n\t\t\tcase 'CTRL_C':\n\t\t\t\tthis.handleQuit?.()\n\t\t\t\tprocess.exit()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate dropInTestLog() {\n\t\tconst parent = this.bottomLayout.getChildById('results')\n\n\t\tif (parent) {\n\t\t\tthis.testLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent,\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tleft: 0,\n\t\t\t\ttop: 0,\n\t\t\t\theight: '100%',\n\t\t\t\twidth: '100%',\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t})\n\n\t\t\tvoid this.testLog.on('click', this.handleClickTestLog.bind(this))\n\t\t}\n\t}\n\n\tprivate async handleClickTestLog(payload: { row: number; column: number }) {\n\t\tconst testFile = this.getFileForLine(payload.row)\n\t\tconst { row, column } = payload\n\n\t\tthis.closeSelectTestPopup()\n\n\t\tif (testFile) {\n\t\t\tthis.dropInSelectTestPopup({ testFile, column, row })\n\t\t}\n\t}\n\n\tprivate closeSelectTestPopup() {\n\t\tif (this.selectTestPopup) {\n\t\t\tvoid this.selectTestPopup.destroy()\n\t\t\tthis.selectTestPopup = undefined\n\t\t}\n\t}\n\n\tprivate dropInSelectTestPopup(options: {\n\t\ttestFile: string\n\t\tcolumn: number\n\t\trow: number\n\t}) {\n\t\tconst { testFile, row, column } = options\n\n\t\tthis.selectTestPopup = this.widgetFactory.Widget('popup', {\n\t\t\tparent: this.window,\n\t\t\tleft: Math.max(1, column - 25),\n\t\t\ttop: Math.max(4, row - 2),\n\t\t\twidth: 50,\n\t\t\theight: 10,\n\t\t})\n\n\t\tthis.widgetFactory.Widget('text', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 1,\n\t\t\theight: 4,\n\t\t\twidth: this.selectTestPopup.getFrame().width - 2,\n\t\t\ttext: `What do you wanna do with:\\n\\n${testFile}`,\n\t\t})\n\n\t\tconst open = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 1,\n\t\t\ttop: 6,\n\t\t\ttext: 'Open',\n\t\t})\n\n\t\tconst rerun = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 20,\n\t\t\ttop: 6,\n\t\t\ttext: 'Test',\n\t\t})\n\n\t\tconst cancel = this.widgetFactory.Widget('button', {\n\t\t\tparent: this.selectTestPopup,\n\t\t\tleft: 37,\n\t\t\ttop: 6,\n\t\t\ttext: 'Nevermind',\n\t\t})\n\n\t\tvoid rerun.on('click', () => {\n\t\t\tthis.handleRerunTestFile?.(testFile)\n\t\t\tthis.closeSelectTestPopup()\n\t\t})\n\t\tvoid cancel.on('click', this.closeSelectTestPopup.bind(this))\n\t\tvoid open.on('click', () => {\n\t\t\tthis.openTestFile(testFile)\n\t\t})\n\t}\n\n\tprivate openTestFile(testFile: string) {\n\t\tthis.handleOpenTestFile?.(testFile)\n\t\tthis.closeSelectTestPopup()\n\t}\n\n\tpublic getFileForLine(row: number): string | undefined {\n\t\tlet line = this.testLog.getScrollY()\n\n\t\tfor (let file of this.lastResults.testFiles ?? []) {\n\t\t\tif (line === row) {\n\t\t\t\treturn file.path\n\t\t\t}\n\n\t\t\tline++\n\n\t\t\tfor (let c = 0; c < (file.tests ?? []).length; c++) {\n\t\t\t\tif (line === row) {\n\t\t\t\t\treturn file.path\n\t\t\t\t}\n\n\t\t\t\tline++\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t}\n\n\tprivate dropInProgressBar() {\n\t\tconst parent = this.topLayout.getChildById('progress') ?? this.window\n\t\tthis.bar = this.widgetFactory.Widget('progressBar', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\ttop: 0,\n\t\t\twidth: parent.getFrame().width,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tlabel: 'Ready and waiting...',\n\t\t\tprogress: 0,\n\t\t})\n\t}\n\n\tprivate dropInFilterControls() {\n\t\tconst parent = this.topLayout.getChildById('filter') ?? this.window\n\n\t\tconst buttonWidth = 3\n\t\tthis.filterInput = this.widgetFactory.Widget('input', {\n\t\t\tparent,\n\t\t\tleft: 0,\n\t\t\tlabel: 'Pattern',\n\t\t\twidth: parent.getFrame().width - buttonWidth,\n\t\t\theight: 1,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tvalue: this.filterPattern,\n\t\t})\n\n\t\tvoid this.filterInput.on('cancel', () => {\n\t\t\tthis.filterInput.setValue(this.filterPattern ?? '')\n\t\t})\n\n\t\tvoid this.filterInput.on('submit', (payload) => {\n\t\t\tthis.handleFilterChange?.(payload.value ?? undefined)\n\t\t})\n\n\t\tthis.clearFilterPatternButton = this.widgetFactory.Widget('button', {\n\t\t\tparent,\n\t\t\tleft: this.filterInput.getFrame().width,\n\t\t\twidth: buttonWidth,\n\t\t\ttop: 0,\n\t\t\ttext: buildPatternButtonText(this.filterPattern),\n\t\t\tshouldLockRightWithParent: true,\n\t\t})\n\n\t\tvoid this.clearFilterPatternButton.on('click', () => {\n\t\t\tif (this.filterPattern || this.filterPattern?.length === 0) {\n\t\t\t\tthis.handleFilterChange?.(undefined)\n\t\t\t} else {\n\t\t\t\tthis.filterInput.setValue('')\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate dropInBottomLayout() {\n\t\tthis.bottomLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 4,\n\t\t\theight: this.window.getFrame().height - 5,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: true,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'results',\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tprivate dropInStatusBar() {\n\t\tthis.statusBar = this.widgetFactory.Widget('text', {\n\t\t\tparent: this.window,\n\t\t\ttop: this.window.getFrame().height - 1,\n\t\t\twidth: '100%',\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockBottomWithParent: true,\n\t\t\tbackgroundColor: 'yellow',\n\t\t\tforegroundColor: 'black',\n\t\t\ttext: '...',\n\t\t})\n\t}\n\n\tprivate dropInTopLayout() {\n\t\tthis.topLayout = this.widgetFactory.Widget('layout', {\n\t\t\tparent: this.window,\n\t\t\twidth: '100%',\n\t\t\ttop: 1,\n\t\t\theight: 3,\n\t\t\tshouldLockWidthWithParent: true,\n\t\t\tshouldLockHeightWithParent: false,\n\t\t\trows: [\n\t\t\t\t{\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcolumns: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'progress',\n\t\t\t\t\t\t\twidth: 50,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: 'filter',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t})\n\t}\n\n\tpublic updateResults(results: SpruceTestResults) {\n\t\tif (!this.started) {\n\t\t\tthrow new Error('You must call start() before anything else.')\n\t\t}\n\n\t\tthis.lastResults = {\n\t\t\t...this.lastResults,\n\t\t\t...results,\n\t\t}\n\n\t\tthis.updateProgressBar(results)\n\n\t\tconst percentPassing = this.generatePercentPassing(results)\n\t\tconst percentComplete = this.generatePercentComplete(results)\n\n\t\tthis.window.setTitle(\n\t\t\t`Testing: ${percentComplete}% complete.${\n\t\t\t\tpercentComplete > 0 ? ` ${percentPassing}% passing.` : ''\n\t\t\t}`\n\t\t)\n\n\t\tthis.updateLogs()\n\t}\n\n\tprivate updateLogs() {\n\t\tif (this.selectTestPopup) {\n\t\t\treturn\n\t\t}\n\n\t\tlet { logContent, errorContent } = this.resultsToLogContents(\n\t\t\tthis.lastResults\n\t\t)\n\n\t\tthis.testLog.setText(logContent)\n\n\t\tif (!errorContent) {\n\t\t\tthis.errorLog && this.destroyErrorLog()\n\t\t} else {\n\t\t\t!this.errorLog && this.dropInErrorLog()\n\t\t\tconst cleanedLog = this.cwd\n\t\t\t\t? errorContent.replace(new RegExp(this.cwd + '/', 'gim'), '')\n\t\t\t\t: errorContent\n\n\t\t\tthis.errorLog?.setText(cleanedLog)\n\t\t}\n\t}\n\n\tprivate resultsToLogContents(results: SpruceTestResults) {\n\t\tlet logContent = ''\n\t\tlet errorContent = ''\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tlogContent += this.errorLogItemGenerator.generateLogItemForFile(\n\t\t\t\tfile,\n\t\t\t\tthis.status\n\t\t\t)\n\t\t\terrorContent +=\n\t\t\t\tthis.errorLogItemGenerator.generateErrorLogItemForFile(file)\n\t\t})\n\n\t\tif (this.lastResults.customErrors.length > 0) {\n\t\t\terrorContent =\n\t\t\t\tthis.lastResults.customErrors.map((err) => chalk.red(err)).join(`\\n`) +\n\t\t\t\t`\\n${errorContent}`\n\t\t}\n\n\t\treturn { logContent, errorContent }\n\t}\n\n\tprivate dropInErrorLog() {\n\t\tthis.orientationWhenErrorLogWasShown = this.orientation\n\n\t\tif (this.bottomLayout.getRows().length === 1) {\n\t\t\tif (this.orientation === 'portrait') {\n\t\t\t\tthis.bottomLayout.addRow({\n\t\t\t\t\tid: 'row_2',\n\t\t\t\t\tcolumns: [{ id: 'errors', width: '100%' }],\n\t\t\t\t})\n\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '50%')\n\t\t\t\tthis.bottomLayout.setRowHeight(1, '50%')\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.addColumn(0, { id: 'errors', width: '50%' })\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '50%',\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.bottomLayout.updateLayout()\n\n\t\t\tconst cell = this.bottomLayout.getChildById('errors')\n\n\t\t\tif (!cell) {\n\t\t\t\tthrow new Error('Pulling child error')\n\t\t\t}\n\n\t\t\tthis.errorLog = this.widgetFactory.Widget('text', {\n\t\t\t\tparent: cell,\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\tisScrollEnabled: true,\n\t\t\t\tshouldAutoScrollWhenAppendingContent: false,\n\t\t\t\tshouldLockHeightWithParent: true,\n\t\t\t\tshouldLockWidthWithParent: true,\n\t\t\t\tpadding: { left: 1 },\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate destroyErrorLog() {\n\t\tif (this.errorLog) {\n\t\t\tvoid this.errorLog?.destroy()\n\t\t\tthis.errorLog = undefined\n\n\t\t\tif (this.orientationWhenErrorLogWasShown === 'landscape') {\n\t\t\t\tthis.bottomLayout.removeColumn(0, 1)\n\t\t\t\tthis.bottomLayout.setColumnWidth({\n\t\t\t\t\trowIdx: 0,\n\t\t\t\t\tcolumnIdx: 0,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tthis.bottomLayout.removeRow(1)\n\t\t\t\tthis.bottomLayout.setRowHeight(0, '100%')\n\t\t\t}\n\t\t\tthis.bottomLayout.updateLayout()\n\t\t}\n\t}\n\n\tprivate updateProgressBar(results: SpruceTestResults) {\n\t\tif (results.totalTestFilesComplete ?? 0 > 0) {\n\t\t\tconst testsRemaining =\n\t\t\t\tresults.totalTestFiles - (results.totalTestFilesComplete ?? 0)\n\n\t\t\tif (testsRemaining === 0) {\n\t\t\t\tconst { percent, totalTests, totalPassedTests, totalTime } =\n\t\t\t\t\tthis.generateProgressStats(results)\n\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`Finished! ${totalPassedTests} of ${totalTests} (${percent}%) passed in ${durationUtil.msToFriendly(\n\t\t\t\t\t\ttotalTime\n\t\t\t\t\t)}.${percent < 100 ? ` Don't give up! 💪` : ''}`\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tthis.bar.setLabel(\n\t\t\t\t\t`${results.totalTestFilesComplete} of ${\n\t\t\t\t\t\tresults.totalTestFiles\n\t\t\t\t\t} (${this.generatePercentComplete(\n\t\t\t\t\t\tresults\n\t\t\t\t\t)}%) complete. ${testsRemaining} remaining...`\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tthis.bar.setLabel('0%')\n\t\t}\n\n\t\tthis.bar.setProgress(this.generatePercentComplete(results) / 100)\n\t}\n\n\tprivate generateProgressStats(results: SpruceTestResults): {\n\t\tpercent: number\n\t\ttotalTests: number\n\t\ttotalPassedTests: number\n\t\ttotalTime: number\n\t} {\n\t\tlet totalTests = 0\n\t\tlet totalPassedTests = 0\n\t\tlet totalTime = 0\n\n\t\tresults.testFiles?.forEach((file) => {\n\t\t\tfile.tests?.forEach((test) => {\n\t\t\t\ttotalTime += test.duration\n\t\t\t\tif (test.status === 'passed') {\n\t\t\t\t\ttotalPassedTests++\n\t\t\t\t}\n\n\t\t\t\tif (test.status === 'passed' || test.status === 'failed') {\n\t\t\t\t\ttotalTests++\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\tconst percent = Math.floor((totalPassedTests / totalTests) * 100)\n\t\treturn {\n\t\t\tpercent: percent > 0 ? percent : 0,\n\t\t\ttotalTests,\n\t\t\ttotalPassedTests,\n\t\t\ttotalTime,\n\t\t}\n\t}\n\n\tprivate generatePercentComplete(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalTestFilesComplete ?? 0) / results.totalTestFiles\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\t\treturn Math.round(percent * 100)\n\t}\n\n\tprivate generatePercentPassing(results: SpruceTestResults): number {\n\t\tconst percent =\n\t\t\t(results.totalPassed ?? 0) / this.getTotalTestFilesRun(results)\n\n\t\tif (isNaN(percent)) {\n\t\t\treturn 0\n\t\t}\n\n\t\treturn Math.floor(percent * 100)\n\t}\n\n\tprivate getTotalTestFilesRun(results: SpruceTestResults) {\n\t\treturn (\n\t\t\t(results.totalTests ?? 0) -\n\t\t\t(results.totalSkipped ?? 0) -\n\t\t\t(results.totalTodo ?? 0)\n\t\t)\n\t}\n\n\tpublic render() {\n\t\tthis.table?.computeCells()\n\t\tthis.table?.draw()\n\t}\n\n\tpublic async destroy() {\n\t\tclearInterval(this.updateInterval)\n\t\tawait this.window.destroy()\n\t}\n\n\tpublic reset() {\n\t\tthis.testLog.setText('')\n\t\tthis.lastResults = {\n\t\t\ttotalTestFiles: 0,\n\t\t\tcustomErrors: [],\n\t\t}\n\t\tthis.destroyErrorLog()\n\t\tthis.errorLogItemGenerator.resetStartTimes()\n\t}\n\n\tpublic setStatusLabel(text: string) {\n\t\tthis.statusBar.setText(text)\n\t}\n\n\tpublic appendError(message: string) {\n\t\tthis.lastResults.customErrors.push(message)\n\t}\n}\nfunction buildPatternButtonText(pattern: string | undefined): string {\n\treturn pattern ? ' x ' : ' - '\n}\n"],"file":"TestReporter.js"}
|
|
@@ -241,6 +241,7 @@ var SetupAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
241
241
|
module = _step2.value;
|
|
242
242
|
|
|
243
243
|
if (!pkg.isInstalled(module.name)) {
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/no-extra-semi
|
|
244
245
|
;
|
|
245
246
|
((_response$packagesIns2 = response.packagesInstalled) !== null && _response$packagesIns2 !== void 0 ? _response$packagesIns2 : []).push(module);
|
|
246
247
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/vscode/actions/SetupAction.ts"],"names":["SetupAction","id","label","setupVscodeSchema","name","isDev","options","validateAndNormalizeOptions","all","ui","startLoading","getMissingExtensions","missing","choices","map","ext","value","response","summaryLines","skipConfirmExtensions","length","stopLoading","optionallyInstallVscodeExtensions","Writer","writeVsCodeConfigurations","cwd","files","packagesInstalled","optionallyInstallEsListModules","hints","m","prompt","type","isArray","answers","answer","push","Service","installExtensions","pkg","dependencies","module","isInstalled","installEsLintModules","confirm","shouldInstallPackages","install","getVSCodeExtensions","currentExtensions","missingExtensions","recommendedExtensions","filter","recommendedExtension","currentExtension","find","e","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAGA;;;;;;;;;;;;IAQqBA,W;;;;;;;;;;;;;;;0GACO,sC;8GACkB,CAC5C;AACCC,MAAAA,EAAE,EAAE,wBADL;AAECC,MAAAA,KAAK,EAAE;AAFR,KAD4C,EAK5C;AACCD,MAAAA,EAAE,EAAE,uBADL;AAECC,MAAAA,KAAK,EAAE;AAFR,KAL4C,EAS5C;AACCD,MAAAA,EAAE,EAAE,mCADL;AAECC,MAAAA,KAAK,EAAE;AAFR,KAT4C,EAa5C;AACCD,MAAAA,EAAE,EAAE,kBADL;AAECC,MAAAA,KAAK,EAAE;AAFR,KAb4C,C;sGAmBtBC,8B;qGACc,CACpC;AACCC,MAAAA,IAAI,EAAE,QADP;AAECC,MAAAA,KAAK,EAAE;AAFR,KADoC,EAKpC;AACCD,MAAAA,IAAI,EAAE,sBADP;AAECC,MAAAA,KAAK,EAAE;AAFR,KALoC,C;;;;;;;mGAWrC,iBAAqBC,OAArB;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,wCACiB,KAAKC,2BAAL,CAAiCD,OAAjC,CADjB,EACSE,GADT,yBACSA,GADT;AAGC,qBAAKC,EAAL,CAAQC,YAAR,CAAqB,2BAArB;AAHD;AAAA,uBAKuB,KAAKC,oBAAL,EALvB;;AAAA;AAKOC,gBAAAA,OALP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;gHAsBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBACiC,KAAKgC,OAAL,CAAa,QAAb,EAAuBU,mBAAvB,EADjC;;AAAA;AACOC,gBAAAA,iBADP;AAGOC,gBAAAA,iBAHP,GAG2B,KAAKC,qBAAL,CAA2BC,MAA3B,CACzB,UAACC,oBAAD,EAA0B;AACzB,sBAAMC,gBAAgB,GAAGL,iBAAiB,CAACM,IAAlB,CACxB,UAACC,CAAD;AAAA,2BAAOA,CAAC,KAAKH,oBAAoB,CAACnD,EAAlC;AAAA,mBADwB,CAAzB;;AAGA,sBAAIoD,gBAAJ,EAAsB;AACrB,2BAAO,KAAP;AACA;;AACD,yBAAO,IAAP;AACA,iBATwB,CAH3B;AAAA,kDAcQJ,iBAdR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAxJwCO,2B","sourcesContent":["import { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport setupVscodeSchema from '#spruce/schemas/spruceCli/v2020_07_22/setupVscodeOptions.schema'\nimport PkgService from '../../../services/PkgService'\nimport { NpmPackage } from '../../../types/cli.types'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\nimport { Extension } from '../services/VsCodeService'\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.SetupVscodeOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.SetupVscodeOptions\n\nexport default class SetupAction extends AbstractAction<OptionsSchema> {\n\tpublic invocationMessage = 'Setting up Visual Studio Codez... 👾'\n\tprivate recommendedExtensions: Extension[] = [\n\t\t{\n\t\t\tid: 'dbaeumer.vscode-eslint',\n\t\t\tlabel: 'ESLint syntax validation and fixing',\n\t\t},\n\t\t{\n\t\t\tid: 'eg2.vscode-npm-script',\n\t\t\tlabel: 'NPM package.json validation and warnings',\n\t\t},\n\t\t{\n\t\t\tid: 'christian-kohler.npm-intellisense',\n\t\t\tlabel: 'Intellisense autocompletion of installed npm modules',\n\t\t},\n\t\t{\n\t\t\tid: 'mikestead.dotenv',\n\t\t\tlabel: '.env support',\n\t\t},\n\t]\n\n\tpublic optionsSchema = setupVscodeSchema\n\tprivate dependencies: NpmPackage[] = [\n\t\t{\n\t\t\tname: 'eslint',\n\t\t\tisDev: true,\n\t\t},\n\t\t{\n\t\t\tname: 'eslint-config-spruce',\n\t\t\tisDev: true,\n\t\t},\n\t]\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst { all } = this.validateAndNormalizeOptions(options)\n\n\t\tthis.ui.startLoading('Checking state of vscode.')\n\n\t\tconst missing = await this.getMissingExtensions()\n\t\tconst choices = missing.map((ext) => ({ value: ext.id, label: ext.label }))\n\t\tconst response: FeatureActionResponse = {\n\t\t\tsummaryLines: [],\n\t\t}\n\n\t\tconst skipConfirmExtensions = all || missing.length === 0\n\n\t\tif (!skipConfirmExtensions) {\n\t\t\tthis.ui.stopLoading()\n\t\t}\n\n\t\tawait this.optionallyInstallVscodeExtensions(\n\t\t\tskipConfirmExtensions,\n\t\t\tmissing,\n\t\t\tchoices,\n\t\t\tresponse\n\t\t)\n\n\t\tthis.ui.startLoading('Writing vscode configurations...')\n\n\t\tconst files = await this.Writer('vscode').writeVsCodeConfigurations(\n\t\t\tthis.cwd,\n\t\t\t!all\n\t\t)\n\n\t\tresponse.files = files\n\t\tresponse.packagesInstalled = []\n\n\t\tawait this.optionallyInstallEsListModules(response, all)\n\n\t\tresponse.hints = [\n\t\t\t\"Ok, now that that's done 😅, lets make sure Visual Studio Code can run tasks whenever you open this project.\",\n\t\t\t'',\n\t\t\t'Step 1: Open the Command Palette (View -> Command Palette or cmd+shift+p) and type \"Manage\".',\n\t\t\t'Step 2: Select \"Tasks: Manage Automatic Tasks in Folder\".',\n\t\t\t'Step 3: Allow.',\n\t\t\t'Step 4: Open the Command Palette (cmd+shift+p)).',\n\t\t\t'Step 5: Select \"Developer: Reload Window\".',\n\t\t\t'💪',\n\t\t]\n\n\t\treturn response\n\t}\n\n\tprivate async optionallyInstallVscodeExtensions(\n\t\tskipConfirmExtensions: boolean,\n\t\tmissing: Extension[],\n\t\tchoices: { value: string; label: string }[],\n\t\tresponse: FeatureActionResponse\n\t) {\n\t\tconst answers = skipConfirmExtensions\n\t\t\t? missing.map((m) => m.id)\n\t\t\t: await this.ui.prompt({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tlabel: 'Which extensions should I install?',\n\t\t\t\t\tisArray: true,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tchoices,\n\t\t\t\t\t},\n\t\t\t })\n\n\t\tif (answers && answers?.length > 0) {\n\t\t\tthis.ui.startLoading(`Installing ${answers.length} extensions...`)\n\n\t\t\tfor (const answer of answers) {\n\t\t\t\tresponse.summaryLines?.push(`Installed ${answer} extension.`)\n\t\t\t}\n\n\t\t\tawait this.Service('vsCode').installExtensions(answers)\n\n\t\t\tthis.ui.stopLoading()\n\t\t}\n\t}\n\n\tprivate async optionallyInstallEsListModules(\n\t\tresponse: FeatureActionResponse,\n\t\tall: boolean | undefined\n\t) {\n\t\tconst pkg = this.Service('pkg')\n\n\t\tfor (const module of this.dependencies) {\n\t\t\tif (!pkg.isInstalled(module.name)) {\n\t\t\t\t;(response.packagesInstalled ?? []).push(module)\n\t\t\t}\n\t\t}\n\n\t\tif ((response.packagesInstalled ?? []).length > 0) {\n\t\t\tawait this.installEsLintModules(all, response, pkg)\n\t\t}\n\t}\n\n\tprivate async installEsLintModules(\n\t\tall: boolean | undefined,\n\t\tresponse: FeatureActionResponse,\n\t\tpkg: PkgService\n\t) {\n\t\tthis.ui.stopLoading()\n\t\tconst shouldInstallPackages =\n\t\t\tall ||\n\t\t\t(await this.ui.confirm(\n\t\t\t\t'Last thing! Ready for me to install eslint modules?'\n\t\t\t))\n\n\t\tthis.ui.startLoading('Installing dev dependencies')\n\t\tif (shouldInstallPackages) {\n\t\t\tfor (const module of response.packagesInstalled ?? []) {\n\t\t\t\tawait pkg.install(module.name, {\n\t\t\t\t\tisDev: module.isDev,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async getMissingExtensions() {\n\t\tconst currentExtensions = await this.Service('vsCode').getVSCodeExtensions()\n\n\t\tconst missingExtensions = this.recommendedExtensions.filter(\n\t\t\t(recommendedExtension) => {\n\t\t\t\tconst currentExtension = currentExtensions.find(\n\t\t\t\t\t(e) => e === recommendedExtension.id\n\t\t\t\t)\n\t\t\t\tif (currentExtension) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t}\n\t\t)\n\t\treturn missingExtensions\n\t}\n}\n"],"file":"SetupAction.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/vscode/actions/SetupAction.ts"],"names":["SetupAction","id","label","setupVscodeSchema","name","isDev","options","validateAndNormalizeOptions","all","ui","startLoading","getMissingExtensions","missing","choices","map","ext","value","response","summaryLines","skipConfirmExtensions","length","stopLoading","optionallyInstallVscodeExtensions","Writer","writeVsCodeConfigurations","cwd","files","packagesInstalled","optionallyInstallEsListModules","hints","m","prompt","type","isArray","answers","answer","push","Service","installExtensions","pkg","dependencies","module","isInstalled","installEsLintModules","confirm","shouldInstallPackages","install","getVSCodeExtensions","currentExtensions","missingExtensions","recommendedExtensions","filter","recommendedExtension","currentExtension","find","e","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAGA;;;;;;;;;;;;IAQqBA,W;;;;;;;;;;;;;;;0GACO,sC;8GACkB,CAC5C;AACCC,MAAAA,EAAE,EAAE,wBADL;AAECC,MAAAA,KAAK,EAAE;AAFR,KAD4C,EAK5C;AACCD,MAAAA,EAAE,EAAE,uBADL;AAECC,MAAAA,KAAK,EAAE;AAFR,KAL4C,EAS5C;AACCD,MAAAA,EAAE,EAAE,mCADL;AAECC,MAAAA,KAAK,EAAE;AAFR,KAT4C,EAa5C;AACCD,MAAAA,EAAE,EAAE,kBADL;AAECC,MAAAA,KAAK,EA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,qBAaKmC,qBAbL;AAAA;AAAA;AAAA;;AAAA,kFAcuB5B,QAAQ,CAACU,iBAdhC,2EAcqD,EAdrD;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAcac,gBAAAA,MAdb;AAAA;AAAA,uBAeSF,GAAG,CAACO,OAAJ,CAAYL,MAAM,CAACrC,IAAnB,EAAyB;AAC9BC,kBAAAA,KAAK,EAAEoC,MAAM,CAACpC;AADgB,iBAAzB,CAfT;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;gHAsBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBACiC,KAAKgC,OAAL,CAAa,QAAb,EAAuBU,mBAAvB,EADjC;;AAAA;AACOC,gBAAAA,iBADP;AAGOC,gBAAAA,iBAHP,GAG2B,KAAKC,qBAAL,CAA2BC,MAA3B,CACzB,UAACC,oBAAD,EAA0B;AACzB,sBAAMC,gBAAgB,GAAGL,iBAAiB,CAACM,IAAlB,CACxB,UAACC,CAAD;AAAA,2BAAOA,CAAC,KAAKH,oBAAoB,CAACnD,EAAlC;AAAA,mBADwB,CAAzB;;AAGA,sBAAIoD,gBAAJ,EAAsB;AACrB,2BAAO,KAAP;AACA;;AACD,yBAAO,IAAP;AACA,iBATwB,CAH3B;AAAA,kDAcQJ,iBAdR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAzJwCO,2B","sourcesContent":["import { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport setupVscodeSchema from '#spruce/schemas/spruceCli/v2020_07_22/setupVscodeOptions.schema'\nimport PkgService from '../../../services/PkgService'\nimport { NpmPackage } from '../../../types/cli.types'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\nimport { Extension } from '../services/VsCodeService'\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.SetupVscodeOptionsSchema\ntype Options = SpruceSchemas.SpruceCli.v2020_07_22.SetupVscodeOptions\n\nexport default class SetupAction extends AbstractAction<OptionsSchema> {\n\tpublic invocationMessage = 'Setting up Visual Studio Codez... 👾'\n\tprivate recommendedExtensions: Extension[] = [\n\t\t{\n\t\t\tid: 'dbaeumer.vscode-eslint',\n\t\t\tlabel: 'ESLint syntax validation and fixing',\n\t\t},\n\t\t{\n\t\t\tid: 'eg2.vscode-npm-script',\n\t\t\tlabel: 'NPM package.json validation and warnings',\n\t\t},\n\t\t{\n\t\t\tid: 'christian-kohler.npm-intellisense',\n\t\t\tlabel: 'Intellisense autocompletion of installed npm modules',\n\t\t},\n\t\t{\n\t\t\tid: 'mikestead.dotenv',\n\t\t\tlabel: '.env support',\n\t\t},\n\t]\n\n\tpublic optionsSchema = setupVscodeSchema\n\tprivate dependencies: NpmPackage[] = [\n\t\t{\n\t\t\tname: 'eslint',\n\t\t\tisDev: true,\n\t\t},\n\t\t{\n\t\t\tname: 'eslint-config-spruce',\n\t\t\tisDev: true,\n\t\t},\n\t]\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst { all } = this.validateAndNormalizeOptions(options)\n\n\t\tthis.ui.startLoading('Checking state of vscode.')\n\n\t\tconst missing = await this.getMissingExtensions()\n\t\tconst choices = missing.map((ext) => ({ value: ext.id, label: ext.label }))\n\t\tconst response: FeatureActionResponse = {\n\t\t\tsummaryLines: [],\n\t\t}\n\n\t\tconst skipConfirmExtensions = all || missing.length === 0\n\n\t\tif (!skipConfirmExtensions) {\n\t\t\tthis.ui.stopLoading()\n\t\t}\n\n\t\tawait this.optionallyInstallVscodeExtensions(\n\t\t\tskipConfirmExtensions,\n\t\t\tmissing,\n\t\t\tchoices,\n\t\t\tresponse\n\t\t)\n\n\t\tthis.ui.startLoading('Writing vscode configurations...')\n\n\t\tconst files = await this.Writer('vscode').writeVsCodeConfigurations(\n\t\t\tthis.cwd,\n\t\t\t!all\n\t\t)\n\n\t\tresponse.files = files\n\t\tresponse.packagesInstalled = []\n\n\t\tawait this.optionallyInstallEsListModules(response, all)\n\n\t\tresponse.hints = [\n\t\t\t\"Ok, now that that's done 😅, lets make sure Visual Studio Code can run tasks whenever you open this project.\",\n\t\t\t'',\n\t\t\t'Step 1: Open the Command Palette (View -> Command Palette or cmd+shift+p) and type \"Manage\".',\n\t\t\t'Step 2: Select \"Tasks: Manage Automatic Tasks in Folder\".',\n\t\t\t'Step 3: Allow.',\n\t\t\t'Step 4: Open the Command Palette (cmd+shift+p)).',\n\t\t\t'Step 5: Select \"Developer: Reload Window\".',\n\t\t\t'💪',\n\t\t]\n\n\t\treturn response\n\t}\n\n\tprivate async optionallyInstallVscodeExtensions(\n\t\tskipConfirmExtensions: boolean,\n\t\tmissing: Extension[],\n\t\tchoices: { value: string; label: string }[],\n\t\tresponse: FeatureActionResponse\n\t) {\n\t\tconst answers = skipConfirmExtensions\n\t\t\t? missing.map((m) => m.id)\n\t\t\t: await this.ui.prompt({\n\t\t\t\t\ttype: 'select',\n\t\t\t\t\tlabel: 'Which extensions should I install?',\n\t\t\t\t\tisArray: true,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tchoices,\n\t\t\t\t\t},\n\t\t\t })\n\n\t\tif (answers && answers?.length > 0) {\n\t\t\tthis.ui.startLoading(`Installing ${answers.length} extensions...`)\n\n\t\t\tfor (const answer of answers) {\n\t\t\t\tresponse.summaryLines?.push(`Installed ${answer} extension.`)\n\t\t\t}\n\n\t\t\tawait this.Service('vsCode').installExtensions(answers)\n\n\t\t\tthis.ui.stopLoading()\n\t\t}\n\t}\n\n\tprivate async optionallyInstallEsListModules(\n\t\tresponse: FeatureActionResponse,\n\t\tall: boolean | undefined\n\t) {\n\t\tconst pkg = this.Service('pkg')\n\n\t\tfor (const module of this.dependencies) {\n\t\t\tif (!pkg.isInstalled(module.name)) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-extra-semi\n\t\t\t\t;(response.packagesInstalled ?? []).push(module)\n\t\t\t}\n\t\t}\n\n\t\tif ((response.packagesInstalled ?? []).length > 0) {\n\t\t\tawait this.installEsLintModules(all, response, pkg)\n\t\t}\n\t}\n\n\tprivate async installEsLintModules(\n\t\tall: boolean | undefined,\n\t\tresponse: FeatureActionResponse,\n\t\tpkg: PkgService\n\t) {\n\t\tthis.ui.stopLoading()\n\t\tconst shouldInstallPackages =\n\t\t\tall ||\n\t\t\t(await this.ui.confirm(\n\t\t\t\t'Last thing! Ready for me to install eslint modules?'\n\t\t\t))\n\n\t\tthis.ui.startLoading('Installing dev dependencies')\n\t\tif (shouldInstallPackages) {\n\t\t\tfor (const module of response.packagesInstalled ?? []) {\n\t\t\t\tawait pkg.install(module.name, {\n\t\t\t\t\tisDev: module.isDev,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async getMissingExtensions() {\n\t\tconst currentExtensions = await this.Service('vsCode').getVSCodeExtensions()\n\n\t\tconst missingExtensions = this.recommendedExtensions.filter(\n\t\t\t(recommendedExtension) => {\n\t\t\t\tconst currentExtension = currentExtensions.find(\n\t\t\t\t\t(e) => e === recommendedExtension.id\n\t\t\t\t)\n\t\t\t\tif (currentExtension) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t}\n\t\t)\n\t\treturn missingExtensions\n\t}\n}\n"],"file":"SetupAction.js"}
|
|
@@ -21,7 +21,6 @@ var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
|
21
21
|
|
|
22
22
|
var _SpruceError = _interopRequireDefault(require("../errors/SpruceError"));
|
|
23
23
|
|
|
24
|
-
// import { CLIEngine } from 'eslint'
|
|
25
24
|
var LintService = function LintService(cwd, command) {
|
|
26
25
|
var _this = this;
|
|
27
26
|
|
|
@@ -30,7 +29,7 @@ var LintService = function LintService(cwd, command) {
|
|
|
30
29
|
(0, _defineProperty2["default"])(this, "command", void 0);
|
|
31
30
|
(0, _defineProperty2["default"])(this, "fix", /*#__PURE__*/function () {
|
|
32
31
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(pattern) {
|
|
33
|
-
var fixedFiles, fixedPaths, _yield$_this$command$, stdout, i, fixedFile;
|
|
32
|
+
var fixedFiles, fixedPaths, script, _yield$_this$command$, stdout, i, fixedFile;
|
|
34
33
|
|
|
35
34
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
36
35
|
while (1) {
|
|
@@ -50,20 +49,21 @@ var LintService = function LintService(cwd, command) {
|
|
|
50
49
|
fixedFiles = {};
|
|
51
50
|
fixedPaths = [];
|
|
52
51
|
_context.prev = 4;
|
|
53
|
-
|
|
52
|
+
script = "\"(async function lint() { try { const { ESLint } = require('eslint'); const cli = new ESLint({ fix: true, cwd: '".concat(_this.cwd, "', }); const result = await cli.lintFiles(['").concat(pattern, "']); console.log(JSON.stringify(result)); } catch (err) { console.log(err.toString()); }})()\"");
|
|
53
|
+
_context.next = 8;
|
|
54
54
|
return _this.command.execute('node', {
|
|
55
|
-
args: ['-e',
|
|
55
|
+
args: ['-e', script]
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
case
|
|
58
|
+
case 8:
|
|
59
59
|
_yield$_this$command$ = _context.sent;
|
|
60
60
|
stdout = _yield$_this$command$.stdout;
|
|
61
61
|
fixedFiles = JSON.parse(stdout);
|
|
62
|
-
_context.next =
|
|
62
|
+
_context.next = 16;
|
|
63
63
|
break;
|
|
64
64
|
|
|
65
|
-
case
|
|
66
|
-
_context.prev =
|
|
65
|
+
case 13:
|
|
66
|
+
_context.prev = 13;
|
|
67
67
|
_context.t0 = _context["catch"](4);
|
|
68
68
|
throw new _SpruceError["default"]({
|
|
69
69
|
code: 'LINT_FAILED',
|
|
@@ -71,47 +71,47 @@ var LintService = function LintService(cwd, command) {
|
|
|
71
71
|
originalError: _context.t0
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
case
|
|
75
|
-
if (!fixedFiles
|
|
76
|
-
_context.next =
|
|
74
|
+
case 16:
|
|
75
|
+
if (!fixedFiles) {
|
|
76
|
+
_context.next = 27;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
i = 0;
|
|
81
81
|
|
|
82
|
-
case
|
|
83
|
-
if (!(i < fixedFiles.
|
|
84
|
-
_context.next =
|
|
82
|
+
case 18:
|
|
83
|
+
if (!(i < fixedFiles.length)) {
|
|
84
|
+
_context.next = 27;
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
fixedFile = fixedFiles
|
|
88
|
+
fixedFile = fixedFiles[i];
|
|
89
89
|
|
|
90
90
|
if (!(fixedFile && fixedFile.output)) {
|
|
91
|
-
_context.next =
|
|
91
|
+
_context.next = 24;
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
_context.next =
|
|
95
|
+
_context.next = 23;
|
|
96
96
|
return _fsExtra["default"].writeFile(fixedFile.filePath, fixedFile.output);
|
|
97
97
|
|
|
98
|
-
case
|
|
98
|
+
case 23:
|
|
99
99
|
fixedPaths.push(fixedFile.filePath);
|
|
100
100
|
|
|
101
|
-
case
|
|
101
|
+
case 24:
|
|
102
102
|
i += 1;
|
|
103
|
-
_context.next =
|
|
103
|
+
_context.next = 18;
|
|
104
104
|
break;
|
|
105
105
|
|
|
106
|
-
case
|
|
106
|
+
case 27:
|
|
107
107
|
return _context.abrupt("return", fixedPaths);
|
|
108
108
|
|
|
109
|
-
case
|
|
109
|
+
case 28:
|
|
110
110
|
case "end":
|
|
111
111
|
return _context.stop();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
}, _callee, null, [[4,
|
|
114
|
+
}, _callee, null, [[4, 13]]);
|
|
115
115
|
}));
|
|
116
116
|
|
|
117
117
|
return function (_x) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/services/LintService.ts"],"names":["LintService","cwd","command","pattern","SchemaError","code","parameters","fixedFiles","fixedPaths","execute","args","stdout","JSON","parse","SpruceError","originalError","
|
|
1
|
+
{"version":3,"sources":["../../src/services/LintService.ts"],"names":["LintService","cwd","command","pattern","SchemaError","code","parameters","fixedFiles","fixedPaths","script","execute","args","stdout","JSON","parse","SpruceError","originalError","i","length","fixedFile","output","fs","writeFile","filePath","push"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;IAGqBA,W,GAIpB,qBAAmBC,GAAnB,EAAgCC,OAAhC,EAAyD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,6FAK5C,iBAAOC,OAAP;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,kBACPA,OADO;AAAA;AAAA;AAAA;;AAAA,oBAEL,IAAIC,mBAAJ,CAAgB;AACrBC,gBAAAA,IAAI,EAAE,oBADe;AAErBC,gBAAAA,UAAU,EAAE,CAAC,SAAD;AAFS,eAAhB,CAFK;;AAAA;AAQRC,cAAAA,UARQ,GAQU,EARV;AASNC,cAAAA,UATM,GASiB,EATjB;AAAA;AAWLC,cAAAA,MAXK,8HAWuH,KAAI,CAACR,GAX5H,yDAW8KE,OAX9K;AAAA;AAAA,qBAac,KAAI,CAACD,OAAL,CAAaQ,OAAb,CAAqB,MAArB,EAA6B;AACrDC,gBAAAA,IAAI,EAAE,CAAC,IAAD,EAAOF,MAAP;AAD+C,eAA7B,CAbd;;AAAA;AAAA;AAaHG,cAAAA,MAbG,yBAaHA,MAbG;AAiBXL,cAAAA,UAAU,GAAGM,IAAI,CAACC,KAAL,CAAWF,MAAX,CAAb;AAjBW;AAAA;;AAAA;AAAA;AAAA;AAAA,oBAmBL,IAAIG,uBAAJ,CAAgB;AACrBV,gBAAAA,IAAI,EAAE,aADe;AAErBF,gBAAAA,OAAO,EAAPA,OAFqB;AAGrBa,gBAAAA,aAAa;AAHQ,eAAhB,CAnBK;;AAAA;AAAA,mBA0BRT,UA1BQ;AAAA;AAAA;AAAA;;AA2BFU,cAAAA,CA3BE,GA2BE,CA3BF;;AAAA;AAAA,oBA2BKA,CAAC,GAAGV,UAAU,CAACW,MA3BpB;AAAA;AAAA;AAAA;;AA4BJC,cAAAA,SA5BI,GA4BQZ,UAAU,CAACU,CAAD,CA5BlB;;AAAA,oBA6BNE,SAAS,IAAIA,SAAS,CAACC,MA7BjB;AAAA;AAAA;AAAA;;AAAA;AAAA,qBA8BHC,oBAAGC,SAAH,CAAaH,SAAS,CAACI,QAAvB,EAAiCJ,SAAS,CAACC,MAA3C,CA9BG;;AAAA;AA+BTZ,cAAAA,UAAU,CAACgB,IAAX,CAAgBL,SAAS,CAACI,QAA1B;;AA/BS;AA2B4BN,cAAAA,CAAC,IAAI,CA3BjC;AAAA;AAAA;;AAAA;AAAA,+CAoCLT,UApCK;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAL4C;;AAAA;AAAA;AAAA;AAAA;AACxD,OAAKP,GAAL,GAAWA,GAAX;AACA,OAAKC,OAAL,GAAeA,OAAf;AACA,C","sourcesContent":["import { SchemaError } from '@sprucelabs/schema'\nimport fs from 'fs-extra'\nimport SpruceError from '../errors/SpruceError'\nimport CommandService from './CommandService'\n\nexport default class LintService {\n\tpublic cwd: string\n\tprivate command: CommandService\n\n\tpublic constructor(cwd: string, command: CommandService) {\n\t\tthis.cwd = cwd\n\t\tthis.command = command\n\t}\n\n\tpublic fix = async (pattern: string): Promise<string[]> => {\n\t\tif (!pattern) {\n\t\t\tthrow new SchemaError({\n\t\t\t\tcode: 'MISSING_PARAMETERS',\n\t\t\t\tparameters: ['pattern'],\n\t\t\t})\n\t\t}\n\n\t\tlet fixedFiles: any = {}\n\t\tconst fixedPaths: string[] = []\n\t\ttry {\n\t\t\tconst 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()); }})()\"`\n\n\t\t\tconst { stdout } = await this.command.execute('node', {\n\t\t\t\targs: ['-e', script],\n\t\t\t})\n\n\t\t\tfixedFiles = JSON.parse(stdout)\n\t\t} catch (err: any) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'LINT_FAILED',\n\t\t\t\tpattern,\n\t\t\t\toriginalError: err,\n\t\t\t})\n\t\t}\n\n\t\tif (fixedFiles) {\n\t\t\tfor (let i = 0; i < fixedFiles.length; i += 1) {\n\t\t\t\tconst fixedFile = fixedFiles[i]\n\t\t\t\tif (fixedFile && fixedFile.output) {\n\t\t\t\t\tawait fs.writeFile(fixedFile.filePath, fixedFile.output)\n\t\t\t\t\tfixedPaths.push(fixedFile.filePath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn fixedPaths\n\t}\n}\n"],"file":"LintService.js"}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"version": "14.21.
|
|
20
|
+
"version": "14.21.13",
|
|
21
21
|
"bin": {
|
|
22
22
|
"spruce": "./build/index.js"
|
|
23
23
|
},
|
|
@@ -76,18 +76,18 @@
|
|
|
76
76
|
"@babel/runtime": "^7.15.4",
|
|
77
77
|
"@jest/reporters": "^27.2.5",
|
|
78
78
|
"@sprucelabs/error": "^5.0.215",
|
|
79
|
-
"@sprucelabs/heartwood-view-controllers": "^33.0.
|
|
79
|
+
"@sprucelabs/heartwood-view-controllers": "^33.0.540",
|
|
80
80
|
"@sprucelabs/jest-json-reporter": "^6.0.192",
|
|
81
|
-
"@sprucelabs/mercury-client": "^16.11.
|
|
82
|
-
"@sprucelabs/mercury-event-emitter": "^16.11.
|
|
83
|
-
"@sprucelabs/mercury-types": "^26.1.
|
|
84
|
-
"@sprucelabs/schema": "^25.3.
|
|
85
|
-
"@sprucelabs/spruce-core-schemas": "^22.5.
|
|
86
|
-
"@sprucelabs/spruce-event-plugin": "^5.4.
|
|
87
|
-
"@sprucelabs/spruce-event-utils": "^16.0.
|
|
88
|
-
"@sprucelabs/spruce-skill-booter": "^5.4.
|
|
89
|
-
"@sprucelabs/spruce-skill-utils": "^20.6.
|
|
90
|
-
"@sprucelabs/spruce-templates": "^14.21.
|
|
81
|
+
"@sprucelabs/mercury-client": "^16.11.7",
|
|
82
|
+
"@sprucelabs/mercury-event-emitter": "^16.11.7",
|
|
83
|
+
"@sprucelabs/mercury-types": "^26.1.336",
|
|
84
|
+
"@sprucelabs/schema": "^25.3.269",
|
|
85
|
+
"@sprucelabs/spruce-core-schemas": "^22.5.337",
|
|
86
|
+
"@sprucelabs/spruce-event-plugin": "^5.4.133",
|
|
87
|
+
"@sprucelabs/spruce-event-utils": "^16.0.373",
|
|
88
|
+
"@sprucelabs/spruce-skill-booter": "^5.4.133",
|
|
89
|
+
"@sprucelabs/spruce-skill-utils": "^20.6.207",
|
|
90
|
+
"@sprucelabs/spruce-templates": "^14.21.13",
|
|
91
91
|
"cfonts": "^2.10.0",
|
|
92
92
|
"chalk": "^4.1.2",
|
|
93
93
|
"chokidar": "^3.5.2",
|
|
@@ -116,14 +116,14 @@
|
|
|
116
116
|
"uuid": "^8.3.2"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
|
-
"@sprucelabs/data-stores": "^6.1.
|
|
119
|
+
"@sprucelabs/data-stores": "^6.1.251",
|
|
120
120
|
"@sprucelabs/jest-sheets-reporter": "^1.2.201",
|
|
121
|
-
"@sprucelabs/mercury-core-events": "^1.2.
|
|
121
|
+
"@sprucelabs/mercury-core-events": "^1.2.406",
|
|
122
122
|
"@sprucelabs/resolve-path-aliases": "^1.0.209",
|
|
123
|
-
"@sprucelabs/spruce-conversation-plugin": "^5.4.
|
|
124
|
-
"@sprucelabs/spruce-deploy-plugin": "^5.4.
|
|
125
|
-
"@sprucelabs/spruce-store-plugin": "^5.4.
|
|
126
|
-
"@sprucelabs/spruce-test-fixtures": "^5.4.
|
|
123
|
+
"@sprucelabs/spruce-conversation-plugin": "^5.4.133",
|
|
124
|
+
"@sprucelabs/spruce-deploy-plugin": "^5.4.133",
|
|
125
|
+
"@sprucelabs/spruce-store-plugin": "^5.4.133",
|
|
126
|
+
"@sprucelabs/spruce-test-fixtures": "^5.4.133",
|
|
127
127
|
"@sprucelabs/test": "^7.7.192",
|
|
128
128
|
"@sprucelabs/test-utils": "^3.0.181",
|
|
129
129
|
"@types/blessed": "^0.1.19",
|
|
@@ -149,8 +149,8 @@
|
|
|
149
149
|
"concurrently": "^6.3.0",
|
|
150
150
|
"conventional-changelog-sprucelabs": "^1.1.2",
|
|
151
151
|
"dotenv": "^10.0.0",
|
|
152
|
-
"eslint": "^
|
|
153
|
-
"eslint-config-spruce": "^10.10.
|
|
152
|
+
"eslint": "^8.0.0",
|
|
153
|
+
"eslint-config-spruce": "^10.10.14",
|
|
154
154
|
"find-process": "^1.4.5",
|
|
155
155
|
"jest": "^27.2.5",
|
|
156
156
|
"jest-circus": "^27.2.5",
|
|
@@ -569,7 +569,8 @@
|
|
|
569
569
|
"upgradingSkillSyncsEvents": "I251",
|
|
570
570
|
"upgradeCallsUpdateDependencies": "I252",
|
|
571
571
|
"canAlwaysSkipFiles": "I264",
|
|
572
|
-
"upgradingWritesExpectedFiles": "I289"
|
|
572
|
+
"upgradingWritesExpectedFiles": "I289",
|
|
573
|
+
"globalEmitterEmitsSEquentally": "I328"
|
|
573
574
|
}
|
|
574
575
|
}
|
|
575
576
|
],
|
|
@@ -590,5 +591,5 @@
|
|
|
590
591
|
"ora"
|
|
591
592
|
]
|
|
592
593
|
},
|
|
593
|
-
"gitHead": "
|
|
594
|
+
"gitHead": "e3bf627c9f60f4731dff4dbb10bff6766fffdc3f"
|
|
594
595
|
}
|
|
@@ -69,8 +69,8 @@ export default class SettingLogTransportsInASkillTest extends AbstractSkillTest
|
|
|
69
69
|
`
|
|
70
70
|
|
|
71
71
|
await this.createTransportWithContents(transportContents, 'File')
|
|
72
|
-
|
|
73
72
|
await this.Service('build').build()
|
|
73
|
+
|
|
74
74
|
const boot = await this.Action('skill', 'boot').execute({})
|
|
75
75
|
|
|
76
76
|
await boot.meta?.kill()
|
|
@@ -3,7 +3,7 @@ import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
|
3
3
|
|
|
4
4
|
export default class GlobalEmitterTest extends AbstractCliTest {
|
|
5
5
|
@test()
|
|
6
|
-
protected static async
|
|
6
|
+
protected static async globalEmitterEmitsSEquentally() {
|
|
7
7
|
const emitter = this.getEmitter()
|
|
8
8
|
|
|
9
9
|
//@ts-ignore
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"chokidar-cli": "^2.1.0",
|
|
59
59
|
"concurrently": "^5.3.0",
|
|
60
60
|
"conventional-changelog-sprucelabs": "^1.1.2",
|
|
61
|
-
"eslint": "^
|
|
62
|
-
"eslint-config-spruce": "10.
|
|
61
|
+
"eslint": "^8.0.0",
|
|
62
|
+
"eslint-config-spruce": "^10.10.14",
|
|
63
63
|
"jest": "^26.6.3",
|
|
64
64
|
"jest-circus": "^26.6.3",
|
|
65
65
|
"prettier": "^2.2.0",
|
|
@@ -69,6 +69,13 @@ export default class SpruceError extends AbstractSpruceError<ErrorOptions> {
|
|
|
69
69
|
|
|
70
70
|
case 'LINT_FAILED':
|
|
71
71
|
message = `Lint failed on pattern ${options.pattern}.`
|
|
72
|
+
|
|
73
|
+
if (options.originalError) {
|
|
74
|
+
message += `\n\nOriginal error:${
|
|
75
|
+
options.originalError.stack ?? options.originalError.message
|
|
76
|
+
}`
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
break
|
|
73
80
|
|
|
74
81
|
case 'EXECUTING_COMMAND_FAILED':
|
|
@@ -219,7 +219,7 @@ export default class TestReporter {
|
|
|
219
219
|
private updateOrientation() {
|
|
220
220
|
const frame = this.window.getFrame()
|
|
221
221
|
|
|
222
|
-
if (frame.width * 0.
|
|
222
|
+
if (frame.width * 0.5 > frame.height) {
|
|
223
223
|
this.orientation = 'landscape'
|
|
224
224
|
} else {
|
|
225
225
|
this.orientation = 'portrait'
|
|
@@ -131,6 +131,7 @@ export default class SetupAction extends AbstractAction<OptionsSchema> {
|
|
|
131
131
|
|
|
132
132
|
for (const module of this.dependencies) {
|
|
133
133
|
if (!pkg.isInstalled(module.name)) {
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-extra-semi
|
|
134
135
|
;(response.packagesInstalled ?? []).push(module)
|
|
135
136
|
}
|
|
136
137
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// import { CLIEngine } from 'eslint'
|
|
2
1
|
import { SchemaError } from '@sprucelabs/schema'
|
|
3
2
|
import fs from 'fs-extra'
|
|
4
3
|
import SpruceError from '../errors/SpruceError'
|
|
@@ -24,11 +23,10 @@ export default class LintService {
|
|
|
24
23
|
let fixedFiles: any = {}
|
|
25
24
|
const fixedPaths: string[] = []
|
|
26
25
|
try {
|
|
26
|
+
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()); }})()"`
|
|
27
|
+
|
|
27
28
|
const { stdout } = await this.command.execute('node', {
|
|
28
|
-
args: [
|
|
29
|
-
'-e',
|
|
30
|
-
`"try { const ESLint = require('eslint');const cli = new ESLint.CLIEngine({fix: true,cwd: '${this.cwd}'});const result=cli.executeOnFiles(['${pattern}']);console.log(JSON.stringify(result)); } catch(err) { console.log(err.toString()); }"`,
|
|
31
|
-
],
|
|
29
|
+
args: ['-e', script],
|
|
32
30
|
})
|
|
33
31
|
|
|
34
32
|
fixedFiles = JSON.parse(stdout)
|
|
@@ -40,9 +38,9 @@ export default class LintService {
|
|
|
40
38
|
})
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
if (fixedFiles
|
|
44
|
-
for (let i = 0; i < fixedFiles.
|
|
45
|
-
const fixedFile = fixedFiles
|
|
41
|
+
if (fixedFiles) {
|
|
42
|
+
for (let i = 0; i < fixedFiles.length; i += 1) {
|
|
43
|
+
const fixedFile = fixedFiles[i]
|
|
46
44
|
if (fixedFile && fixedFile.output) {
|
|
47
45
|
await fs.writeFile(fixedFile.filePath, fixedFile.output)
|
|
48
46
|
fixedPaths.push(fixedFile.filePath)
|