@neurodevs/node-tdd 0.2.5 → 1.0.0
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 +30 -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,85 @@
|
|
|
1
|
+
import test, { suite } from '../../../utilities/decorators.js'
|
|
2
|
+
import assert from '../../../utilities/assert.js'
|
|
3
|
+
import AbstractTestOnInstanceWithHooksTest from '../../support/AbstractTestOnInstanceWithHooks.js'
|
|
4
|
+
import TestDecoratorResolver from '../../../utilities/TestDecoratorResolver.js'
|
|
5
|
+
|
|
6
|
+
@suite()
|
|
7
|
+
export default class TestOnInstanceExtendsTestWithHooks extends AbstractTestOnInstanceWithHooksTest {
|
|
8
|
+
@test()
|
|
9
|
+
protected async doesCallBeforeAll() {
|
|
10
|
+
assert.isEqual(
|
|
11
|
+
TestOnInstanceExtendsTestWithHooks.beforeAllCount,
|
|
12
|
+
1,
|
|
13
|
+
'Did not call beforeAll'
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@test()
|
|
18
|
+
protected async basicPassingTest() {
|
|
19
|
+
assert.isTrue(true)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
TestDecoratorResolver.onWillCallBeforeAll(() => {
|
|
24
|
+
TestOnInstanceExtendsTestWithHooks.beforeBeforeAllCount++
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
TestDecoratorResolver.onWillCallBeforeAll(() => {
|
|
28
|
+
TestOnInstanceExtendsTestWithHooks.beforeBeforeAllCount2++
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
TestDecoratorResolver.onDidCallBeforeAll(() => {
|
|
32
|
+
TestOnInstanceExtendsTestWithHooks.afterBeforeAllCount++
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
TestDecoratorResolver.onDidCallBeforeAll(() => {
|
|
36
|
+
TestOnInstanceExtendsTestWithHooks.afterBeforeAllCount2++
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
TestDecoratorResolver.onWillCallBeforeEach(() => {
|
|
40
|
+
TestDecoratorResolver.getActiveTest().beforeBeforeEach++
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
TestDecoratorResolver.onWillCallBeforeEach(() => {
|
|
44
|
+
TestDecoratorResolver.getActiveTest().beforeBeforeEach2++
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
TestDecoratorResolver.onDidCallBeforeEach(() => {
|
|
48
|
+
TestDecoratorResolver.getActiveTest().afterBeforeEach++
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
TestDecoratorResolver.onDidCallBeforeEach(() => {
|
|
52
|
+
TestDecoratorResolver.getActiveTest().afterBeforeEach2++
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
TestDecoratorResolver.onWillCallAfterEach(() => {
|
|
56
|
+
TestDecoratorResolver.getActiveTest().beforeAfterEach++
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
TestDecoratorResolver.onWillCallAfterEach(() => {
|
|
60
|
+
TestDecoratorResolver.getActiveTest().beforeAfterEach2++
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
TestDecoratorResolver.onDidCallAfterEach(() => {
|
|
64
|
+
TestDecoratorResolver.getActiveTest().afterAfterEach++
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
TestDecoratorResolver.onDidCallAfterEach(() => {
|
|
68
|
+
TestDecoratorResolver.getActiveTest().afterAfterEach2++
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
TestDecoratorResolver.onWillCallAfterAll(() => {
|
|
72
|
+
TestOnInstanceExtendsTestWithHooks.beforeAfterAll++
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
TestDecoratorResolver.onWillCallAfterAll(() => {
|
|
76
|
+
TestOnInstanceExtendsTestWithHooks.beforeAfterAll2++
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
TestDecoratorResolver.onDidCallAfterAll(() => {
|
|
80
|
+
TestOnInstanceExtendsTestWithHooks.afterAfterAll++
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
TestDecoratorResolver.onDidCallAfterAll(() => {
|
|
84
|
+
TestOnInstanceExtendsTestWithHooks.afterAfterAll2++
|
|
85
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import test, { suite } from '../../../utilities/decorators.js'
|
|
2
|
+
import assert from '../../../utilities/assert.js'
|
|
3
|
+
import AbstractForInstanceTest from '../../support/AbstractForInstanceTest.js'
|
|
4
|
+
|
|
5
|
+
@suite()
|
|
6
|
+
export default class TestOnInstanceWithParentBeforeAllTest extends AbstractForInstanceTest {
|
|
7
|
+
@test()
|
|
8
|
+
protected async canCreateTestOnInstanceWithParentBeforeAll() {
|
|
9
|
+
assert.isTrue(
|
|
10
|
+
TestOnInstanceWithParentBeforeAllTest.wasBeforeAllCalled,
|
|
11
|
+
'beforeAll was not called on parent class'
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import assert from '../../../utilities/assert.js'
|
|
2
|
+
import test, { suite } from '../../../utilities/decorators.js'
|
|
3
|
+
import AbstractBeforeAllLevelOneTest from '../../support/AbstractLevelOneTest.js'
|
|
4
|
+
|
|
5
|
+
@suite()
|
|
6
|
+
export default class TestOnInstanceWithTwoLevelsOfInheritenceTest extends AbstractBeforeAllLevelOneTest {
|
|
7
|
+
@test()
|
|
8
|
+
protected async canCreateTestOnInstanceWithTwoLevelsOfInheritence() {
|
|
9
|
+
assert.isTrue(
|
|
10
|
+
TestOnInstanceWithTwoLevelsOfInheritenceTest.wasBeforeAllLevelTwoCalled,
|
|
11
|
+
'beforeAll was not called on level two class'
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
assert.isTrue(this.wasBeforeEachLevelTwoCalled)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import AbstractModuleTest from '../../../impl/AbstractModuleTest.js'
|
|
2
|
+
import assert from '../../../utilities/assert.js'
|
|
3
|
+
import test, { suite } from '../../../utilities/decorators.js'
|
|
4
|
+
import TestDecoratorResolver from '../../../utilities/TestDecoratorResolver.js'
|
|
5
|
+
|
|
6
|
+
@suite()
|
|
7
|
+
export default class TestDecoratorResolverTest extends AbstractModuleTest {
|
|
8
|
+
protected static counter = 4
|
|
9
|
+
|
|
10
|
+
protected static async beforeAll(): Promise<void> {
|
|
11
|
+
await super.beforeAll()
|
|
12
|
+
|
|
13
|
+
assert.isEqual(
|
|
14
|
+
this.counter,
|
|
15
|
+
4,
|
|
16
|
+
'beforeAll did not access correct static property'
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
protected static async afterAll(): Promise<void> {
|
|
21
|
+
await super.afterAll()
|
|
22
|
+
|
|
23
|
+
assert.isEqual(
|
|
24
|
+
this.counter,
|
|
25
|
+
10,
|
|
26
|
+
'afterAll did not access correct static property'
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@test()
|
|
31
|
+
protected async canCreateTestDecoratorResolver() {
|
|
32
|
+
TestDecoratorResolverTest.counter = 10
|
|
33
|
+
|
|
34
|
+
const activeTest = TestDecoratorResolver.getActiveTest()
|
|
35
|
+
assert.isInstanceOf(
|
|
36
|
+
activeTest,
|
|
37
|
+
TestDecoratorResolverTest,
|
|
38
|
+
'getActive test is not this on instance test'
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
const activeTest2 = TestDecoratorResolver.getActiveTest()
|
|
42
|
+
assert.isEqual(
|
|
43
|
+
activeTest,
|
|
44
|
+
activeTest2,
|
|
45
|
+
'getActiveTest called a second time did not return same instance'
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import AbstractModuleTest from '../../../impl/AbstractModuleTest.js'
|
|
2
|
+
import assert from '../../../utilities/assert.js'
|
|
3
|
+
import test from '../../../utilities/decorators.js'
|
|
4
|
+
import TestDecoratorResolver from '../../../utilities/TestDecoratorResolver.js'
|
|
5
|
+
|
|
6
|
+
export default class TestDecoratorResolverOnStaticTest extends AbstractModuleTest {
|
|
7
|
+
@test()
|
|
8
|
+
protected static async canCreateTestDecoratorResolverOnStatic() {
|
|
9
|
+
const active = TestDecoratorResolver.getActiveTest()
|
|
10
|
+
assert.isEqual(active, TestDecoratorResolverOnStaticTest)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { END_DIVIDER, START_DIVIDER } from '@sprucelabs/jest-json-reporter'
|
|
2
|
+
import AbstractModuleTest from '../../../impl/AbstractModuleTest.js'
|
|
3
|
+
import assert from '../../../utilities/assert.js'
|
|
4
|
+
import test from '../../../utilities/decorators.js'
|
|
5
|
+
import JestJsonParser from '../../../workspace/JestJsonParser.js'
|
|
6
|
+
import onTestFileResult from '../../support/onTestFileResult.js'
|
|
7
|
+
|
|
8
|
+
type JsonResultKeys = 'onRunStart' | 'onTestFileStart' | 'onTestFileResult'
|
|
9
|
+
|
|
10
|
+
export default class JestJsonParserTest extends AbstractModuleTest {
|
|
11
|
+
private static parser: JestJsonParser
|
|
12
|
+
|
|
13
|
+
protected static async beforeEach() {
|
|
14
|
+
await super.beforeEach()
|
|
15
|
+
this.parser = new JestJsonParser()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@test()
|
|
19
|
+
protected static canCreateJjp() {
|
|
20
|
+
assert.isTruthy(this.parser.write)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@test()
|
|
24
|
+
protected static generatesEmptyResults() {
|
|
25
|
+
const startRun = this.generateTestResults('onRunStart')
|
|
26
|
+
|
|
27
|
+
this.parser.write(startRun)
|
|
28
|
+
|
|
29
|
+
const testResults = this.parser.getResults()
|
|
30
|
+
|
|
31
|
+
assert.isEqualDeep(testResults, {
|
|
32
|
+
totalTestFiles: 43,
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@test()
|
|
37
|
+
protected static canHandleSelfContainedWrite() {
|
|
38
|
+
const data = this.generateTestResults(
|
|
39
|
+
'onTestFileStart',
|
|
40
|
+
'behavioral/errors/CreatingANewErrorBuilder.test.js'
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
this.parser.write(this.generateTestResults('onRunStart'))
|
|
44
|
+
this.parser.write(data)
|
|
45
|
+
|
|
46
|
+
const testResults = this.parser.getResults()
|
|
47
|
+
assert.isTruthy(testResults.testFiles)
|
|
48
|
+
|
|
49
|
+
assert.isLength(testResults.testFiles, 1)
|
|
50
|
+
assert.isEqualDeep(testResults.testFiles[0], {
|
|
51
|
+
path: `behavioral/errors/CreatingANewErrorBuilder.test.ts`,
|
|
52
|
+
status: 'running',
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@test()
|
|
57
|
+
protected static canHandleSelfContainedWriteWithTwoTests() {
|
|
58
|
+
const data =
|
|
59
|
+
this.generateTestResults(
|
|
60
|
+
'onTestFileStart',
|
|
61
|
+
'behavioral/errors/CreatingANewErrorBuilder.test.js'
|
|
62
|
+
) +
|
|
63
|
+
this.generateTestResults(
|
|
64
|
+
'onTestFileStart',
|
|
65
|
+
'behavioral/tests/RunningTests.test.js'
|
|
66
|
+
)
|
|
67
|
+
this.parser.write(data)
|
|
68
|
+
|
|
69
|
+
const testResults = this.parser.getResults()
|
|
70
|
+
|
|
71
|
+
assert.isTruthy(testResults.testFiles)
|
|
72
|
+
assert.isLength(testResults.testFiles, 2)
|
|
73
|
+
assert.isEqualDeep(testResults.testFiles, [
|
|
74
|
+
{
|
|
75
|
+
path: `behavioral/errors/CreatingANewErrorBuilder.test.ts`,
|
|
76
|
+
status: 'running',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
path: `behavioral/tests/RunningTests.test.ts`,
|
|
80
|
+
status: 'running',
|
|
81
|
+
},
|
|
82
|
+
])
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@test()
|
|
86
|
+
protected static multipleSelfContainedWritesWorks() {
|
|
87
|
+
this.parser.write(
|
|
88
|
+
this.generateTestResults(
|
|
89
|
+
'onTestFileStart',
|
|
90
|
+
`behavioral/errors/CreatingANewErrorBuilder.test.js`
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
this.parser.write(
|
|
95
|
+
this.generateTestResults(
|
|
96
|
+
'onTestFileStart',
|
|
97
|
+
`behavioral/tests/RunningTests.test.js`
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
const testResults = this.parser.getResults()
|
|
101
|
+
|
|
102
|
+
assert.isTruthy(testResults.testFiles)
|
|
103
|
+
assert.isLength(testResults.testFiles, 2)
|
|
104
|
+
assert.isEqualDeep(testResults.testFiles, [
|
|
105
|
+
{
|
|
106
|
+
path: `behavioral/errors/CreatingANewErrorBuilder.test.ts`,
|
|
107
|
+
status: 'running',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
path: `behavioral/tests/RunningTests.test.ts`,
|
|
111
|
+
status: 'running',
|
|
112
|
+
},
|
|
113
|
+
])
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@test()
|
|
117
|
+
protected static partialWriteReturnsNothing() {
|
|
118
|
+
const data = this.generateTestResults(
|
|
119
|
+
'onTestFileStart',
|
|
120
|
+
'behavioral/errors/KeepingErrorsInSync.test.js'
|
|
121
|
+
).substr(0, 100)
|
|
122
|
+
|
|
123
|
+
this.parser.write(data)
|
|
124
|
+
|
|
125
|
+
const testResults = this.parser.getResults()
|
|
126
|
+
assert.isFalsy(testResults.testFiles)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@test()
|
|
130
|
+
protected static canPartialWriteAcrossTwoWrites() {
|
|
131
|
+
const data = this.generateTestResults(
|
|
132
|
+
'onTestFileStart',
|
|
133
|
+
'behavioral/errors/KeepingErrorsInSync.test.js'
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
const firstPart = data.substr(0, 100)
|
|
137
|
+
const secondPart = data.substr(100)
|
|
138
|
+
|
|
139
|
+
this.parser.write(firstPart)
|
|
140
|
+
this.parser.write(secondPart)
|
|
141
|
+
|
|
142
|
+
const testResults = this.parser.getResults()
|
|
143
|
+
|
|
144
|
+
assert.isTruthy(testResults.testFiles)
|
|
145
|
+
assert.isLength(testResults.testFiles, 1)
|
|
146
|
+
|
|
147
|
+
assert.isEqualDeep(testResults.testFiles[0], {
|
|
148
|
+
path: `behavioral/errors/KeepingErrorsInSync.test.ts`,
|
|
149
|
+
status: 'running',
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@test()
|
|
154
|
+
protected static canPartialWriteAndSelfContainedAcrossThreeWrites() {
|
|
155
|
+
const data = this.generateTestResults(
|
|
156
|
+
'onTestFileStart',
|
|
157
|
+
'behavioral/errors/KeepingErrorsInSync.test.js'
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
const firstPart = data.substr(0, 100)
|
|
161
|
+
const secondPart = data.substr(100)
|
|
162
|
+
|
|
163
|
+
this.parser.write(this.generateTestResults('onRunStart'))
|
|
164
|
+
this.parser.write(firstPart)
|
|
165
|
+
this.parser.write(secondPart)
|
|
166
|
+
this.parser.write(
|
|
167
|
+
this.generateTestResults(
|
|
168
|
+
'onTestFileStart',
|
|
169
|
+
'behavioral/tests/CreatingANewErrorBuilder.test.js'
|
|
170
|
+
)
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
const testResults = this.parser.getResults()
|
|
174
|
+
|
|
175
|
+
assert.isEqualDeep(testResults, {
|
|
176
|
+
totalTestFiles: 43,
|
|
177
|
+
testFiles: [
|
|
178
|
+
{
|
|
179
|
+
path: 'behavioral/errors/KeepingErrorsInSync.test.ts',
|
|
180
|
+
status: 'running',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
path: 'behavioral/tests/CreatingANewErrorBuilder.test.ts',
|
|
184
|
+
status: 'running',
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@test()
|
|
191
|
+
protected static canSelfContainedPlusPartial() {
|
|
192
|
+
const firstSelfContained = this.generateTestResults(
|
|
193
|
+
'onTestFileStart',
|
|
194
|
+
`behavioral/errors/KeepingErrorsInSync.test.js`
|
|
195
|
+
)
|
|
196
|
+
const data =
|
|
197
|
+
firstSelfContained +
|
|
198
|
+
this.generateTestResults(
|
|
199
|
+
'onTestFileStart',
|
|
200
|
+
'behavioral/tests/CreatingANewErrorBuilder.test.js'
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
const splitIdx = firstSelfContained.length + 500
|
|
204
|
+
const firstPart = data.substr(0, splitIdx)
|
|
205
|
+
const secondPart = data.substr(splitIdx)
|
|
206
|
+
|
|
207
|
+
this.parser.write(firstPart)
|
|
208
|
+
this.parser.write(secondPart)
|
|
209
|
+
|
|
210
|
+
const testResults = this.parser.getResults()
|
|
211
|
+
assert.isTruthy(testResults.testFiles)
|
|
212
|
+
assert.isLength(testResults.testFiles, 2)
|
|
213
|
+
|
|
214
|
+
assert.isEqualDeep(testResults.testFiles[0], {
|
|
215
|
+
path: `behavioral/errors/KeepingErrorsInSync.test.ts`,
|
|
216
|
+
status: 'running',
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
assert.isEqualDeep(testResults.testFiles[1], {
|
|
220
|
+
path: 'behavioral/tests/CreatingANewErrorBuilder.test.ts',
|
|
221
|
+
status: 'running',
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@test()
|
|
226
|
+
protected static canHandleGarbageAtFrontOfData() {
|
|
227
|
+
const data =
|
|
228
|
+
'yarn test run\nother garbage' +
|
|
229
|
+
this.generateTestResults(
|
|
230
|
+
'onTestFileStart',
|
|
231
|
+
'behavioral/errors/CreatingANewErrorBuilder.test.js'
|
|
232
|
+
)
|
|
233
|
+
this.parser.write(data)
|
|
234
|
+
|
|
235
|
+
const testResults = this.parser.getResults()
|
|
236
|
+
|
|
237
|
+
assert.isTruthy(testResults.testFiles)
|
|
238
|
+
assert.isLength(testResults.testFiles, 1)
|
|
239
|
+
assert.isEqualDeep(testResults.testFiles[0], {
|
|
240
|
+
path: `behavioral/errors/CreatingANewErrorBuilder.test.ts`,
|
|
241
|
+
status: 'running',
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@test()
|
|
246
|
+
protected static canHandlesSplitTestRestsWithGarbageInFrontAndDanglingEnd() {
|
|
247
|
+
this.parser.write(
|
|
248
|
+
'yarn run go team ***************************START_JSON_DIVIDER***************************'
|
|
249
|
+
)
|
|
250
|
+
this.parser.write(
|
|
251
|
+
'{"status":"onTestFileStart","test":{"context":{},"duration":40472,"path":"/Users/taylorromero/Development/SpruceLabs/spruce-cli-workspace/packages/spruce-cli/build/__tests__/behavioral/tests/RunningTests.test.js"}}'
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
this.parser.write(
|
|
255
|
+
`***************************END_JSON_DIVIDER***************************\n\t\t\t***************************START_JSON_DIVIDER***************************\n\t\t\t{"status":"onTestFileStart","test":{"context":{},"duration":48733,"path":"/Users/taylorromero/Development/SpruceLabs/spruce-cli-workspace/packages/spruce-cli/build/__tests__/behavioral/errors/CreatingANewErrorBuilder.test.js"}}\n\t\t\t***************************END_JSON_DIVIDER***************************\n\t\t\t***************************START_JSON_DIVIDER***************************\n\t\t\t{"status":"onTestFileStart","test":{"context":{},"duration":17443,"path":"/Users/taylorromero/Development/SpruceLabs/spruce-cli-workspace/packages/spruce-cli/build/__tests__/behavioral/watchers/WatchingForChanges.test.js"}}`
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
const testResults = this.parser.getResults()
|
|
259
|
+
|
|
260
|
+
assert.isTruthy(testResults.testFiles)
|
|
261
|
+
assert.isLength(testResults.testFiles, 2)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
@test()
|
|
265
|
+
protected static canUpdateAsTestsCompletes() {
|
|
266
|
+
const data = this.generateTestResults(
|
|
267
|
+
'onTestFileStart',
|
|
268
|
+
'behavioral/errors/CreatingANewErrorBuilder.test.js'
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
this.parser.write(data)
|
|
272
|
+
|
|
273
|
+
const completed = this.generateTestResults(
|
|
274
|
+
'onTestFileResult',
|
|
275
|
+
'behavioral/errors/CreatingANewErrorBuilder.test.js'
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
this.parser.write(completed)
|
|
279
|
+
|
|
280
|
+
const testResults = this.parser.getResults()
|
|
281
|
+
|
|
282
|
+
assert.isTruthy(testResults.testFiles)
|
|
283
|
+
assert.isLength(testResults.testFiles, 11)
|
|
284
|
+
|
|
285
|
+
assert.doesInclude(testResults, {
|
|
286
|
+
totalTestFiles: 39,
|
|
287
|
+
totalTestFilesComplete: 20,
|
|
288
|
+
totalFailed: 1,
|
|
289
|
+
totalPassed: 181,
|
|
290
|
+
totalTests: 183,
|
|
291
|
+
totalSkipped: 1,
|
|
292
|
+
totalTodo: 0,
|
|
293
|
+
})
|
|
294
|
+
|
|
295
|
+
assert.isEqualDeep(testResults.testFiles![0], {
|
|
296
|
+
path: 'behavioral/errors/CreatingANewErrorBuilder.test.ts',
|
|
297
|
+
status: 'running',
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
assert.isEqualDeep(testResults.testFiles![1], {
|
|
301
|
+
path: 'implementation/CasualNameUtility.test.ts',
|
|
302
|
+
status: 'passed',
|
|
303
|
+
tests: [
|
|
304
|
+
{
|
|
305
|
+
name: 'No name returns friend',
|
|
306
|
+
status: 'passed',
|
|
307
|
+
errorMessages: [],
|
|
308
|
+
duration: 2,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'Just last name to just last name',
|
|
312
|
+
status: 'passed',
|
|
313
|
+
errorMessages: [],
|
|
314
|
+
duration: 0,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: 'First name only to first name only',
|
|
318
|
+
status: 'passed',
|
|
319
|
+
errorMessages: [],
|
|
320
|
+
duration: 1,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: 'last and first name to First Last initial',
|
|
324
|
+
status: 'passed',
|
|
325
|
+
errorMessages: [],
|
|
326
|
+
duration: 0,
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
const failedFile = testResults.testFiles!.find(
|
|
332
|
+
(f) => f.path === 'behavioral/UpdatingARole.test.ts'
|
|
333
|
+
)
|
|
334
|
+
assert.isTruthy(failedFile)
|
|
335
|
+
assert.isEqual(failedFile!.status, 'failed')
|
|
336
|
+
assert.isTruthy(failedFile!.tests)
|
|
337
|
+
assert.isEqual(failedFile!.tests![0].status, 'failed')
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
private static generateTestResults(
|
|
341
|
+
jestStatus: JsonResultKeys,
|
|
342
|
+
testFile?: string
|
|
343
|
+
): string {
|
|
344
|
+
switch (jestStatus) {
|
|
345
|
+
case 'onRunStart':
|
|
346
|
+
return `${START_DIVIDER}{"status":"onRunStart","results":{"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":0,"numPassedTests":0,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":43,"numTotalTests":0,"openHandles":[],"snapshot":{"added":0,"didUpdate":false,"failure":false,"filesAdded":0,"filesRemoved":0,"filesRemovedList":[],"filesUnmatched":0,"filesUpdated":0,"matched":0,"total":0,"unchecked":0,"uncheckedKeysByFile":[],"unmatched":0,"updated":0},"startTime":1603459399575,"success":false,"testResults":[],"wasInterrupted":false}}${END_DIVIDER}`
|
|
347
|
+
case 'onTestFileStart':
|
|
348
|
+
return `${START_DIVIDER}{"status":"onTestFileStart","test":{"context":{},"duration":40472,"path":"/Users/taylorromero/Development/SpruceLabs/spruce-cli-workspace/packages/spruce-cli/build/__tests__/${testFile}"}}${END_DIVIDER}`
|
|
349
|
+
case 'onTestFileResult':
|
|
350
|
+
return `${START_DIVIDER}${JSON.stringify(
|
|
351
|
+
onTestFileResult(testFile ?? 'missing')
|
|
352
|
+
)}${END_DIVIDER}`
|
|
353
|
+
default:
|
|
354
|
+
throw new Error('Status not implemented')
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|