@neurodevs/node-tdd 0.2.5 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/launch.json +52 -57
- package/.vscode/settings.json +61 -66
- package/.vscode/tasks.json +98 -129
- package/README.md +1 -0
- package/build/.spruce/settings.json +3 -10
- package/build/__tests__/MockFetch.d.ts +18 -0
- package/build/__tests__/MockFetch.js +55 -0
- package/build/__tests__/MockFetch.js.map +1 -0
- package/build/__tests__/{impl → behavioral}/AbstractModuleTest.test.d.ts +2 -3
- package/build/__tests__/{impl → behavioral}/AbstractModuleTest.test.js +3 -12
- package/build/__tests__/behavioral/AbstractModuleTest.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.d.ts +5 -0
- package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.js +34 -0
- package/build/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/Assert.test.d.ts +45 -0
- package/build/__tests__/behavioral/utilities/Assert.test.js +645 -0
- package/build/__tests__/behavioral/utilities/Assert.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.d.ts +4 -0
- package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.js +23 -0
- package/build/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/MockFetch.test.d.ts +28 -0
- package/build/__tests__/behavioral/utilities/MockFetch.test.js +211 -0
- package/build/__tests__/behavioral/utilities/MockFetch.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/StackCleaner.test.d.ts +4 -0
- package/build/__tests__/behavioral/utilities/StackCleaner.test.js +46 -0
- package/build/__tests__/behavioral/utilities/StackCleaner.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.d.ts +7 -0
- package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.js +32 -0
- package/build/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.d.ts +4 -0
- package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.js +19 -0
- package/build/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/Stringify.test.d.ts +5 -0
- package/build/__tests__/behavioral/utilities/Stringify.test.js +127 -0
- package/build/__tests__/behavioral/utilities/Stringify.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.d.ts +7 -0
- package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.js +38 -0
- package/build/__tests__/behavioral/utilities/TestDecoratorResolver.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestOnBasic.test.d.ts +12 -0
- package/build/__tests__/behavioral/utilities/TestOnBasic.test.js +68 -0
- package/build/__tests__/behavioral/utilities/TestOnBasic.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestOnInstance.test.d.ts +28 -0
- package/build/__tests__/behavioral/utilities/TestOnInstance.test.js +289 -0
- package/build/__tests__/behavioral/utilities/TestOnInstance.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.d.ts +9 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.js +118 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.d.ts +5 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.js +78 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.d.ts +4 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.js +23 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.d.ts +4 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.js +24 -0
- package/build/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestResolver.test.d.ts +7 -0
- package/build/__tests__/behavioral/utilities/TestResolver.test.js +38 -0
- package/build/__tests__/behavioral/utilities/TestResolver.test.js.map +1 -0
- package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.d.ts +4 -0
- package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.js +20 -0
- package/build/__tests__/behavioral/utilities/TestResolverOnStatic.test.js.map +1 -0
- package/build/__tests__/behavioral/workspace/JestJsonParser.test.d.ts +18 -0
- package/build/__tests__/behavioral/workspace/JestJsonParser.test.js +267 -0
- package/build/__tests__/behavioral/workspace/JestJsonParser.test.js.map +1 -0
- package/build/__tests__/behavioral/workspace/TestReporter.test.d.ts +16 -0
- package/build/__tests__/behavioral/workspace/TestReporter.test.js +227 -0
- package/build/__tests__/behavioral/workspace/TestReporter.test.js.map +1 -0
- package/build/__tests__/behavioral/workspace/TestRunner.test.d.ts +15 -0
- package/build/__tests__/behavioral/workspace/TestRunner.test.js +99 -0
- package/build/__tests__/behavioral/workspace/TestRunner.test.js.map +1 -0
- package/build/__tests__/behavioral/workspace/Widgets.test.d.ts +13 -0
- package/build/__tests__/behavioral/workspace/Widgets.test.js +99 -0
- package/build/__tests__/behavioral/workspace/Widgets.test.js.map +1 -0
- package/build/__tests__/mock-terminal-kit.d.ts +79 -0
- package/build/__tests__/mock-terminal-kit.js +103 -0
- package/build/__tests__/mock-terminal-kit.js.map +1 -0
- package/build/__tests__/support/AbstractForInstanceTest.d.ts +4 -0
- package/build/__tests__/support/AbstractForInstanceTest.js +9 -0
- package/build/__tests__/support/AbstractForInstanceTest.js.map +1 -0
- package/build/__tests__/support/AbstractLevelOneTest.d.ts +3 -0
- package/build/__tests__/support/AbstractLevelOneTest.js +4 -0
- package/build/__tests__/support/AbstractLevelOneTest.js.map +1 -0
- package/build/__tests__/support/AbstractLevelTwoTest.d.ts +7 -0
- package/build/__tests__/support/AbstractLevelTwoTest.js +14 -0
- package/build/__tests__/support/AbstractLevelTwoTest.js.map +1 -0
- package/build/__tests__/support/AbstractStaticTest.d.ts +7 -0
- package/build/__tests__/support/AbstractStaticTest.js +14 -0
- package/build/__tests__/support/AbstractStaticTest.js.map +1 -0
- package/build/__tests__/support/AbstractTestOnInstanceTest.d.ts +22 -0
- package/build/__tests__/support/AbstractTestOnInstanceTest.js +23 -0
- package/build/__tests__/support/AbstractTestOnInstanceTest.js.map +1 -0
- package/build/__tests__/support/AbstractTestOnInstanceWithHooks.d.ts +26 -0
- package/build/__tests__/support/AbstractTestOnInstanceWithHooks.js +59 -0
- package/build/__tests__/support/AbstractTestOnInstanceWithHooks.js.map +1 -0
- package/build/__tests__/support/jest.setup.d.ts +1 -0
- package/build/__tests__/support/jest.setup.js +4 -0
- package/build/__tests__/support/jest.setup.js.map +1 -0
- package/build/__tests__/support/onTestFileResult.d.ts +244 -0
- package/build/__tests__/support/onTestFileResult.js +980 -0
- package/build/__tests__/support/onTestFileResult.js.map +1 -0
- package/build/impl/AbstractModuleTest.d.ts +18 -4
- package/build/impl/AbstractModuleTest.js +47 -9
- package/build/impl/AbstractModuleTest.js.map +1 -1
- package/build/index.d.ts +4 -4
- package/build/index.js +4 -4
- package/build/index.js.map +1 -1
- package/build/utilities/AssertionError.d.ts +3 -0
- package/build/utilities/AssertionError.js +12 -0
- package/build/utilities/AssertionError.js.map +1 -0
- package/build/utilities/StackCleaner.d.ts +4 -0
- package/build/utilities/StackCleaner.js +10 -0
- package/build/utilities/StackCleaner.js.map +1 -0
- package/build/utilities/TestDecoratorResolver.d.ts +35 -0
- package/build/utilities/TestDecoratorResolver.js +93 -0
- package/build/utilities/TestDecoratorResolver.js.map +1 -0
- package/build/utilities/assert.d.ts +49 -0
- package/build/utilities/assert.js +255 -0
- package/build/utilities/assert.js.map +1 -0
- package/build/utilities/assert.utility.d.ts +28 -0
- package/build/utilities/assert.utility.js +185 -0
- package/build/utilities/assert.utility.js.map +1 -0
- package/build/utilities/decorators.d.ts +9 -0
- package/build/utilities/decorators.js +133 -0
- package/build/utilities/decorators.js.map +1 -0
- package/build/workspace/CommandService.d.ts +49 -0
- package/build/workspace/CommandService.js +179 -0
- package/build/workspace/CommandService.js.map +1 -0
- package/build/workspace/JestJsonParser.d.ts +15 -0
- package/build/workspace/JestJsonParser.js +149 -0
- package/build/workspace/JestJsonParser.js.map +1 -0
- package/build/workspace/TKButtonWidget.d.ts +13 -0
- package/build/workspace/TKButtonWidget.js +37 -0
- package/build/workspace/TKButtonWidget.js.map +1 -0
- package/build/workspace/TestLogItemGenerator.d.ts +15 -0
- package/build/workspace/TestLogItemGenerator.js +142 -0
- package/build/workspace/TestLogItemGenerator.js.map +1 -0
- package/build/workspace/TestReporter.d.ts +103 -0
- package/build/workspace/TestReporter.js +677 -0
- package/build/workspace/TestReporter.js.map +1 -0
- package/build/workspace/TestRunner.d.ts +24 -0
- package/build/workspace/TestRunner.js +95 -0
- package/build/workspace/TestRunner.js.map +1 -0
- package/build/workspace/TkBaseWidget.d.ts +37 -0
- package/build/workspace/TkBaseWidget.js +185 -0
- package/build/workspace/TkBaseWidget.js.map +1 -0
- package/build/workspace/TkInputWidget.d.ts +16 -0
- package/build/workspace/TkInputWidget.js +64 -0
- package/build/workspace/TkInputWidget.js.map +1 -0
- package/build/workspace/TkLayoutCellWidget.d.ts +18 -0
- package/build/workspace/TkLayoutCellWidget.js +32 -0
- package/build/workspace/TkLayoutCellWidget.js.map +1 -0
- package/build/workspace/TkLayoutWidget.d.ts +34 -0
- package/build/workspace/TkLayoutWidget.js +130 -0
- package/build/workspace/TkLayoutWidget.js.map +1 -0
- package/build/workspace/TkMenuBarWidget.d.ts +13 -0
- package/build/workspace/TkMenuBarWidget.js +71 -0
- package/build/workspace/TkMenuBarWidget.js.map +1 -0
- package/build/workspace/TkPopupWidget.d.ts +16 -0
- package/build/workspace/TkPopupWidget.js +36 -0
- package/build/workspace/TkPopupWidget.js.map +1 -0
- package/build/workspace/TkProgressBarWidget.d.ts +10 -0
- package/build/workspace/TkProgressBarWidget.js +39 -0
- package/build/workspace/TkProgressBarWidget.js.map +1 -0
- package/build/workspace/TkTextWidget.d.ts +20 -0
- package/build/workspace/TkTextWidget.js +115 -0
- package/build/workspace/TkTextWidget.js.map +1 -0
- package/build/workspace/TkWindowWidget.d.ts +22 -0
- package/build/workspace/TkWindowWidget.js +88 -0
- package/build/workspace/TkWindowWidget.js.map +1 -0
- package/build/workspace/WidgetFactory.d.ts +6 -0
- package/build/workspace/WidgetFactory.js +21 -0
- package/build/workspace/WidgetFactory.js.map +1 -0
- package/build/workspace/button.types.d.ts +15 -0
- package/build/workspace/button.types.js +6 -0
- package/build/workspace/button.types.js.map +1 -0
- package/build/workspace/duration.utility.d.ts +4 -0
- package/build/workspace/duration.utility.js +26 -0
- package/build/workspace/duration.utility.js.map +1 -0
- package/build/workspace/factory.types.d.ts +89 -0
- package/build/workspace/factory.types.js +37 -0
- package/build/workspace/factory.types.js.map +1 -0
- package/build/workspace/input.types.d.ts +18 -0
- package/build/workspace/input.types.js +7 -0
- package/build/workspace/input.types.js.map +1 -0
- package/build/workspace/keySelectChoices.d.ts +517 -0
- package/build/workspace/keySelectChoices.js +2 -0
- package/build/workspace/keySelectChoices.js.map +1 -0
- package/build/workspace/layout.types.d.ts +33 -0
- package/build/workspace/layout.types.js +2 -0
- package/build/workspace/layout.types.js.map +1 -0
- package/build/workspace/menuBar.types.d.ts +19 -0
- package/build/workspace/menuBar.types.js +6 -0
- package/build/workspace/menuBar.types.js.map +1 -0
- package/build/workspace/popup.types.d.ts +13 -0
- package/build/workspace/popup.types.js +6 -0
- package/build/workspace/popup.types.js.map +1 -0
- package/build/workspace/progressBar.types.d.ts +10 -0
- package/build/workspace/progressBar.types.js +2 -0
- package/build/workspace/progressBar.types.js.map +1 -0
- package/build/workspace/table.types.d.ts +6 -0
- package/build/workspace/table.types.js +2 -0
- package/build/workspace/table.types.js.map +1 -0
- package/build/workspace/termKit.utility.d.ts +12 -0
- package/build/workspace/termKit.utility.js +128 -0
- package/build/workspace/termKit.utility.js.map +1 -0
- package/build/workspace/test.types.d.ts +24 -0
- package/build/workspace/test.types.js +2 -0
- package/build/workspace/test.types.js.map +1 -0
- package/build/workspace/testRunner.cli.d.ts +1 -0
- package/build/workspace/testRunner.cli.js +149 -0
- package/build/workspace/testRunner.cli.js.map +1 -0
- package/build/workspace/text.types.d.ts +20 -0
- package/build/workspace/text.types.js +7 -0
- package/build/workspace/text.types.js.map +1 -0
- package/build/workspace/widget.utilities.d.ts +5 -0
- package/build/workspace/widget.utilities.js +20 -0
- package/build/workspace/widget.utilities.js.map +1 -0
- package/build/workspace/widgets.types.d.ts +66 -0
- package/build/workspace/widgets.types.js +2 -0
- package/build/workspace/widgets.types.js.map +1 -0
- package/build/workspace/window.types.d.ts +18 -0
- package/build/workspace/window.types.js +9 -0
- package/build/workspace/window.types.js.map +1 -0
- package/eslint.config.js +3 -0
- package/package.json +31 -37
- package/prettier.config.js +3 -0
- package/src/.spruce/settings.json +3 -10
- package/src/__tests__/MockFetch.ts +100 -0
- package/src/__tests__/behavioral/AbstractModuleTest.test.ts +15 -0
- package/src/__tests__/behavioral/utilities/AllHooksCalledEvenIfNotDefined.test.ts +31 -0
- package/src/__tests__/behavioral/utilities/Assert.test.ts +826 -0
- package/src/__tests__/behavioral/utilities/InstanceParentTestCanAccessParentMethods.test.ts +14 -0
- package/src/__tests__/behavioral/utilities/MockFetch.test.ts +240 -0
- package/src/__tests__/behavioral/utilities/StackCleaner.test.ts +46 -0
- package/src/__tests__/behavioral/utilities/StaticParentTestCanAccessParentMethods.test.ts +34 -0
- package/src/__tests__/behavioral/utilities/StaticTestInheritsAbstractSpruceTestProperly.test.ts +11 -0
- package/src/__tests__/behavioral/utilities/Stringify.test.ts +169 -0
- package/src/__tests__/behavioral/utilities/TestDecoratorResolver.test.ts +51 -0
- package/src/__tests__/behavioral/utilities/TestOnBasic.test.ts +62 -0
- package/src/__tests__/behavioral/utilities/TestOnInstance.test.ts +439 -0
- package/src/__tests__/behavioral/utilities/TestOnInstanceExtendsTest.test.ts +237 -0
- package/src/__tests__/behavioral/utilities/TestOnInstanceExtendsTestWithHooks.test.ts +85 -0
- package/src/__tests__/behavioral/utilities/TestOnInstanceWithParentBeforeAll.test.ts +14 -0
- package/src/__tests__/behavioral/utilities/TestOnInstanceWithTwoLevelsOfInheritence.test.ts +16 -0
- package/src/__tests__/behavioral/utilities/TestResolver.test.ts +48 -0
- package/src/__tests__/behavioral/utilities/TestResolverOnStatic.test.ts +12 -0
- package/src/__tests__/behavioral/workspace/JestJsonParser.test.ts +357 -0
- package/src/__tests__/behavioral/workspace/TestReporter.test.ts +257 -0
- package/src/__tests__/behavioral/workspace/TestRunner.test.ts +87 -0
- package/src/__tests__/behavioral/workspace/Widgets.test.ts +90 -0
- package/src/__tests__/mock-terminal-kit.ts +115 -0
- package/src/__tests__/support/AbstractForInstanceTest.ts +12 -0
- package/src/__tests__/support/AbstractLevelOneTest.ts +3 -0
- package/src/__tests__/support/AbstractLevelTwoTest.ts +16 -0
- package/src/__tests__/support/AbstractStaticTest.ts +16 -0
- package/src/__tests__/support/AbstractTestOnInstanceTest.ts +30 -0
- package/src/__tests__/support/AbstractTestOnInstanceWithHooks.ts +138 -0
- package/src/__tests__/support/jest.setup.ts +2 -0
- package/src/__tests__/support/onTestFileResult.ts +1008 -0
- package/src/impl/AbstractModuleTest.ts +59 -10
- package/src/index.ts +4 -4
- package/src/utilities/AssertionError.ts +14 -0
- package/src/utilities/StackCleaner.ts +14 -0
- package/src/utilities/TestDecoratorResolver.ts +118 -0
- package/src/utilities/assert.ts +583 -0
- package/src/utilities/assert.utility.ts +295 -0
- package/src/utilities/decorators.ts +167 -0
- package/src/workspace/CommandService.ts +256 -0
- package/src/workspace/JestJsonParser.ts +255 -0
- package/src/workspace/TKButtonWidget.ts +54 -0
- package/src/workspace/TestLogItemGenerator.ts +184 -0
- package/src/workspace/TestReporter.ts +865 -0
- package/src/workspace/TestRunner.ts +128 -0
- package/src/workspace/TkBaseWidget.ts +249 -0
- package/src/workspace/TkInputWidget.ts +83 -0
- package/src/workspace/TkLayoutCellWidget.ts +46 -0
- package/src/workspace/TkLayoutWidget.ts +181 -0
- package/src/workspace/TkMenuBarWidget.ts +95 -0
- package/src/workspace/TkPopupWidget.ts +47 -0
- package/src/workspace/TkProgressBarWidget.ts +54 -0
- package/src/workspace/TkTextWidget.ts +158 -0
- package/src/workspace/TkWindowWidget.ts +122 -0
- package/src/workspace/WidgetFactory.ts +33 -0
- package/src/workspace/button.types.ts +19 -0
- package/src/workspace/duration.utility.ts +34 -0
- package/src/workspace/factory.types.ts +101 -0
- package/src/workspace/input.types.ts +22 -0
- package/src/workspace/keySelectChoices.ts +134 -0
- package/src/workspace/layout.types.ts +40 -0
- package/src/workspace/menuBar.types.ts +24 -0
- package/src/workspace/popup.types.ts +17 -0
- package/src/workspace/progressBar.types.ts +13 -0
- package/src/workspace/table.types.ts +9 -0
- package/src/workspace/termKit.utility.ts +130 -0
- package/src/workspace/terminal-kit.d.ts +28 -0
- package/src/workspace/test.types.ts +34 -0
- package/src/workspace/testRunner.cli.ts +159 -0
- package/src/workspace/text.types.ts +26 -0
- package/src/workspace/widget.utilities.ts +35 -0
- package/src/workspace/widgets.types.ts +102 -0
- package/src/workspace/window.types.ts +22 -0
- package/tsconfig.json +23 -27
- package/build/__tests__/AbstractPackageTest.d.ts +0 -4
- package/build/__tests__/AbstractPackageTest.js +0 -7
- package/build/__tests__/AbstractPackageTest.js.map +0 -1
- package/build/__tests__/functions/assertFunction.test.d.ts +0 -5
- package/build/__tests__/functions/assertFunction.test.js +0 -23
- package/build/__tests__/functions/assertFunction.test.js.map +0 -1
- package/build/__tests__/functions/testFunction.test.d.ts +0 -5
- package/build/__tests__/functions/testFunction.test.js +0 -23
- package/build/__tests__/functions/testFunction.test.js.map +0 -1
- package/build/__tests__/impl/AbstractModuleTest.test.js.map +0 -1
- package/build/functions/assert.d.ts +0 -3
- package/build/functions/assert.js +0 -4
- package/build/functions/assert.js.map +0 -1
- package/build/functions/test.d.ts +0 -3
- package/build/functions/test.js +0 -4
- package/build/functions/test.js.map +0 -1
- package/eslint.config.mjs +0 -3
- package/src/__tests__/AbstractPackageTest.ts +0 -7
- package/src/__tests__/functions/assertFunction.test.ts +0 -22
- package/src/__tests__/functions/testFunction.test.ts +0 -22
- package/src/__tests__/impl/AbstractModuleTest.test.ts +0 -34
- package/src/functions/assert.ts +0 -4
- package/src/functions/test.ts +0 -4
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
type KeySelectChoices = [
|
|
2
|
+
{ label: 'ESCAPE'; value: 'ESCAPE' },
|
|
3
|
+
{ label: 'SPACE'; value: ' ' },
|
|
4
|
+
{ label: 'TAB'; value: 'TAB' },
|
|
5
|
+
{ label: 'ENTER'; value: 'ENTER' },
|
|
6
|
+
{ label: 'SHIFT_TAB'; value: 'SHIFT_TAB' },
|
|
7
|
+
{ label: 'ALT_TAB'; value: 'ALT_TAB' },
|
|
8
|
+
{ label: 'ALT_ENTER'; value: 'ALT_ENTER' },
|
|
9
|
+
{ label: 'UP'; value: 'UP' },
|
|
10
|
+
{ label: 'DOWN'; value: 'DOWN' },
|
|
11
|
+
{ label: 'RIGHT'; value: 'RIGHT' },
|
|
12
|
+
{ label: 'LEFT'; value: 'LEFT' },
|
|
13
|
+
{ label: 'SHIFT_UP'; value: 'SHIFT_UP' },
|
|
14
|
+
{ label: 'SHIFT_DOWN'; value: 'SHIFT_DOWN' },
|
|
15
|
+
{ label: 'SHIFT_RIGHT'; value: 'SHIFT_RIGHT' },
|
|
16
|
+
{ label: 'SHIFT_LEFT'; value: 'SHIFT_LEFT' },
|
|
17
|
+
{ label: 'ALT_UP'; value: 'ALT_UP' },
|
|
18
|
+
{ label: 'ALT_DOWN'; value: 'ALT_DOWN' },
|
|
19
|
+
{ label: 'ALT_RIGHT'; value: 'ALT_RIGHT' },
|
|
20
|
+
{ label: 'ALT_LEFT'; value: 'ALT_LEFT' },
|
|
21
|
+
{ label: 'CTRL_UP'; value: 'CTRL_UP' },
|
|
22
|
+
{ label: 'CTRL_DOWN'; value: 'CTRL_DOWN' },
|
|
23
|
+
{ label: 'CTRL_RIGHT'; value: 'CTRL_RIGHT' },
|
|
24
|
+
{ label: 'CTRL_LEFT'; value: 'CTRL_LEFT' },
|
|
25
|
+
{ label: 'BACKSPACE'; value: 'BACKSPACE' },
|
|
26
|
+
{ label: 'INSERT'; value: 'INSERT' },
|
|
27
|
+
{ label: 'DELETE'; value: 'DELETE' },
|
|
28
|
+
{ label: 'HOME'; value: 'HOME' },
|
|
29
|
+
{ label: 'END'; value: 'END' },
|
|
30
|
+
{ label: 'PAGE_UP'; value: 'PAGE_UP' },
|
|
31
|
+
{ label: 'PAGE_DOWN'; value: 'PAGE_DOWN' },
|
|
32
|
+
{ label: 'CTRL_INSERT'; value: 'CTRL_INSERT' },
|
|
33
|
+
{ label: 'CTRL_DELETE'; value: 'CTRL_DELETE' },
|
|
34
|
+
{ label: 'CTRL_HOME'; value: 'CTRL_HOME' },
|
|
35
|
+
{ label: 'CTRL_END'; value: 'CTRL_END' },
|
|
36
|
+
{ label: 'CTRL_PAGE_UP'; value: 'CTRL_PAGE_UP' },
|
|
37
|
+
{ label: 'CTRL_PAGE_DOWN'; value: 'CTRL_PAGE_DOWN' },
|
|
38
|
+
{ label: 'SHIFT_INSERT'; value: 'SHIFT_INSERT' },
|
|
39
|
+
{ label: 'SHIFT_DELETE'; value: 'SHIFT_DELETE' },
|
|
40
|
+
{ label: 'SHIFT_HOME'; value: 'SHIFT_HOME' },
|
|
41
|
+
{ label: 'SHIFT_END'; value: 'SHIFT_END' },
|
|
42
|
+
{ label: 'SHIFT_PAGE_UP'; value: 'SHIFT_PAGE_UP' },
|
|
43
|
+
{ label: 'SHIFT_PAGE_DOWN'; value: 'SHIFT_PAGE_DOWN' },
|
|
44
|
+
{ label: 'ALT_BACKSPACE'; value: 'ALT_BACKSPACE' },
|
|
45
|
+
{ label: 'ALT_INSERT'; value: 'ALT_INSERT' },
|
|
46
|
+
{ label: 'ALT_DELETE'; value: 'ALT_DELETE' },
|
|
47
|
+
{ label: 'ALT_HOME'; value: 'ALT_HOME' },
|
|
48
|
+
{ label: 'ALT_END'; value: 'ALT_END' },
|
|
49
|
+
{ label: 'ALT_PAGE_UP'; value: 'ALT_PAGE_UP' },
|
|
50
|
+
{ label: 'ALT_PAGE_DOWN'; value: 'ALT_PAGE_DOWN' },
|
|
51
|
+
{ label: 'KP_NUMLOCK'; value: 'KP_NUMLOCK' },
|
|
52
|
+
{ label: 'KP_DIVIDE'; value: 'KP_DIVIDE' },
|
|
53
|
+
{ label: 'KP_MULTIPLY'; value: 'KP_MULTIPLY' },
|
|
54
|
+
{ label: 'KP_MINUS'; value: 'KP_MINUS' },
|
|
55
|
+
{ label: 'KP_0'; value: 'KP_0' },
|
|
56
|
+
{ label: 'KP_1'; value: 'KP_1' },
|
|
57
|
+
{ label: 'KP_2'; value: 'KP_2' },
|
|
58
|
+
{ label: 'KP_3'; value: 'KP_3' },
|
|
59
|
+
{ label: 'KP_4'; value: 'KP_4' },
|
|
60
|
+
{ label: 'KP_5'; value: 'KP_5' },
|
|
61
|
+
{ label: 'KP_6'; value: 'KP_6' },
|
|
62
|
+
{ label: 'KP_7'; value: 'KP_7' },
|
|
63
|
+
{ label: 'KP_8'; value: 'KP_8' },
|
|
64
|
+
{ label: 'KP_9'; value: 'KP_9' },
|
|
65
|
+
{ label: 'KP_PLUS'; value: 'KP_PLUS' },
|
|
66
|
+
{ label: 'KP_DELETE'; value: 'KP_DELETE' },
|
|
67
|
+
{ label: 'KP_ENTER'; value: 'KP_ENTER' },
|
|
68
|
+
{ label: 'F1'; value: 'F1' },
|
|
69
|
+
{ label: 'F2'; value: 'F2' },
|
|
70
|
+
{ label: 'F3'; value: 'F3' },
|
|
71
|
+
{ label: 'F4'; value: 'F4' },
|
|
72
|
+
{ label: 'F5'; value: 'F5' },
|
|
73
|
+
{ label: 'F6'; value: 'F6' },
|
|
74
|
+
{ label: 'F7'; value: 'F7' },
|
|
75
|
+
{ label: 'F8'; value: 'F8' },
|
|
76
|
+
{ label: 'F9'; value: 'F9' },
|
|
77
|
+
{ label: 'F10'; value: 'F10' },
|
|
78
|
+
{ label: 'F11'; value: 'F11' },
|
|
79
|
+
{ label: 'F12'; value: 'F12' },
|
|
80
|
+
{ label: 'SHIFT_F1'; value: 'SHIFT_F1' },
|
|
81
|
+
{ label: 'SHIFT_F2'; value: 'SHIFT_F2' },
|
|
82
|
+
{ label: 'SHIFT_F3'; value: 'SHIFT_F3' },
|
|
83
|
+
{ label: 'SHIFT_F4'; value: 'SHIFT_F4' },
|
|
84
|
+
{ label: 'SHIFT_F5'; value: 'SHIFT_F5' },
|
|
85
|
+
{ label: 'SHIFT_F6'; value: 'SHIFT_F6' },
|
|
86
|
+
{ label: 'SHIFT_F7'; value: 'SHIFT_F7' },
|
|
87
|
+
{ label: 'SHIFT_F8'; value: 'SHIFT_F8' },
|
|
88
|
+
{ label: 'SHIFT_F9'; value: 'SHIFT_F9' },
|
|
89
|
+
{ label: 'SHIFT_F10'; value: 'SHIFT_F10' },
|
|
90
|
+
{ label: 'SHIFT_F11'; value: 'SHIFT_F11' },
|
|
91
|
+
{ label: 'SHIFT_F12'; value: 'SHIFT_F12' },
|
|
92
|
+
{ label: 'CTRL_F1'; value: 'CTRL_F1' },
|
|
93
|
+
{ label: 'CTRL_F2'; value: 'CTRL_F2' },
|
|
94
|
+
{ label: 'CTRL_F3'; value: 'CTRL_F3' },
|
|
95
|
+
{ label: 'CTRL_F4'; value: 'CTRL_F4' },
|
|
96
|
+
{ label: 'CTRL_F5'; value: 'CTRL_F5' },
|
|
97
|
+
{ label: 'CTRL_F6'; value: 'CTRL_F6' },
|
|
98
|
+
{ label: 'CTRL_F7'; value: 'CTRL_F7' },
|
|
99
|
+
{ label: 'CTRL_F8'; value: 'CTRL_F8' },
|
|
100
|
+
{ label: 'CTRL_F9'; value: 'CTRL_F9' },
|
|
101
|
+
{ label: 'CTRL_F10'; value: 'CTRL_F10' },
|
|
102
|
+
{ label: 'CTRL_F11'; value: 'CTRL_F11' },
|
|
103
|
+
{ label: 'CTRL_F12'; value: 'CTRL_F12' },
|
|
104
|
+
{ label: 'CTRL_SHIFT_F1'; value: 'CTRL_SHIFT_F1' },
|
|
105
|
+
{ label: 'CTRL_SHIFT_F2'; value: 'CTRL_SHIFT_F2' },
|
|
106
|
+
{ label: 'CTRL_SHIFT_F3'; value: 'CTRL_SHIFT_F3' },
|
|
107
|
+
{ label: 'CTRL_SHIFT_F4'; value: 'CTRL_SHIFT_F4' },
|
|
108
|
+
{ label: 'CTRL_SHIFT_F5'; value: 'CTRL_SHIFT_F5' },
|
|
109
|
+
{ label: 'CTRL_SHIFT_F6'; value: 'CTRL_SHIFT_F6' },
|
|
110
|
+
{ label: 'CTRL_SHIFT_F7'; value: 'CTRL_SHIFT_F7' },
|
|
111
|
+
{ label: 'CTRL_SHIFT_F8'; value: 'CTRL_SHIFT_F8' },
|
|
112
|
+
{ label: 'CTRL_SHIFT_F9'; value: 'CTRL_SHIFT_F9' },
|
|
113
|
+
{ label: 'CTRL_SHIFT_F10'; value: 'CTRL_SHIFT_F10' },
|
|
114
|
+
{ label: 'CTRL_SHIFT_F11'; value: 'CTRL_SHIFT_F11' },
|
|
115
|
+
{ label: 'CTRL_SHIFT_F12'; value: 'CTRL_SHIFT_F12' },
|
|
116
|
+
{ label: 'NUL'; value: 'NUL' },
|
|
117
|
+
{ label: 'ALT_SPACE'; value: 'ALT_SPACE' },
|
|
118
|
+
{ label: 'CTRL_ALT_SPACE'; value: 'CTRL_ALT_SPACE' },
|
|
119
|
+
{ label: 'CURSOR_LOCATION'; value: 'CURSOR_LOCATION' },
|
|
120
|
+
{ label: 'SCREEN_SIZE'; value: 'SCREEN_SIZE' },
|
|
121
|
+
{ label: 'COLOR_REGISTER'; value: 'COLOR_REGISTER' },
|
|
122
|
+
{ label: 'FOCUS_IN'; value: 'FOCUS_IN' },
|
|
123
|
+
{ label: 'FOCUS_OUT'; value: 'FOCUS_OUT' },
|
|
124
|
+
{ label: 'CLIPBOARD'; value: 'CLIPBOARD' },
|
|
125
|
+
{ label: 'MOUSE'; value: 'MOUSE' },
|
|
126
|
+
{ label: 'CTRL_C'; value: 'CTRL_C' },
|
|
127
|
+
{ label: 'CTRL_A'; value: 'CTRL_A' },
|
|
128
|
+
{ label: 'A'; value: 'A' },
|
|
129
|
+
{ label: 'a'; value: 'a' },
|
|
130
|
+
]
|
|
131
|
+
|
|
132
|
+
export type Key = string
|
|
133
|
+
|
|
134
|
+
export default [] as unknown as KeySelectChoices
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { WidgetFrameAttribute, BaseWidget } from './widgets.types.js'
|
|
2
|
+
|
|
3
|
+
// ** Layout Widget ** //
|
|
4
|
+
|
|
5
|
+
export interface LayoutWidgetOptions {
|
|
6
|
+
rows: LayoutRow[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface LayoutRow {
|
|
10
|
+
id?: string
|
|
11
|
+
columns: LayoutColumn[]
|
|
12
|
+
height?: WidgetFrameAttribute
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface LayoutColumn {
|
|
16
|
+
id: string
|
|
17
|
+
width?: WidgetFrameAttribute
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface LayoutWidget extends BaseWidget {
|
|
21
|
+
readonly type: 'layout'
|
|
22
|
+
getRows(): any[]
|
|
23
|
+
addRow(row: LayoutRow): void
|
|
24
|
+
addColumn(rowIdx: number, colunm: LayoutColumn): void
|
|
25
|
+
removeRow(rowIdx: number): void
|
|
26
|
+
removeColumn(rowIdx: number, columnIdx: number): void
|
|
27
|
+
setRowHeight(rowIdx: number, height: WidgetFrameAttribute): void
|
|
28
|
+
setColumnWidth(options: {
|
|
29
|
+
rowIdx: number
|
|
30
|
+
columnIdx: number
|
|
31
|
+
width: WidgetFrameAttribute
|
|
32
|
+
}): void
|
|
33
|
+
updateLayout(): void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface LayoutCellWidgetOptions {}
|
|
37
|
+
|
|
38
|
+
export interface LayoutCellWidget extends BaseWidget {
|
|
39
|
+
readonly type: 'layoutCell'
|
|
40
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseWidget } from './widgets.types.js'
|
|
2
|
+
|
|
3
|
+
export const menuBarEventContract = {
|
|
4
|
+
eventSignatures: {
|
|
5
|
+
select: {},
|
|
6
|
+
},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type MenuBarEventContract = typeof menuBarEventContract
|
|
10
|
+
|
|
11
|
+
export interface MenuBarWidgetOptions {
|
|
12
|
+
items: MenuBarWidgetItem[]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MenuBarWidgetItem {
|
|
16
|
+
label: string
|
|
17
|
+
value: string
|
|
18
|
+
items?: MenuBarWidgetItem[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface MenuBarWidget extends BaseWidget<MenuBarEventContract> {
|
|
22
|
+
setTextForItem(value: string, text: string): void
|
|
23
|
+
readonly type: 'menuBar'
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseWidget } from './widgets.types.js'
|
|
2
|
+
|
|
3
|
+
export const popupEventContract = {
|
|
4
|
+
eventSignatures: {
|
|
5
|
+
close: {},
|
|
6
|
+
},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type PopupEventContract = typeof popupEventContract
|
|
10
|
+
|
|
11
|
+
export interface PopupWidgetOptions {
|
|
12
|
+
title?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface PopupWidget extends BaseWidget<PopupEventContract> {
|
|
16
|
+
readonly type: 'popup'
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseWidget } from './widgets.types.js'
|
|
2
|
+
|
|
3
|
+
export interface ProgressBarWidgetOptions {
|
|
4
|
+
label?: string
|
|
5
|
+
progress: number
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ProgressBarWidget extends BaseWidget {
|
|
9
|
+
readonly type: 'progressBar'
|
|
10
|
+
|
|
11
|
+
setLabel(label?: string): void
|
|
12
|
+
setProgress(progress: number): void
|
|
13
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { isObject } from 'lodash-es'
|
|
2
|
+
import { BaseWidget, WidgetFrame } from './widgets.types.js'
|
|
3
|
+
import widgetUtil from './widget.utilities.js'
|
|
4
|
+
|
|
5
|
+
const termKitUtil = {
|
|
6
|
+
buildFrame(frame: Partial<WidgetFrame>, parent?: BaseWidget | null) {
|
|
7
|
+
const calculated = widgetUtil.buildFrame(frame, parent)
|
|
8
|
+
return {
|
|
9
|
+
x: calculated.left,
|
|
10
|
+
y: calculated.top,
|
|
11
|
+
width: calculated.width,
|
|
12
|
+
height: calculated.height,
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
mapWidgetOptionsToTermKitOptions(options: Record<string, any>) {
|
|
17
|
+
const mapped: Record<string, any> = {}
|
|
18
|
+
const keys = Object.keys(options)
|
|
19
|
+
const ignores = [
|
|
20
|
+
'shouldLockHeightWithParent',
|
|
21
|
+
'shouldLockWidthWithParent',
|
|
22
|
+
'shouldLockBottomWithParent',
|
|
23
|
+
'term',
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
if (options.backgroundColor) {
|
|
27
|
+
mapped.attr = {
|
|
28
|
+
...mapped.attr,
|
|
29
|
+
bgColor: options.backgroundColor,
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (options.foregroundColor) {
|
|
34
|
+
mapped.attr = {
|
|
35
|
+
...mapped.attr,
|
|
36
|
+
color: options.foregroundColor,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (const key of keys) {
|
|
41
|
+
const item = options[key]
|
|
42
|
+
if (Array.isArray(item)) {
|
|
43
|
+
mapped[key] = []
|
|
44
|
+
for (const i of item) {
|
|
45
|
+
mapped[key].push(this.mapWidgetOptionsToTermKitOptions(i))
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
switch (key) {
|
|
49
|
+
case 'left':
|
|
50
|
+
mapped.x = item
|
|
51
|
+
break
|
|
52
|
+
case 'top':
|
|
53
|
+
mapped.y = item
|
|
54
|
+
break
|
|
55
|
+
case 'width':
|
|
56
|
+
if (typeof item === 'string') {
|
|
57
|
+
mapped.widthPercent = parseInt(item)
|
|
58
|
+
} else {
|
|
59
|
+
mapped.width = item
|
|
60
|
+
}
|
|
61
|
+
break
|
|
62
|
+
case 'height':
|
|
63
|
+
if (typeof item === 'string') {
|
|
64
|
+
mapped.heightPercent = parseInt(item)
|
|
65
|
+
} else {
|
|
66
|
+
mapped.height = item
|
|
67
|
+
}
|
|
68
|
+
break
|
|
69
|
+
case 'parent':
|
|
70
|
+
mapped.parent = item.getTermKitElement()
|
|
71
|
+
break
|
|
72
|
+
default:
|
|
73
|
+
if (ignores.indexOf(key) > -1) {
|
|
74
|
+
break
|
|
75
|
+
}
|
|
76
|
+
if (typeof item !== 'function' && isObject(item)) {
|
|
77
|
+
mapped[key] =
|
|
78
|
+
this.mapWidgetOptionsToTermKitOptions(item)
|
|
79
|
+
} else {
|
|
80
|
+
mapped[key] = item
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return mapped
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
mapTermKitOptionsToWidgetOptions(options: Record<string, any>) {
|
|
89
|
+
const mapped: Record<string, any> = {}
|
|
90
|
+
const keys = Object.keys(options)
|
|
91
|
+
|
|
92
|
+
for (const key of keys) {
|
|
93
|
+
const item = options[key]
|
|
94
|
+
if (Array.isArray(item)) {
|
|
95
|
+
mapped[key] = []
|
|
96
|
+
for (const i of item) {
|
|
97
|
+
mapped[key].push(this.mapTermKitOptionsToWidgetOptions(i))
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
switch (key) {
|
|
101
|
+
case 'left':
|
|
102
|
+
mapped.x = item
|
|
103
|
+
break
|
|
104
|
+
case 'top':
|
|
105
|
+
mapped.y = item
|
|
106
|
+
break
|
|
107
|
+
case 'widthPercent':
|
|
108
|
+
mapped.width = `${item}%`
|
|
109
|
+
break
|
|
110
|
+
case 'heightPercent':
|
|
111
|
+
mapped.height = `${item}%`
|
|
112
|
+
break
|
|
113
|
+
case 'parent':
|
|
114
|
+
mapped.parent = item.getTermKitElement()
|
|
115
|
+
break
|
|
116
|
+
default:
|
|
117
|
+
if (typeof item !== 'function' && isObject(item)) {
|
|
118
|
+
mapped[key] =
|
|
119
|
+
this.mapTermKitOptionsToWidgetOptions(item)
|
|
120
|
+
} else {
|
|
121
|
+
mapped[key] = item
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return mapped
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default termKitUtil
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare module 'terminal-kit' {
|
|
2
|
+
export interface Terminal {
|
|
3
|
+
(text?: string, ...args: any[]): Terminal
|
|
4
|
+
hideCursor(hide?: boolean): void
|
|
5
|
+
windowTitle(title: string): void
|
|
6
|
+
styleReset(): void
|
|
7
|
+
grabInput(state: boolean, extra?: boolean): Promise<void>
|
|
8
|
+
clear(): void
|
|
9
|
+
on(event: string, listener: (...args: any[]) => void): this
|
|
10
|
+
removeAllListeners(event?: string): this
|
|
11
|
+
createDocument(options?: any): any
|
|
12
|
+
[key: string]: any
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const terminal: Terminal
|
|
16
|
+
|
|
17
|
+
export { terminal }
|
|
18
|
+
export default { terminal } & Record<string, any>
|
|
19
|
+
|
|
20
|
+
export class Palette {}
|
|
21
|
+
export class Button {}
|
|
22
|
+
export class DropDownMenu {}
|
|
23
|
+
export class InlineInput {}
|
|
24
|
+
export class Layout {}
|
|
25
|
+
export class Bar {}
|
|
26
|
+
export class TextBox {}
|
|
27
|
+
export class Window {}
|
|
28
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type TestResultStatus = 'running' | 'passed' | 'failed'
|
|
2
|
+
export type TestRunnerStatus = 'running' | 'stopped' | 'ready'
|
|
3
|
+
|
|
4
|
+
export interface TestFileTest {
|
|
5
|
+
name: string
|
|
6
|
+
status:
|
|
7
|
+
| 'passed'
|
|
8
|
+
| 'failed'
|
|
9
|
+
| 'skipped'
|
|
10
|
+
| 'pending'
|
|
11
|
+
| 'todo'
|
|
12
|
+
| 'disabled'
|
|
13
|
+
| 'focused'
|
|
14
|
+
errorMessages?: string[]
|
|
15
|
+
duration: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SpruceTestFile {
|
|
19
|
+
path: string
|
|
20
|
+
status: TestResultStatus
|
|
21
|
+
tests?: TestFileTest[]
|
|
22
|
+
errorMessage?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface TestResults {
|
|
26
|
+
totalTests?: number
|
|
27
|
+
totalPassed?: number
|
|
28
|
+
totalFailed?: number
|
|
29
|
+
totalSkipped?: number
|
|
30
|
+
totalTodo?: number
|
|
31
|
+
totalTestFiles: number
|
|
32
|
+
totalTestFilesComplete?: number
|
|
33
|
+
testFiles?: SpruceTestFile[]
|
|
34
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import chokidar from 'chokidar'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import CommandServiceImpl from './CommandService.js'
|
|
4
|
+
import TestReporter from './TestReporter.js'
|
|
5
|
+
import TestRunner from './TestRunner.js'
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2)
|
|
8
|
+
const get = (flag: string) => {
|
|
9
|
+
const i = args.indexOf(flag)
|
|
10
|
+
return i !== -1 ? args[i + 1] : undefined
|
|
11
|
+
}
|
|
12
|
+
const has = (flag: string) => args.includes(flag)
|
|
13
|
+
|
|
14
|
+
const pattern = get('--pattern') ?? null
|
|
15
|
+
const watchMode = (get('--watchMode') ?? 'off') as 'off' | 'standard' | 'smart'
|
|
16
|
+
const inspectPort = parseInt(get('--inspect') ?? '0', 10) || null
|
|
17
|
+
const cwd = process.cwd()
|
|
18
|
+
|
|
19
|
+
let currentPattern = pattern
|
|
20
|
+
let isDebugging = inspectPort !== null
|
|
21
|
+
let currentWatchMode = watchMode
|
|
22
|
+
let runner: TestRunner | null = null
|
|
23
|
+
let running = false
|
|
24
|
+
|
|
25
|
+
const reporter = new TestReporter({
|
|
26
|
+
cwd,
|
|
27
|
+
filterPattern: pattern ?? undefined,
|
|
28
|
+
watchMode,
|
|
29
|
+
isDebugging,
|
|
30
|
+
status: has('--shouldHoldAtStart') ? 'stopped' : 'ready',
|
|
31
|
+
handleStartStop: () => {
|
|
32
|
+
if (running) {
|
|
33
|
+
runner?.kill()
|
|
34
|
+
} else {
|
|
35
|
+
runTests()
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
handleRestart: () => {
|
|
39
|
+
runner?.kill()
|
|
40
|
+
setTimeout(runTests, 100)
|
|
41
|
+
},
|
|
42
|
+
handleQuit: () => {
|
|
43
|
+
runner?.kill()
|
|
44
|
+
process.exit(0)
|
|
45
|
+
},
|
|
46
|
+
handleFilterPatternChange: (p?: string) => {
|
|
47
|
+
currentPattern = p ?? null
|
|
48
|
+
if (running) {
|
|
49
|
+
runner?.kill()
|
|
50
|
+
setTimeout(runTests, 100)
|
|
51
|
+
} else {
|
|
52
|
+
runTests()
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
handleToggleDebug: () => {
|
|
56
|
+
isDebugging = !isDebugging
|
|
57
|
+
reporter.setIsDebugging(isDebugging)
|
|
58
|
+
},
|
|
59
|
+
handletoggleStandardWatch: () => {
|
|
60
|
+
currentWatchMode = currentWatchMode === 'standard' ? 'off' : 'standard'
|
|
61
|
+
reporter.setWatchMode(currentWatchMode)
|
|
62
|
+
},
|
|
63
|
+
handleToggleSmartWatch: () => {
|
|
64
|
+
currentWatchMode = currentWatchMode === 'smart' ? 'off' : 'smart'
|
|
65
|
+
reporter.setWatchMode(currentWatchMode)
|
|
66
|
+
},
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
async function runTests() {
|
|
70
|
+
if (running) {
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
running = true
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
reporter.setStatus('running')
|
|
77
|
+
} catch (err) {
|
|
78
|
+
running = false
|
|
79
|
+
reporter.appendError(`setStatus error: ${err}`)
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const commandSvc = new CommandServiceImpl(cwd)
|
|
84
|
+
runner = new TestRunner({ cwd, commandService: commandSvc })
|
|
85
|
+
|
|
86
|
+
runner.on('did-update', ({ results }) => {
|
|
87
|
+
try {
|
|
88
|
+
reporter.updateResults(results)
|
|
89
|
+
} catch (err) {
|
|
90
|
+
reporter.appendError(`updateResults error: ${err}`)
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
runner.on('did-error', ({ message }) => {
|
|
95
|
+
reporter.appendError(message)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
try {
|
|
99
|
+
await runner.run({
|
|
100
|
+
pattern: currentPattern,
|
|
101
|
+
debugPort: isDebugging ? (inspectPort ?? 5200) : null,
|
|
102
|
+
})
|
|
103
|
+
} catch (err) {
|
|
104
|
+
reporter.appendError(`Test run failed: ${err}`)
|
|
105
|
+
} finally {
|
|
106
|
+
running = false
|
|
107
|
+
reporter.setStatus('stopped')
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let debounceTimer: ReturnType<typeof setTimeout> | null = null
|
|
112
|
+
|
|
113
|
+
function scheduleRerun(changedFile?: string) {
|
|
114
|
+
if (debounceTimer) {
|
|
115
|
+
clearTimeout(debounceTimer)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (currentWatchMode === 'smart' && changedFile) {
|
|
119
|
+
const rel = path.relative(cwd, changedFile)
|
|
120
|
+
const base = path.basename(rel, path.extname(rel))
|
|
121
|
+
reporter.startCountdownTimer(2)
|
|
122
|
+
debounceTimer = setTimeout(() => {
|
|
123
|
+
currentPattern = base
|
|
124
|
+
reporter.setFilterPattern(base)
|
|
125
|
+
runner?.kill()
|
|
126
|
+
setTimeout(runTests, 100)
|
|
127
|
+
}, 2000)
|
|
128
|
+
} else if (currentWatchMode === 'standard') {
|
|
129
|
+
reporter.startCountdownTimer(2)
|
|
130
|
+
debounceTimer = setTimeout(() => {
|
|
131
|
+
runner?.kill()
|
|
132
|
+
setTimeout(runTests, 100)
|
|
133
|
+
}, 2000)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function main() {
|
|
138
|
+
await reporter.start()
|
|
139
|
+
|
|
140
|
+
await new Promise((r) => setTimeout(r, 50))
|
|
141
|
+
|
|
142
|
+
if (!has('--shouldHoldAtStart')) {
|
|
143
|
+
runTests()
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (currentWatchMode !== 'off') {
|
|
147
|
+
const watcher = chokidar.watch(path.join(cwd, 'src'), {
|
|
148
|
+
ignored: /node_modules/,
|
|
149
|
+
ignoreInitial: true,
|
|
150
|
+
})
|
|
151
|
+
watcher.on('change', scheduleRerun)
|
|
152
|
+
watcher.on('add', scheduleRerun)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
main().catch((err) => {
|
|
157
|
+
console.error(err)
|
|
158
|
+
process.exit(1)
|
|
159
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseWidget } from './widgets.types.js'
|
|
2
|
+
|
|
3
|
+
// ** Text Widget ** //
|
|
4
|
+
|
|
5
|
+
export const textEventContract = {
|
|
6
|
+
eventSignatures: {
|
|
7
|
+
click: {},
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type TextEventContract = typeof textEventContract
|
|
12
|
+
|
|
13
|
+
export interface TextWidgetOptions {
|
|
14
|
+
isScrollEnabled?: boolean
|
|
15
|
+
shouldAutoScrollWhenAppendingContent?: boolean
|
|
16
|
+
wordWrap?: boolean
|
|
17
|
+
text?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface TextWidget extends BaseWidget<TextEventContract> {
|
|
21
|
+
readonly type: 'text'
|
|
22
|
+
getText(): string
|
|
23
|
+
setText(content: string): void
|
|
24
|
+
getScrollX(): number
|
|
25
|
+
getScrollY(): number
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseWidget,
|
|
3
|
+
WidgetFrame,
|
|
4
|
+
WidgetFrameCalculated,
|
|
5
|
+
} from './widgets.types.js'
|
|
6
|
+
|
|
7
|
+
const widgetUtil = {
|
|
8
|
+
buildFrame(frame?: Partial<WidgetFrame>, parent?: BaseWidget | null) {
|
|
9
|
+
let { left, top, height, width } = frame || {}
|
|
10
|
+
|
|
11
|
+
if (typeof width === 'string') {
|
|
12
|
+
if (!parent) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
'I can only calculate percentage sizes if a parent is passed.'
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
width = parent.getFrame().width * (parseInt(width, 10) / 100)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (typeof height === 'string') {
|
|
22
|
+
if (!parent) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
'I can only calculate percentage sizes if a parent is passed.'
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
height = parent.getFrame().height * (parseInt(height, 10) / 100)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { left, top, height, width } as Partial<WidgetFrameCalculated>
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default widgetUtil
|