testeranto 0.49.10 → 0.62.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/.nvmrc +1 -0
- package/README.md +71 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +53 -61
- package/dist/common/Project.js +272 -606
- package/dist/common/SubPackages/puppeteer.js +19 -0
- package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
- package/dist/common/SubPackages/react/jsx/index.js +13 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
- package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +5 -14
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +26 -15
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
- package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
- package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +32 -0
- package/dist/common/Web.js +41 -112
- package/dist/common/electron.js +188 -44
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +35 -0
- package/dist/common/esbuildConfigs/report.js +48 -0
- package/dist/common/esbuildConfigs/tests.js +14 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/lib/abstractBase.js +193 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/browser.js +26 -0
- package/dist/common/lib/classBuilder.js +41 -0
- package/dist/common/lib/core.js +52 -0
- package/dist/common/lib/index.js +19 -0
- package/dist/common/nodeWriterElectron.js +55 -0
- package/dist/common/preload.js +22 -21
- package/dist/common/report.html.js +31 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/web.html.js +22 -0
- package/dist/module/Features.js +2 -3
- package/dist/module/Node.js +53 -61
- package/dist/module/Project.js +272 -583
- package/dist/module/SubPackages/puppeteer.js +14 -0
- package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
- package/dist/module/SubPackages/react/jsx/index.js +10 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +5 -5
- package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +4 -13
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +23 -15
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +30 -1
- package/dist/module/Web.js +41 -112
- package/dist/module/electron.js +189 -45
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +30 -0
- package/dist/module/esbuildConfigs/report.js +48 -0
- package/dist/module/esbuildConfigs/tests.js +12 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/lib/abstractBase.js +185 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/browser.js +22 -0
- package/dist/module/lib/classBuilder.js +37 -0
- package/dist/module/lib/core.js +49 -0
- package/dist/module/lib/index.js +15 -0
- package/dist/module/nodeWriterElectron.js +52 -0
- package/dist/module/preload.js +22 -21
- package/dist/module/report.html.js +29 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/Report.css +10326 -0
- package/dist/prebuild/Report.js +37456 -0
- package/dist/types/Features.d.ts +5 -5
- package/dist/types/Node.d.ts +4 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -27
- package/dist/types/SubPackages/puppeteer.d.ts +6 -0
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/{subPackages → SubPackages}/react-dom/component/node.d.ts +2 -4
- package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +116 -3
- package/dist/types/Web.d.ts +4 -11
- package/dist/types/esbuildConfigs/features.d.ts +4 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/report.d.ts +0 -0
- package/dist/types/esbuildConfigs/tests.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/lib/abstractBase.d.ts +102 -0
- package/dist/types/lib/basebuilder.d.ts +24 -0
- package/dist/types/lib/browser.d.ts +6 -0
- package/dist/types/lib/classBuilder.d.ts +6 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +57 -0
- package/dist/types/nodeWriterElectron.d.ts +2 -0
- package/dist/types/report.html.d.ts +2 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/web.html.d.ts +2 -0
- package/electronBuild.ts +32 -0
- package/index.html +30 -0
- package/package.json +120 -85
- package/src/Features.ts +2 -4
- package/src/Node.ts +114 -160
- package/src/NodeWriter.ts +1 -4
- package/src/Project.ts +610 -753
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +46 -0
- package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
- package/src/SubPackages/react/component/web.ts +53 -0
- package/src/SubPackages/react/jsx/index.ts +43 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +28 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
- package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +18 -54
- package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
- package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
- package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
- package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
- package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
- package/src/Types.ts +334 -3
- package/src/Web.ts +104 -230
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +237 -46
- package/src/esbuildConfigs/features.ts +18 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +59 -0
- package/src/esbuildConfigs/report.ts +51 -0
- package/src/esbuildConfigs/tests.ts +20 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +459 -0
- package/src/lib/basebuilder.ts +253 -0
- package/src/lib/browser.ts +34 -0
- package/src/lib/classBuilder.ts +137 -0
- package/src/lib/core.ts +182 -0
- package/src/lib/index.ts +116 -0
- package/src/nodeWriterElectron.ts +71 -0
- package/src/preload.ts +23 -21
- package/src/report.html.ts +29 -0
- package/src/web.html.ts +20 -0
- package/tests/Rectangle.test.ts +189 -0
- package/tsconfig.json +19 -6
- package/tsconfig.module.json +15 -4
- package/tsconfig.types.json +14 -4
- package/yarn-error.log +3144 -0
- package/dist/common/core.js +0 -397
- package/dist/common/subPackages/react/jsx/index.js +0 -26
- package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
- package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
- package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
- package/dist/module/Report.js +0 -186
- package/dist/module/core.js +0 -388
- package/dist/module/subPackages/react/jsx/index.js +0 -22
- package/dist/module/subPackages/react/jsx/node.js +0 -5
- package/dist/module/subPackages/react/jsx/web.js +0 -5
- package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
- package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/types/core.d.ts +0 -220
- package/dist/types/subPackages/react/component/node.d.ts +0 -12
- package/dist/types/subPackages/react/component/web.d.ts +0 -12
- package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
- package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
- package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
- package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
- package/dist/types/subPackages/react-test-renderer/component/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
- package/src/core.ts +0 -1399
- package/src/subPackages/react/component/web.ts +0 -80
- package/src/subPackages/react/jsx/index.ts +0 -64
- package/src/subPackages/react/jsx/node.ts +0 -29
- package/src/subPackages/react/jsx/web.ts +0 -29
- package/src/subPackages/react-dom/jsx/node.ts +0 -145
- package/src/subPackages/react-test-renderer/component/node.ts +0 -30
- package/src/subPackages/react-test-renderer/component/web.ts +0 -30
- package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
- /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v18.18.0
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# testeranto
|
|
2
2
|
|
|
3
|
+
🚧 WARNING: Testeeranto is still under development and is not ready for production yet. 🚧
|
|
4
|
+
|
|
3
5
|
home: [adamwong246.github.io/testeranto](https://adamwong246.github.io/testeranto/)
|
|
4
6
|
|
|
5
7
|
source: [github.com/adamwong246/testeranto](https://github.com/adamwong246/testeranto)
|
|
@@ -12,9 +14,10 @@ example repo: [kokomo bay](https://github.com/ChromaPDX/kokomoBay)
|
|
|
12
14
|
|
|
13
15
|
## tl;dr
|
|
14
16
|
|
|
15
|
-
- Do you like BDD?
|
|
17
|
+
- Do you like TDD/BDD?
|
|
16
18
|
- Do you love Typescript?
|
|
17
19
|
- Do you hate Jira?
|
|
20
|
+
- Do you tolerate electron?
|
|
18
21
|
|
|
19
22
|
If so, then testeranto might be the testing tool you have been looking for!
|
|
20
23
|
|
|
@@ -22,20 +25,38 @@ If so, then testeranto might be the testing tool you have been looking for!
|
|
|
22
25
|
|
|
23
26
|
Testeranto.ts an Acceptance Test Driven Development ([ATDD](https://en.wikipedia.org/wiki/Acceptance_test-driven_development)) framework. It focuses on strongly-typed tests, specified in a gherkin-like syntax. Testeranto includes a framework to help write your tests, a test runner to schedule the tests and a reporter to display the results.
|
|
24
27
|
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
1. Rather than testing your code directly, Testeranto requires you wrap your code with a semantic interface which is based on TS type signatures. These interfaces can be shared and your code is now tested through the gherkin-ish directives provided by that interface.
|
|
28
|
+
## Getting started
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
1) Write some code.
|
|
31
|
+
2) Write some tests of that code.
|
|
32
|
+
3) Write some features of that code.
|
|
33
|
+
1) Write a `testeranto.mts`, which acts as a config file.
|
|
34
|
+
3) Launch testeranto. The test runner is now rebuilding the docs folder.
|
|
35
|
+
4) Commit the results of those tests.
|
|
36
|
+
5) Your github pages now shows your report, showing your features, linked with your test results.
|
|
37
|
+
6) Optionally add testeranto to your CI.
|
|
30
38
|
|
|
31
39
|
## tech of note
|
|
32
40
|
|
|
41
|
+
- esm - Testeranto uses modern js.
|
|
33
42
|
- typescript - tests are functions with type parameters
|
|
43
|
+
- electron - provides both a node and chrome runtime
|
|
44
|
+
- puppeteer - provides node-style tests with a handle to the browser
|
|
34
45
|
- esbuild - used to quickly generate test bundles
|
|
35
46
|
- graphology - used to store features within a semantic network
|
|
36
47
|
|
|
48
|
+
## 3 distinguishing features of testeranto
|
|
49
|
+
|
|
50
|
+
1. Rather than testing your code directly, Testeranto requires you wrap your code with a semantic interface which is based on TS type signatures. These interfaces can be shared and your code is now tested through the gherkin-ish directives provided by that interface.
|
|
51
|
+
|
|
52
|
+
2. Testeranto tracks features and test results directly in the source code. You may be accustomed to using tools like Jira and Trello to define user stories and assign story points- Under Testeranto, this data lives within the code base _as_ typescript code. Features are defined as nodes within a directed graph, allowing the reporter to summarize these features and their test results.
|
|
53
|
+
|
|
54
|
+
3. Testeranto is designed for both the backend and the frontend. It leverages electron to provide both of these runtimes. Each of your tests can be executed in the backend node runtime, within the frontend chromium browser runtime, or both.
|
|
55
|
+
|
|
37
56
|
## the good parts
|
|
38
57
|
|
|
58
|
+
Your tests can be run in node, chromium, or both! For example, for a single react component, you could create 3 tests- 1 that runs with react-test-renderer on node, another on chromium which renders the component to the dom, and a 3rd node style test which invokes the component in the browser before interacting with it via puppeteer.
|
|
59
|
+
|
|
39
60
|
Testeranto includes a test runner which bundles and executes your tests, taking care to only run the tests which have changed. It is designed to run most tests in parallel, though it has support for tests which require a shared resource, like a port.
|
|
40
61
|
|
|
41
62
|
Testeranto includes a test reporter which displays the state of your code in a web app. ([see example](https://chromapdx.github.io/kokomoBay/report.html)) This reporter can also be run locally for the developer's convenience.
|
|
@@ -46,10 +67,51 @@ Rather than the traditional method of specifying tests in plain text, Testeranto
|
|
|
46
67
|
|
|
47
68
|
## the bad parts
|
|
48
69
|
|
|
49
|
-
Testeranto
|
|
70
|
+
Testeranto is not designed to maximize performance. In dev mode, it runs multiple esbuild processes, electron, 1 node process for each node test and 1 chromium processes for each web test.
|
|
71
|
+
|
|
72
|
+
Testeranto does not (yet!) of a means of allowing non-coders to affect changes so, as they say, "get good 💪!"
|
|
73
|
+
|
|
74
|
+
Because Testeranto is so un-opinionated that it does not provide test infrastructure. You will need to find an existing recipe or implement it yourself, though a public repo of test interfaces exists.
|
|
75
|
+
|
|
76
|
+
## How it works
|
|
77
|
+
|
|
78
|
+
Testeranto is comprised of 3 parts
|
|
79
|
+
1) The build process reads a config and builds the docs folder, then launches 3 esbuild build processes.
|
|
80
|
+
a) Build the features for the html report
|
|
81
|
+
b) Build the node-style tests
|
|
82
|
+
c) Build the web-style tests
|
|
83
|
+
2) The test runner is an electron app which watches the output of those build processes and launches the tests as those files change.
|
|
84
|
+
3) A Report which links your features, your tests and the results of those tests into a handy website.
|
|
85
|
+
|
|
86
|
+
## Electron aka Node vs Chromium
|
|
87
|
+
|
|
88
|
+
At the heart of testeranto is the dual runtime provided by electron. The electron test runner creates an UtilityProcess for each node test and a BrowserWindow for each web test. Each of these processes can communicate to other artifacts over IPC. That is, a node test can invoke a web artifact and send it messages over the IPC channel, and vice-versa. Furthermore, node tests are provided with a puppeteer, providing it access to the web environment, while web tests are provided the electron BrowserWindow, which allows it to similarly bridge the gap between the web runtime and the node runtime.
|
|
89
|
+
|
|
90
|
+
## Hybrid tests
|
|
91
|
+
|
|
92
|
+
Consider the a scenario: You have an http server which serves a frontend react component. You have multiple ways you can test this.
|
|
93
|
+
|
|
94
|
+
- A node test of the logic of the http server
|
|
95
|
+
- A node test of the full http server, tested over http request.
|
|
96
|
+
- A node test of the react component with react-test-render
|
|
97
|
+
- A web test of the react component rendering it to the dom.
|
|
98
|
+
- A node test of the logic of the server, rending the component as a paired artifact and communicated over IPC.
|
|
99
|
+
- A node test of the full server, invoking puppeteer to drive the browser.
|
|
100
|
+
- A web test, invoking the server as a shared artifact, serving http to the browser.
|
|
101
|
+
|
|
102
|
+
## API
|
|
103
|
+
|
|
104
|
+
Testeranto's main API interface is 2 functions, 1 for each run time. You must pass to this function the following arguments
|
|
50
105
|
|
|
51
|
-
|
|
106
|
+
- The "shape" - a TS type signature to which the other arguments must conform.
|
|
107
|
+
- The "input" - the test subject. The "thing that is to be tested"
|
|
108
|
+
- the "specification" - This is the Cucumber-style Given/When/Then steps.
|
|
109
|
+
- the "implementation" - This is the code which implements the "test specification" in code.
|
|
110
|
+
- the "interface" - The code which sets up the test.
|
|
52
111
|
|
|
53
|
-
|
|
112
|
+
This is designed so that each piece can be worked upon separately. You can think of each argument as the responsibility of a different member of your team.
|
|
54
113
|
|
|
55
|
-
|
|
114
|
+
- "Senior Engineer" handles the "shape" and "input"
|
|
115
|
+
- "Product Manager" handles the "specification"
|
|
116
|
+
- "Middle Engineer" handles the "interface"
|
|
117
|
+
- "Junior Engineer" handles the "implementation"
|
package/dist/cjs-shim.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import url from 'node:url';
|
|
4
|
+
|
|
5
|
+
// globalThis.require = createRequire(import.meta.url);
|
|
6
|
+
// globalThis.__filename = url.fileURLToPath(import.meta.url);
|
|
7
|
+
// globalThis.__dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
// const p = `${import.meta.url}/..`;
|
|
10
|
+
// globalThis.require = createRequire(`${import.meta.url}/..`);
|
|
11
|
+
// globalThis.__filename = url.fileURLToPath(`${import.meta.url}/..`);
|
|
12
|
+
// globalThis.__dirname = path.dirname(`${__filename}/..`);
|
package/dist/common/Features.js
CHANGED
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.DirectedGraph = exports.TesterantoFeatures = exports.TesterantoGraphDirectedAcyclic = exports.TesterantoGraphDirected = exports.TesterantoGraphUndirected = exports.BaseFeature = void 0;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const { DirectedGraph, UndirectedGraph } = graphology_1.default;
|
|
7
|
+
const graphology_umd_js_1 = __importDefault(require("graphology/dist/graphology.umd.js"));
|
|
8
|
+
const { DirectedGraph, UndirectedGraph } = graphology_umd_js_1.default;
|
|
10
9
|
exports.DirectedGraph = DirectedGraph;
|
|
11
10
|
class TesterantoGraph {
|
|
12
11
|
constructor(name) {
|
package/dist/common/Node.js
CHANGED
|
@@ -3,72 +3,64 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const http_1 = __importDefault(require("http"));
|
|
7
|
+
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
8
|
+
const core_js_1 = __importDefault(require("./lib/core.js"));
|
|
9
|
+
const index_js_1 = require("./lib/index.js");
|
|
8
10
|
const NodeWriter_js_1 = require("./NodeWriter.js");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const Types_js_1 = require("./Types.js");
|
|
12
|
+
const readJson = async (port) => new Promise((resolve, reject) => {
|
|
13
|
+
let json = "";
|
|
14
|
+
const request = http_1.default.request({
|
|
15
|
+
host: "127.0.0.1",
|
|
16
|
+
path: "/json/version",
|
|
17
|
+
port,
|
|
18
|
+
}, (response) => {
|
|
19
|
+
response.on("error", reject);
|
|
20
|
+
response.on("data", (chunk) => {
|
|
21
|
+
json += chunk.toString();
|
|
22
|
+
});
|
|
23
|
+
response.on("end", () => {
|
|
24
|
+
resolve(JSON.parse(json));
|
|
25
|
+
});
|
|
13
26
|
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
process.exit(
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
console.error(err);
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = core_js_1.defaultTestResourceRequirement) => {
|
|
38
|
-
const mrt = new core_js_2.default(input, testSpecification, testImplementation, testInterface, testResourceRequirement, testInterface.assertioner || (async (t) => t), testInterface.beforeEach || async function (subject, initialValues, testResource) {
|
|
39
|
-
return subject;
|
|
40
|
-
}, testInterface.afterEach || (async (s) => s), testInterface.afterAll || ((store) => undefined), testInterface.butThen || (async (a) => a), testInterface.andWhen, testInterface.actionHandler ||
|
|
41
|
-
function (b) {
|
|
42
|
-
return b;
|
|
43
|
-
}, NodeWriter_js_1.NodeWriter);
|
|
44
|
-
const tl2 = mrt;
|
|
45
|
-
const t = tl2.testJobs[0];
|
|
46
|
-
const testResourceArg = process.argv[2] || `{}`;
|
|
47
|
-
try {
|
|
48
|
-
const partialTestResource = JSON.parse(testResourceArg);
|
|
49
|
-
if (partialTestResource.scheduled) {
|
|
50
|
-
console.log("test is scheduled", partialTestResource);
|
|
51
|
-
console.log("requesting test resources via IPC ...", testResourceRequirement);
|
|
52
|
-
/* @ts-ignore:next-line */
|
|
53
|
-
process.send({
|
|
54
|
-
type: "testeranto:hola",
|
|
55
|
-
data: {
|
|
56
|
-
requirement: Object.assign(Object.assign({}, testResourceRequirement), { name: partialTestResource.name })
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
console.log("awaiting test resources via IPC...");
|
|
60
|
-
process.on("message", async function (packet) {
|
|
61
|
-
const resourcesFromPm2 = packet.data.testResourceConfiguration;
|
|
62
|
-
const secondTestResource = Object.assign(Object.assign({ fs: "." }, JSON.parse(JSON.stringify(partialTestResource))), JSON.parse(JSON.stringify(resourcesFromPm2)));
|
|
63
|
-
receiveTestResourceConfigScheduled(t, secondTestResource);
|
|
64
|
-
});
|
|
27
|
+
request.on("error", reject);
|
|
28
|
+
request.end();
|
|
29
|
+
});
|
|
30
|
+
class NodeTesteranto extends core_js_1.default {
|
|
31
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
|
|
32
|
+
super(input, testSpecification, testImplementation, testResourceRequirement, NodeWriter_js_1.NodeWriter, testInterface);
|
|
33
|
+
if (process.argv[2]) {
|
|
34
|
+
const testResourceArg = process.argv[2];
|
|
35
|
+
try {
|
|
36
|
+
const partialTestResource = JSON.parse(testResourceArg);
|
|
37
|
+
this.receiveTestResourceConfig(this.testJobs[0], partialTestResource);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
console.error(e);
|
|
41
|
+
// process.exit(-1);
|
|
42
|
+
}
|
|
65
43
|
}
|
|
66
44
|
else {
|
|
67
|
-
|
|
45
|
+
// no-op
|
|
68
46
|
}
|
|
69
47
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
48
|
+
async receiveTestResourceConfig(t, partialTestResource) {
|
|
49
|
+
const browser = await readJson("2999").then(async (json) => {
|
|
50
|
+
const b = await puppeteer_core_1.default.connect({
|
|
51
|
+
browserWSEndpoint: json.webSocketDebuggerUrl,
|
|
52
|
+
defaultViewport: null,
|
|
53
|
+
});
|
|
54
|
+
console.log("connected!", b.isConnected());
|
|
55
|
+
return b;
|
|
56
|
+
});
|
|
57
|
+
const { failed, artifacts, logPromise } = await t.receiveTestResourceConfig(partialTestResource, new Types_js_1.TBrowser(browser));
|
|
58
|
+
Promise.all([...artifacts, logPromise]).then(async () => {
|
|
59
|
+
// process.exit(await failed ? 1 : 0);
|
|
60
|
+
});
|
|
73
61
|
}
|
|
62
|
+
}
|
|
63
|
+
;
|
|
64
|
+
exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
|
|
65
|
+
return new NodeTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
74
66
|
};
|