testeranto 0.134.0 → 0.140.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/.aider.chat.history.md +14577 -0
- package/.aider.input.history +566 -0
- package/.aider.tags.cache.v3/{8d/fa/12860238755bcfab9af8a93c52ab.val → bd/91/b71f967fd074cf4b757081b429b7.val} +0 -0
- package/.aider.tags.cache.v3/cache.db +0 -0
- package/.aider.tags.cache.v3/{18/8b/7dfca822129dad10b5cacadf7728.val → fb/96/b0f91c7e75e08fc5a6907633cf99.val} +0 -0
- package/README.md +29 -423
- package/bundle.js +1 -1
- package/dist/common/src/CoreTypes.js +2 -0
- package/dist/common/src/Init.js +4 -1
- package/dist/common/src/Node.js +1 -1
- package/dist/common/src/PM/PM_WithEslintAndTsc.js +10 -8
- package/dist/common/src/PM/__tests__/nodeSidecar.testeranto.js +2 -2
- package/dist/common/src/PM/main.js +12 -7
- package/dist/common/src/PM/node.js +10 -3
- package/dist/common/src/Web.js +2 -2
- package/dist/common/src/build.js +7 -72
- package/dist/common/src/defaultConfig.js +0 -1
- package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
- package/dist/common/src/esbuildConfigs/node.js +2 -16
- package/dist/common/src/esbuildConfigs/pure.js +2 -16
- package/dist/common/src/esbuildConfigs/rebuildPlugin.js +22 -0
- package/dist/common/src/esbuildConfigs/web.js +2 -16
- package/dist/common/src/lib/abstractBase.js +8 -1
- package/dist/common/src/lib/basebuilder.js +4 -0
- package/dist/common/src/lib/classBuilder.js +2 -3
- package/dist/common/src/lib/core.js +2 -0
- package/dist/common/src/run.js +1 -1
- package/dist/common/src/utils/buildTemplates.js +88 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Init.js +4 -1
- package/dist/module/src/Node.js +1 -1
- package/dist/module/src/PM/PM_WithEslintAndTsc.js +10 -8
- package/dist/module/src/PM/__tests__/nodeSidecar.testeranto.js +2 -2
- package/dist/module/src/PM/main.js +12 -7
- package/dist/module/src/PM/node.js +10 -3
- package/dist/module/src/Project.js +41 -47
- package/dist/module/src/TestReport.js +34 -31
- package/dist/module/src/Web.js +2 -2
- package/dist/module/src/build.js +7 -72
- package/dist/module/src/defaultConfig.js +0 -1
- package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
- package/dist/module/src/esbuildConfigs/node.js +2 -16
- package/dist/module/src/esbuildConfigs/pure.js +2 -16
- package/dist/module/src/esbuildConfigs/rebuildPlugin.js +17 -0
- package/dist/module/src/esbuildConfigs/web.js +2 -16
- package/dist/module/src/lib/abstractBase.js +8 -1
- package/dist/module/src/lib/basebuilder.js +4 -0
- package/dist/module/src/lib/classBuilder.js +2 -3
- package/dist/module/src/lib/core.js +2 -0
- package/dist/module/src/run.js +1 -1
- package/dist/module/src/utils/buildTemplates.js +82 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Project.js +77 -29
- package/dist/prebuild/TestReport.js +51 -32
- package/dist/prebuild/build.mjs +132 -131
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +14 -1
- package/dist/prebuild/init-docs.mjs +0 -4
- package/dist/prebuild/run.mjs +50 -31
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/src/CoreTypes.d.ts +53 -0
- package/dist/types/src/Node.d.ts +3 -3
- package/dist/types/src/PM/__tests__/nodeSidecar.testeranto.d.ts +2 -4
- package/dist/types/src/PM/__tests__/pureSidecar.testeranto.d.ts +2 -4
- package/dist/types/src/PM/__tests__/webSidecar.testeranto.d.ts +2 -4
- package/dist/types/src/PM/index.d.ts +1 -1
- package/dist/types/src/PM/nodeSidecar.d.ts +2 -2
- package/dist/types/src/Pure.d.ts +3 -3
- package/dist/types/src/Types.d.ts +21 -61
- package/dist/types/src/Web.d.ts +3 -3
- package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +6 -0
- package/dist/types/src/lib/abstractBase.d.ts +10 -16
- package/dist/types/src/lib/basebuilder.d.ts +3 -3
- package/dist/types/src/lib/classBuilder.d.ts +2 -2
- package/dist/types/src/lib/core.d.ts +2 -2
- package/dist/types/src/lib/index.d.ts +7 -6
- package/dist/types/src/lib/types.d.ts +8 -8
- package/dist/types/src/mothership/test.d.ts +2 -2
- package/dist/types/src/utils/buildTemplates.d.ts +3 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docs/index.md +567 -0
- package/docs/style.md +116 -0
- package/docs.html +537 -0
- package/example.css +351 -0
- package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Black.ttf +0 -0
- package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Bold.ttf +0 -0
- package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-ExtraBold.ttf +0 -0
- package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Light.ttf +0 -0
- package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Medium.ttf +0 -0
- package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Regular.ttf +0 -0
- package/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Thin.ttf +0 -0
- package/fonts/M_PLUS_Rounded_1c/OFL.txt +91 -0
- package/index.html +245 -24
- package/logo.svg +72 -0
- package/package.json +11 -2
- package/scripts/compile-docs.js +89 -0
- package/src/CoreTypes.ts +152 -0
- package/src/Init.ts +4 -4
- package/src/Node.ts +13 -13
- package/src/PM/PM_WithEslintAndTsc.ts +46 -15
- package/src/PM/__tests__/nodeSidecar.testeranto.ts +13 -20
- package/src/PM/__tests__/pureSidecar.testeranto.ts +8 -15
- package/src/PM/__tests__/webSidecar.testeranto.ts +8 -15
- package/src/PM/index.ts +1 -1
- package/src/PM/main.ts +17 -16
- package/src/PM/node.ts +10 -10
- package/src/PM/nodeSidecar.ts +2 -2
- package/src/PM/pure.ts +0 -4
- package/src/Project.tsx +289 -292
- package/src/Pure.ts +13 -14
- package/src/PureSidecar.ts +1 -0
- package/src/TestReport.tsx +179 -165
- package/src/Types.ts +52 -151
- package/src/Web.ts +15 -14
- package/src/build.ts +22 -72
- package/src/defaultConfig.ts +2 -1
- package/src/esbuildConfigs/eslint-formatter-testeranto.ts +17 -1
- package/src/esbuildConfigs/node.ts +2 -18
- package/src/esbuildConfigs/pure.ts +2 -18
- package/src/esbuildConfigs/rebuildPlugin.ts +23 -0
- package/src/esbuildConfigs/web.ts +2 -18
- package/src/lib/BaseSuite.test.ts +457 -0
- package/src/lib/BaseSuite.ts +155 -0
- package/src/lib/abstractBase.ts +13 -163
- package/src/lib/basebuilder.ts +11 -11
- package/src/lib/classBuilder.ts +13 -7
- package/src/lib/core.ts +13 -17
- package/src/lib/index.ts +21 -24
- package/src/lib/types.ts +23 -9
- package/src/mothership/test.ts +13 -10
- package/src/run.ts +1 -1
- package/src/style.css +1 -1
- package/src/utils/buildTemplates.ts +88 -0
- package/style.css +496 -0
- package/testeranto/bundles/node/{mothership/chunk-V2EQEXU2.mjs → allTests/chunk-4PJCC2XT.mjs} +66 -59
- package/testeranto/bundles/node/allTests/metafile.json +4151 -0
- package/testeranto/bundles/node/allTests/src/PM/__tests__/nodeSidecar.testeranto.mjs +187 -0
- package/testeranto/bundles/node/{mothership → allTests}/src/PM/__tests__/pureSidecar.testeranto.mjs +1 -1
- package/testeranto/bundles/node/{mothership → allTests}/src/PM/__tests__/webSidecar.testeranto.mjs +1 -1
- package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test.mjs +305 -0
- package/testeranto/bundles/node/{mothership → allTests}/src/mothership/test.mjs +1 -1
- package/testeranto/dev.html +29 -0
- package/testeranto/index.html +28 -27
- package/testeranto/reports/allTests/config.json +57 -0
- package/testeranto/reports/{mothership/index.html → allTests/dev.html} +2 -0
- package/testeranto/reports/allTests/index.html +26 -0
- package/testeranto/reports/{mothership/src/PM/__tests__/sidecar.testeranto/node/index.html → allTests/src/PM/__tests__/nodeSidecar.testeranto/node/dev.html} +4 -3
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/index.html +21 -0
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/lint_errors.json +80 -0
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/message +1 -0
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/PM/__tests__/nodeSidecar.testeranto/node/type_errors.txt +28 -0
- package/testeranto/reports/{mothership/src/PM/__tests__/webSidecar.testeranto/node/index.html → allTests/src/PM/__tests__/pureSidecar.testeranto/node/dev.html} +4 -3
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/index.html +21 -0
- package/testeranto/reports/{mothership → allTests}/src/PM/__tests__/pureSidecar.testeranto/node/lint_errors.json +12 -12
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/message +1 -0
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/PM/__tests__/pureSidecar.testeranto/node/type_errors.txt +32 -0
- package/testeranto/reports/{mothership/src/PM/__tests__/nodeSidecar.testeranto/node/index.html → allTests/src/PM/__tests__/webSidecar.testeranto/node/dev.html} +4 -3
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/index.html +21 -0
- package/testeranto/reports/{mothership → allTests}/src/PM/__tests__/webSidecar.testeranto/node/lint_errors.json +12 -12
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/message +1 -0
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/PM/__tests__/webSidecar.testeranto/node/type_errors.txt +32 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/console_log.txt +35 -0
- package/testeranto/reports/{mothership/src/PM/__tests__/pureSidecar.testeranto/node/index.html → allTests/src/lib/BaseSuite.test/node/dev.html} +4 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/index.html +21 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/lint_errors.json +608 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/message +1 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/prompt.txt +7 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node/type_errors.txt +68 -0
- package/testeranto/reports/allTests/src/mothership/test/node/dev.html +21 -0
- package/testeranto/reports/allTests/src/mothership/test/node/index.html +21 -0
- package/testeranto/reports/allTests/src/mothership/test/node/message +1 -0
- package/testeranto/reports/allTests/src/mothership/test/node/prompt.txt +8 -0
- package/testeranto/reports/allTests/src/mothership/test/node/type_errors.txt +24 -0
- package/testeranto/reports/allTests/summary.json +37 -0
- package/testeranto.config.ts +16 -26
- package/tsc.log +66 -69
- package/.aider.tags.cache.v3/cache.db-shm +0 -0
- package/.aider.tags.cache.v3/cache.db-wal +0 -0
- package/dist/common/src/SP__Polygon.test.js +0 -10
- package/dist/module/src/ReportClient.js +0 -132
- package/dist/module/src/SP__Polygon.test.js +0 -8
- package/dist/prebuild/ReportClient.js +0 -3
- package/src/ReportClient.tsx +0 -164
- package/src/SP__Polygon.test.ts +0 -13
- package/testeranto/ReportClient.css +0 -11367
- package/testeranto/ReportClient.js +0 -24641
- package/testeranto/bundles/node/mothership/metafile.json +0 -389
- package/testeranto/bundles/node/mothership/src/PM/__tests__/nodeSidecar.testeranto.mjs +0 -1219
- package/testeranto/bundles/node/mothership/src/PM/__tests__/sidecar.testeranto.mjs +0 -1199
- package/testeranto/reports/mothership/config.json +0 -25
- package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/console_log.txt +0 -0
- package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/lint_errors.json +0 -1564
- package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/prompt.txt +0 -22
- package/testeranto/reports/mothership/src/PM/__tests__/nodeSidecar.testeranto/node/type_errors.txt +0 -35
- package/testeranto/reports/mothership/src/PM/__tests__/pureSidecar.testeranto/node/prompt.txt +0 -12
- package/testeranto/reports/mothership/src/PM/__tests__/pureSidecar.testeranto/node/type_errors.txt +0 -26
- package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/bdd_errors.txt +0 -1
- package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/console_log.txt +0 -0
- package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/lint_errors.json +0 -1564
- package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/log.txt +0 -0
- package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/prompt.txt +0 -22
- package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/tests.json +0 -56
- package/testeranto/reports/mothership/src/PM/__tests__/sidecar.testeranto/node/type_errors.txt +0 -29
- package/testeranto/reports/mothership/src/PM/__tests__/webSidecar.testeranto/node/prompt.txt +0 -12
- package/testeranto/reports/mothership/src/PM/__tests__/webSidecar.testeranto/node/type_errors.txt +0 -26
- package/testeranto/reports/mothership/src/mothership/test/node/bdd_errors.txt +0 -1
- package/testeranto/reports/mothership/src/mothership/test/node/console_log.txt +0 -4
- package/testeranto/reports/mothership/src/mothership/test/node/index.html +0 -20
- package/testeranto/reports/mothership/src/mothership/test/node/log.txt +0 -0
- package/testeranto/reports/mothership/src/mothership/test/node/prompt.txt +0 -12
- package/testeranto/reports/mothership/src/mothership/test/node/tests.json +0 -24
- package/testeranto/reports/mothership/src/mothership/test/node/type_errors.txt +0 -18
- package/testeranto/reports/mothership/summary.json +0 -9
- /package/dist/{types/src/SP__Polygon.test.d.ts → module/src/CoreTypes.js} +0 -0
- /package/testeranto/bundles/node/{mothership → allTests}/chunk-PG6KUKNP.mjs +0 -0
- /package/testeranto/bundles/pure/{mothership → allTests}/metafile.json +0 -0
- /package/testeranto/bundles/web/{mothership → allTests}/metafile.json +0 -0
- /package/testeranto/reports/{mothership/src/PM/__tests__/nodeSidecar.testeranto → allTests/src/lib/BaseSuite.test}/node/log.txt +0 -0
- /package/testeranto/reports/{mothership → allTests}/src/mothership/test/node/lint_errors.json +0 -0
package/index.html
CHANGED
|
@@ -1,30 +1,251 @@
|
|
|
1
|
+
|
|
1
2
|
<!DOCTYPE html>
|
|
2
3
|
<html lang="en">
|
|
3
|
-
|
|
4
4
|
<head>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<script src="/dist/testeranto.js"></script>
|
|
13
|
-
|
|
14
|
-
<script type="importmap">
|
|
15
|
-
{
|
|
16
|
-
"imports": {
|
|
17
|
-
"tests.test.js": "./tests.test.js",
|
|
18
|
-
"features.test.js": "./features.test.js"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
22
|
-
</head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>README.md</title>
|
|
8
|
+
|
|
9
|
+
<!-- Prism.js CSS -->
|
|
10
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
|
|
11
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.css" rel="stylesheet" />
|
|
23
12
|
|
|
13
|
+
<!-- load style AFTER prism -->
|
|
14
|
+
<link rel="stylesheet" href="style.css">
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
</head>
|
|
24
18
|
<body>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</
|
|
19
|
+
<div class="parallax-background"></div>
|
|
20
|
+
<div id="container">
|
|
21
|
+
<h1>testeranto</h1>
|
|
22
|
+
<h2>The AI-powered BDD test framework for TypeScript projects</h2>
|
|
23
|
+
<h4>🚧 WARNING: Testeranto is still under development and is not ready for production yet. 🚧</h4>
|
|
24
|
+
<ul>
|
|
25
|
+
<li>demo video: <a href="https://www.youtube.com/embed/WvU5xMqGi6Q">youtube</a></li>
|
|
26
|
+
<li>source: <a href="https://github.com/adamwong246/testeranto">github.com/adamwong246/testeranto</a></li>
|
|
27
|
+
<li>npm: <a href="https://www.npmjs.com/package/testeranto">npmjs.com/package/testeranto</a></li>
|
|
28
|
+
<li>dev: <a href="https://github.dev/adamwong246/testeranto">github.dev/adamwong246/testeranto</a></li>
|
|
29
|
+
<li>example repo: <a href="https://github.com/adamwong246/testeranto-starter">testeranto-starter</a></li>
|
|
30
|
+
</ul>
|
|
31
|
+
<h2>What is testeranto?</h2>
|
|
32
|
+
<ul>
|
|
33
|
+
<li>Testeranto produces test results which can be fed to Aider.ai to automatically fix failing tests.</li>
|
|
34
|
+
<li>Testeranto tests are specified in a strongly-typed gherkin-like syntax. Rather than testing your code directly, Testeranto requires you wrap your code with a semantic interface which is based on TS type signatures.</li>
|
|
35
|
+
<li>Testeranto can run tests in the frontend or the backend, or both.</li>
|
|
36
|
+
<li>Testeranto can be used to test anything that can be bundled with esbuild.</li>
|
|
37
|
+
<li>Testeranto connects "features" to "tests". This allows the AI to read feature documentation from external systems, like Jira.</li>
|
|
38
|
+
<li>Testeranto generates test results into static a website which can be deployed to github pages easily.</li>
|
|
39
|
+
<li>Testeranto uses esbuild to bundle it's tests. The result is used to refine the list of files added to the context of the AI. <strong>The consequence of this is that you can fit all relevant files, and ONLY the relevant files, into the LLMs context.</strong></li>
|
|
40
|
+
</ul>
|
|
41
|
+
<h2>Key Technologies</h2>
|
|
42
|
+
<table>
|
|
43
|
+
<thead>
|
|
44
|
+
<tr>
|
|
45
|
+
<th></th>
|
|
46
|
+
<th></th>
|
|
47
|
+
</tr>
|
|
48
|
+
</thead>
|
|
49
|
+
<tbody><tr>
|
|
50
|
+
<td>ESM</td>
|
|
51
|
+
<td>Modern javascript tooling</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td>TypeScript</td>
|
|
55
|
+
<td>Strongly-typed test definitions</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td>Puppeteer</td>
|
|
59
|
+
<td>Cross-runtime testing (Node & Browser)</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<td>esbuild</td>
|
|
63
|
+
<td>Fast test bundling</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<td>Aider.ai</td>
|
|
67
|
+
<td>AI-powered test fixing</td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td>ESLint</td>
|
|
71
|
+
<td>Static analysis of test files</td>
|
|
72
|
+
</tr>
|
|
73
|
+
<tr>
|
|
74
|
+
<td>tsc</td>
|
|
75
|
+
<td>Type checking of test files</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr>
|
|
78
|
+
<td>Markdown</td>
|
|
79
|
+
<td>Feature documentation format</td>
|
|
80
|
+
</tr>
|
|
81
|
+
</tbody></table>
|
|
82
|
+
<h2>Quick Start</h2>
|
|
83
|
+
<ol>
|
|
84
|
+
<li>Install testeranto:</li>
|
|
85
|
+
</ol>
|
|
86
|
+
<pre>npm install testeranto</pre><ol start="2">
|
|
87
|
+
<li>Create a test file (e.g., <code>rectangle.test.ts</code>):</li>
|
|
88
|
+
</ol>
|
|
89
|
+
<pre class="language-typescript line-numbers"><code class="language-typescript">import { Given, When, Then } from "testeranto";
|
|
90
|
+
|
|
91
|
+
type Rectangle = { width: number; height: number };
|
|
92
|
+
|
|
93
|
+
const RectangleSpec = (Suite, Given, When, Then) => [
|
|
94
|
+
Suite.Default("Rectangle tests", {
|
|
95
|
+
test1: Given.Default(
|
|
96
|
+
["Basic rectangle operations"],
|
|
97
|
+
[When.setWidth(5), When.setHeight(10)],
|
|
98
|
+
[Then.getWidth(5), Then.getHeight(10)]
|
|
99
|
+
),
|
|
100
|
+
}),
|
|
101
|
+
];</code></pre><ol start="3">
|
|
102
|
+
<li>Run the tests</li>
|
|
103
|
+
</ol>
|
|
104
|
+
<p>To start testeranto in dev mode, build your tests in one terminal and execute them in another</p>
|
|
105
|
+
<pre># Terminal 1 - Build in watch mode
|
|
106
|
+
yarn t-build rectangle.test.ts yourProject dev
|
|
107
|
+
|
|
108
|
+
# Terminal 2 - Run in watch mode
|
|
109
|
+
yarn t-run rectangle.test.ts yourProject dev</pre><p>or build and run your tests only once</p>
|
|
110
|
+
<pre>yarn t-build rectangle.test.ts yourProject once && yarn t-run rectangle.test.ts yourProject once</pre><h2>Runtime Platforms</h2>
|
|
111
|
+
<table>
|
|
112
|
+
<thead>
|
|
113
|
+
<tr>
|
|
114
|
+
<th></th>
|
|
115
|
+
<th>Runs on</th>
|
|
116
|
+
<th>You should use this runtime for...</th>
|
|
117
|
+
<th>Important differences</th>
|
|
118
|
+
</tr>
|
|
119
|
+
</thead>
|
|
120
|
+
<tbody><tr>
|
|
121
|
+
<td><strong>Node</strong></td>
|
|
122
|
+
<td>node V8 with fork</td>
|
|
123
|
+
<td>testing backend code, Node APIs (like <code>fs</code> and <code>crypto</code>), or anything needing filesystem access</td>
|
|
124
|
+
<td>has access to the filesystem and io</td>
|
|
125
|
+
</tr>
|
|
126
|
+
<tr>
|
|
127
|
+
<td><strong>Web</strong></td>
|
|
128
|
+
<td>chrome browser</td>
|
|
129
|
+
<td>testing frontend code, anything that uses <code>document</code> or <code>window</code>, UI interactions, or visual regression</td>
|
|
130
|
+
<td>can take screenshots/recordings</td>
|
|
131
|
+
</tr>
|
|
132
|
+
<tr>
|
|
133
|
+
<td><strong>Pure</strong></td>
|
|
134
|
+
<td>node v8, dynamically imported</td>
|
|
135
|
+
<td>testing code which can run on both node-v8 and the the browser</td>
|
|
136
|
+
<td>Very similar to "Node" but has no IO access and thus, no console.log. This runtime is theoretically faster.</td>
|
|
137
|
+
</tr>
|
|
138
|
+
</tbody></table>
|
|
139
|
+
<h2>CLI Commands</h2>
|
|
140
|
+
<table>
|
|
141
|
+
<thead>
|
|
142
|
+
<tr>
|
|
143
|
+
<th></th>
|
|
144
|
+
<th></th>
|
|
145
|
+
</tr>
|
|
146
|
+
</thead>
|
|
147
|
+
<tbody><tr>
|
|
148
|
+
<td><code>yarn t-init</code></td>
|
|
149
|
+
<td>Create a new testeranto project</td>
|
|
150
|
+
</tr>
|
|
151
|
+
<tr>
|
|
152
|
+
<td><code>yarn t-build <YOUR_TESTS> dev|once</code></td>
|
|
153
|
+
<td>Build test bundles (watch or single-run mode)</td>
|
|
154
|
+
</tr>
|
|
155
|
+
<tr>
|
|
156
|
+
<td><code>yarn t-run <YOUR_TESTS> dev|once</code></td>
|
|
157
|
+
<td>Run tests (watch or single-run mode)</td>
|
|
158
|
+
</tr>
|
|
159
|
+
<tr>
|
|
160
|
+
<td><code>yarn t-report</code></td>
|
|
161
|
+
<td>Launch test report server</td>
|
|
162
|
+
</tr>
|
|
163
|
+
<tr>
|
|
164
|
+
<td><code>yarn t-aider</code></td>
|
|
165
|
+
<td>Fix failing tests with AI</td>
|
|
166
|
+
</tr>
|
|
167
|
+
</tbody></table>
|
|
168
|
+
<h2>Example workflow:</h2>
|
|
169
|
+
<pre># Initialize project
|
|
170
|
+
yarn t-init
|
|
171
|
+
|
|
172
|
+
# Write tests in test/*.test.ts
|
|
173
|
+
|
|
174
|
+
# In terminal 1 - Build tests (watch mode)
|
|
175
|
+
yarn t-build test/rectangle.test.ts dev
|
|
29
176
|
|
|
30
|
-
|
|
177
|
+
# In terminal 2 - Run tests (watch mode)
|
|
178
|
+
yarn t-run test/rectangle.test.ts dev
|
|
179
|
+
|
|
180
|
+
# Or for single-run mode:
|
|
181
|
+
yarn t-build test/rectangle.test.ts once
|
|
182
|
+
yarn t-run test/rectangle.test.ts once
|
|
183
|
+
|
|
184
|
+
# Get AI help with failures
|
|
185
|
+
yarn t-aider</pre><h2>Aider</h2>
|
|
186
|
+
<p>Testeranto generates a "prompt" alongside test results. This prompt is passed to aider as input.</p>
|
|
187
|
+
<pre>// input src files which can be edited by aider
|
|
188
|
+
/add test/node.ts
|
|
189
|
+
|
|
190
|
+
// test report files that inform aider but should not be edited
|
|
191
|
+
/read testeranto/reports/allTests/node/test/node/tests.json
|
|
192
|
+
/read testeranto/reports/allTests/test/node/node/lint_errors.json
|
|
193
|
+
/read testeranto/reports/allTests/test/node/node/type_errors.txt
|
|
194
|
+
|
|
195
|
+
// A list of features which can inform aider.
|
|
196
|
+
/load testeranto/reports/allTests/node/test/node/featurePrompt.txt
|
|
197
|
+
|
|
198
|
+
// tell the AI what to do
|
|
199
|
+
Fix the failing tests described in testeranto/reports/allTests/node/test/node/tests.json. Correct any type signature errors described in the files testeranto/reports/allTests/test/node/node/type_errors.txt. Implement any method which throws "Function not implemented. Resolve the lint errors described in testeranto/reports/allTests/test/node/node/lint_errors.json"</pre><h2>"Features"</h2>
|
|
200
|
+
<p>Testeranto connects "features" to tests. The features may be simple strings, but they can also take the form of local markdown files, or remote URLs to external feature tracking systems. For instance, this could be a jira ticket or a github issue. These features are used to inform the AI context.</p>
|
|
201
|
+
<pre class="language-typescript line-numbers"><code class="language-typescript">import someMarkdownFile from "someMarkdownFile.md";
|
|
202
|
+
|
|
203
|
+
...
|
|
204
|
+
|
|
205
|
+
test0: Given.Default(
|
|
206
|
+
[
|
|
207
|
+
"https://api.github.com/repos/adamwong246/testeranto/issues/8",
|
|
208
|
+
"you can set the width and height of a Rectangle",
|
|
209
|
+
someMarkdownFile
|
|
210
|
+
],
|
|
211
|
+
|
|
212
|
+
[When.setWidth(4), When.setHeight(19)],
|
|
213
|
+
[Then.getWidth(4), Then.getHeight(19)]
|
|
214
|
+
),
|
|
215
|
+
...
|
|
216
|
+
</code></pre><h2>Sidecars (COMING SOON)</h2>
|
|
217
|
+
<p>Along side your test, you can include a number of "sidecars" which are other bundled javascript assets upon which your test depends. For example, suppose you have an app with a frontend and backend component. You could run a react test in the web and include the node http server as a sidecar.</p>
|
|
218
|
+
<h2><code>eslint</code> and <code>tsc</code></h2>
|
|
219
|
+
<p>Alongside the bdd tests, testeranto runs eslint and tsc upon the input files to generate a list of static analysis errors and a list of type errors, respectively.</p>
|
|
220
|
+
<h2>Subprojects</h2>
|
|
221
|
+
<p>Testeranto has a core repo, but there are also subprojects which implement tests by type and by technology</p>
|
|
222
|
+
<h3>testeranto-solidity</h3>
|
|
223
|
+
<p>Test a solidity contract. Also included is an example of deploying a contrct to a ganache server.</p>
|
|
224
|
+
<h3>testeranto-reduxtoolkit</h3>
|
|
225
|
+
<p>Test a redux store.</p>
|
|
226
|
+
<h3>testeranto-http</h3>
|
|
227
|
+
<p>Test a node http server.</p>
|
|
228
|
+
<h3>testeranto-react (COMING SOON)</h3>
|
|
229
|
+
<p>Test a react component. You can choose from a variety of types (jsx functions, class style, etc) and you can test with <code>react</code>, <code>react-dom</code>, or <code>react-test-renderer</code></p>
|
|
230
|
+
<h3>testeranto-express (COMING SOON)</h3>
|
|
231
|
+
<h3>testeranto-xstate (COMING SOON)</h3>
|
|
232
|
+
|
|
233
|
+
</div>
|
|
234
|
+
<!-- Prism.js JS -->
|
|
235
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
|
|
236
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-typescript.min.js"></script>
|
|
237
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
|
|
238
|
+
<script>
|
|
239
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
240
|
+
Prism.highlightAll();
|
|
241
|
+
|
|
242
|
+
// Parallax effect
|
|
243
|
+
const parallaxBg = document.querySelector('.parallax-background');
|
|
244
|
+
window.addEventListener('scroll', function() {
|
|
245
|
+
const scrollPosition = window.pageYOffset;
|
|
246
|
+
parallaxBg.style.transform = 'translateY(scrollPosition)';
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
</script>
|
|
250
|
+
</body>
|
|
251
|
+
</html>
|
package/logo.svg
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" width="300" height="300">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="gradient1" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#FF6B6B" />
|
|
5
|
+
<stop offset="100%" stop-color="#7FB3D5" />
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="gradient2" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
8
|
+
<stop offset="0%" stop-color="#4ECDC4" />
|
|
9
|
+
<stop offset="100%" stop-color="#00B4A0" />
|
|
10
|
+
</linearGradient>
|
|
11
|
+
</defs>
|
|
12
|
+
|
|
13
|
+
<!-- Playful background shape -->
|
|
14
|
+
<path d="M50,50 Q150,20 250,50 Q280,150 250,250 Q150,280 50,250 Q20,150 50,50 Z"
|
|
15
|
+
fill="url(#gradient1)" stroke="#FF6B6B" stroke-width="4" />
|
|
16
|
+
|
|
17
|
+
<!-- Robot mascot head -->
|
|
18
|
+
<circle cx="150" cy="125" r="40" fill="#7FB3D5" stroke="#292F36" stroke-width="3" />
|
|
19
|
+
|
|
20
|
+
<!-- Robot eyes -->
|
|
21
|
+
<circle cx="130" cy="115" r="8" fill="#292F36" />
|
|
22
|
+
<circle cx="170" cy="115" r="8" fill="#292F36" />
|
|
23
|
+
|
|
24
|
+
<!-- Robot mouth (smile) -->
|
|
25
|
+
<path d="M130,135 Q150,155 170,135" fill="none" stroke="#292F36" stroke-width="3"
|
|
26
|
+
stroke-linecap="round" />
|
|
27
|
+
|
|
28
|
+
<!-- BDD elements orbiting face center (150,125) -->
|
|
29
|
+
<g>
|
|
30
|
+
|
|
31
|
+
<!-- First ball + label -->
|
|
32
|
+
<g xmlns="http://www.w3.org/2000/svg">
|
|
33
|
+
|
|
34
|
+
<circle cx="212" cy="125" r="15" fill="#E6B422" />
|
|
35
|
+
|
|
36
|
+
<text x="212" y="130" text-anchor="middle" fill="#292F36" font-family="monospace"
|
|
37
|
+
font-size="9" font-weight="bold">GIVEN</text>
|
|
38
|
+
<animateTransform attributeName="transform" type="rotate" from="0 150 125" to="360 150
|
|
39
|
+
125" dur="10s" repeatCount="indefinite" />
|
|
40
|
+
</g>
|
|
41
|
+
|
|
42
|
+
<!-- Second ball + label -->
|
|
43
|
+
<g xmlns="http://www.w3.org/2000/svg">
|
|
44
|
+
|
|
45
|
+
<circle cx="126" cy="181.6" r="15" fill="#FF6B6B" />
|
|
46
|
+
|
|
47
|
+
<text x="126" y="186.6" text-anchor="middle" fill="#292F36" font-family="monospace"
|
|
48
|
+
font-size="10" font-weight="bold">WHEN</text>
|
|
49
|
+
<animateTransform attributeName="transform" type="rotate" from="0 150 125" to="360 150
|
|
50
|
+
125" dur="10s" repeatCount="indefinite"/>
|
|
51
|
+
</g>
|
|
52
|
+
|
|
53
|
+
<!-- Third ball + label -->
|
|
54
|
+
<g xmlns="http://www.w3.org/2000/svg">
|
|
55
|
+
<circle cx="120" cy="71.4" r="15" fill="#4ECDC4"/>
|
|
56
|
+
<text x="120" y="75.4" text-anchor="middle" fill="#0A0F1F" font-family="monospace"
|
|
57
|
+
font-size="10" font-weight="bold">THEN</text>
|
|
58
|
+
<animateTransform attributeName="transform" type="rotate" from="0 150 125" to="360 150
|
|
59
|
+
125" dur="10s" repeatCount="indefinite"/>
|
|
60
|
+
</g>
|
|
61
|
+
</g>
|
|
62
|
+
|
|
63
|
+
<!-- Higher title position with more padding -->
|
|
64
|
+
<g>
|
|
65
|
+
<path id="titlePath" d="M50,220 Q150,250 250,220" fill="none" />
|
|
66
|
+
<text font-family="monospace" font-size="33" font-weight="bold" fill="#1D3557">
|
|
67
|
+
<textPath href="#titlePath" startOffset="50%" text-anchor="middle" fill="#292F36">TESTERANTO</textPath>
|
|
68
|
+
</text>
|
|
69
|
+
|
|
70
|
+
</g>
|
|
71
|
+
|
|
72
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testeranto",
|
|
3
3
|
"description": "the AI powered BDD test framework for typescript projects",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.140.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "18.18.0"
|
|
7
7
|
},
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"import": "./dist/cjs-shim.js",
|
|
18
18
|
"require": "./dist/cjs-shim.js"
|
|
19
19
|
},
|
|
20
|
+
"./src/lib": {
|
|
21
|
+
"import": "./src/lib/index.ts",
|
|
22
|
+
"require": "./src/lib/index.ts"
|
|
23
|
+
},
|
|
20
24
|
"./src/lib/abstractBase": {
|
|
21
25
|
"import": "./src/lib/abstractBase.ts",
|
|
22
26
|
"require": "./src/lib/abstractBase.ts"
|
|
@@ -127,7 +131,8 @@
|
|
|
127
131
|
"t-build": "tsx dist/prebuild/build.mjs",
|
|
128
132
|
"t-run": "tsx dist/prebuild/run.mjs",
|
|
129
133
|
"t-init": "tsx dist/prebuild/init-docs.mjs",
|
|
130
|
-
"t-report": "tsx dist/prebuild/ReportServer.mjs"
|
|
134
|
+
"t-report": "tsx dist/prebuild/ReportServer.mjs",
|
|
135
|
+
"build-docs": "node scripts/compile-docs.js"
|
|
131
136
|
},
|
|
132
137
|
"peerDependencies": {
|
|
133
138
|
"@types/react": "18.2.0",
|
|
@@ -153,6 +158,7 @@
|
|
|
153
158
|
"@types/ws": "^8.5.10",
|
|
154
159
|
"@typescript-eslint/eslint-plugin": "^5.46.0",
|
|
155
160
|
"@typescript-eslint/parser": "^5.46.0",
|
|
161
|
+
"marked": "^12.0.2",
|
|
156
162
|
"testeranto-solidity": "latest",
|
|
157
163
|
"testeranto_with_reduxjs_toolkit": "latest",
|
|
158
164
|
"ts-node": "^10.9.1",
|
|
@@ -177,6 +183,7 @@
|
|
|
177
183
|
"esbuild-plugin-markdown": "^0.0.3",
|
|
178
184
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
|
179
185
|
"eslint": "^9.23.0",
|
|
186
|
+
"eslint-formatter-compact": "^8.40.0",
|
|
180
187
|
"eslint-plugin-import": "^2.31.0",
|
|
181
188
|
"eslint-plugin-react": "^7.31.11",
|
|
182
189
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
@@ -187,6 +194,8 @@
|
|
|
187
194
|
"is-path-inside": "^4.0.0",
|
|
188
195
|
"iterm-tab": "^0.4.0",
|
|
189
196
|
"live-server": "^1.2.2",
|
|
197
|
+
"mermaid": "^11.8.1",
|
|
198
|
+
"mermaid-isomorphic": "^3.0.4",
|
|
190
199
|
"node-static": "^0.7.11",
|
|
191
200
|
"octokit": "^4.1.2",
|
|
192
201
|
"puppeteer": "^24.4.0",
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { marked } from "marked";
|
|
4
|
+
|
|
5
|
+
marked.use({
|
|
6
|
+
renderer: {
|
|
7
|
+
code: function (code, lang) {
|
|
8
|
+
if (lang == "mermaid") return `<pre class="mermaid">${code}</pre>`;
|
|
9
|
+
if (lang == "typescript")
|
|
10
|
+
return `<pre class="language-typescript line-numbers"><code class="language-typescript">${code}</code></pre>`;
|
|
11
|
+
return `<pre>${code}</pre>`;
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Simple HTML template with our CSS
|
|
17
|
+
const template = (title, content) => `
|
|
18
|
+
<!DOCTYPE html>
|
|
19
|
+
<html lang="en">
|
|
20
|
+
<head>
|
|
21
|
+
<meta charset="UTF-8">
|
|
22
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
23
|
+
<title>${title}</title>
|
|
24
|
+
|
|
25
|
+
<!-- Prism.js CSS -->
|
|
26
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
|
|
27
|
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.css" rel="stylesheet" />
|
|
28
|
+
|
|
29
|
+
<!-- load style AFTER prism -->
|
|
30
|
+
<link rel="stylesheet" href="style.css">
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
</head>
|
|
34
|
+
<body>
|
|
35
|
+
<div class="parallax-background"></div>
|
|
36
|
+
<div id="container">
|
|
37
|
+
${content.replace(/<p>⚠️(.*?)<\/p>/g, '<div class="warning">$1</div>')}
|
|
38
|
+
</div>
|
|
39
|
+
<!-- Prism.js JS -->
|
|
40
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
|
|
41
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-typescript.min.js"></script>
|
|
42
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
|
|
43
|
+
<script>
|
|
44
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
45
|
+
Prism.highlightAll();
|
|
46
|
+
|
|
47
|
+
// Parallax effect
|
|
48
|
+
const parallaxBg = document.querySelector('.parallax-background');
|
|
49
|
+
window.addEventListener('scroll', function() {
|
|
50
|
+
const scrollPosition = window.pageYOffset;
|
|
51
|
+
parallaxBg.style.transform = 'translateY(scrollPosition)';
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
// Process markdown files
|
|
60
|
+
const processFile = (filePath) => {
|
|
61
|
+
const markdown = fs.readFileSync(filePath, "utf8");
|
|
62
|
+
return template(path.basename(filePath), marked.parse(markdown));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Main function
|
|
66
|
+
const main = () => {
|
|
67
|
+
try {
|
|
68
|
+
// Create docs-output directory if it doesn't exist
|
|
69
|
+
const outDir = "./";
|
|
70
|
+
if (!fs.existsSync(outDir)) {
|
|
71
|
+
fs.mkdirSync(outDir);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Process README.md -> documentation.html
|
|
75
|
+
const readmeHtml = processFile("README.md");
|
|
76
|
+
fs.writeFileSync(path.join(outDir, "index.html"), readmeHtml);
|
|
77
|
+
console.log("Generated: index.html");
|
|
78
|
+
|
|
79
|
+
// Process docs/index.md -> api-reference.html
|
|
80
|
+
const docsHtml = processFile("docs/index.md");
|
|
81
|
+
fs.writeFileSync(path.join(outDir, "docs.html"), docsHtml);
|
|
82
|
+
console.log("Generated: docs.html");
|
|
83
|
+
} catch (err) {
|
|
84
|
+
console.error("Error compiling docs:", err);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
main();
|
package/src/CoreTypes.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { ITTestResourceConfiguration } from "./lib";
|
|
3
|
+
|
|
4
|
+
import { IPM, ITestCheckCallback } from "./lib/types";
|
|
5
|
+
import {
|
|
6
|
+
GivenSpecification,
|
|
7
|
+
WhenSpecification,
|
|
8
|
+
ThenSpecification,
|
|
9
|
+
TestWhenImplementation,
|
|
10
|
+
Modify,
|
|
11
|
+
TestSuiteImplementation,
|
|
12
|
+
TestGivenImplementation,
|
|
13
|
+
TestThenImplementation,
|
|
14
|
+
TestCheckImplementation,
|
|
15
|
+
TestSuiteShape,
|
|
16
|
+
TestGivenShape,
|
|
17
|
+
TestWhenShape,
|
|
18
|
+
TestThenShape,
|
|
19
|
+
TestCheckShape,
|
|
20
|
+
SuiteSpecification,
|
|
21
|
+
} from "./Types";
|
|
22
|
+
|
|
23
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
24
|
+
|
|
25
|
+
export type ITestInterface<I extends Ibdd_in_any> = {
|
|
26
|
+
assertThis: (x: I["then"]) => any;
|
|
27
|
+
andWhen: (
|
|
28
|
+
store: I["istore"],
|
|
29
|
+
whenCB: I["when"],
|
|
30
|
+
testResource: ITTestResourceConfiguration,
|
|
31
|
+
pm: IPM
|
|
32
|
+
) => Promise<I["istore"]>;
|
|
33
|
+
butThen: (
|
|
34
|
+
store: I["istore"],
|
|
35
|
+
thenCB: I["then"],
|
|
36
|
+
testResource: ITTestResourceConfiguration,
|
|
37
|
+
pm: IPM
|
|
38
|
+
) => Promise<I["iselection"]>;
|
|
39
|
+
afterAll: (store: I["istore"], pm: IPM) => any;
|
|
40
|
+
afterEach: (store: I["istore"], key: string, pm: IPM) => Promise<unknown>;
|
|
41
|
+
beforeAll: (
|
|
42
|
+
input: I["iinput"],
|
|
43
|
+
testResource: ITTestResourceConfiguration,
|
|
44
|
+
pm: IPM
|
|
45
|
+
) => Promise<I["isubject"]>;
|
|
46
|
+
beforeEach: (
|
|
47
|
+
subject: I["isubject"],
|
|
48
|
+
initializer: (c?) => I["given"],
|
|
49
|
+
testResource: ITTestResourceConfiguration,
|
|
50
|
+
initialValues,
|
|
51
|
+
pm: IPM
|
|
52
|
+
) => Promise<I["istore"]>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
56
|
+
|
|
57
|
+
export type ITestSpecification<
|
|
58
|
+
I extends Ibdd_in_any,
|
|
59
|
+
O extends Ibdd_out_any
|
|
60
|
+
> = (
|
|
61
|
+
Suite: SuiteSpecification<I, O>,
|
|
62
|
+
Given: GivenSpecification<I, O>,
|
|
63
|
+
When: WhenSpecification<I, O>,
|
|
64
|
+
Then: ThenSpecification<I, O>,
|
|
65
|
+
Check: ITestCheckCallback<I, O>
|
|
66
|
+
) => any[];
|
|
67
|
+
|
|
68
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
69
|
+
|
|
70
|
+
export type ITestImplementation<
|
|
71
|
+
I extends Ibdd_in_any,
|
|
72
|
+
O extends Ibdd_out_any,
|
|
73
|
+
modifier = {
|
|
74
|
+
whens: TestWhenImplementation<I, O>;
|
|
75
|
+
}
|
|
76
|
+
> = Modify<
|
|
77
|
+
{
|
|
78
|
+
suites: TestSuiteImplementation<O>;
|
|
79
|
+
givens: TestGivenImplementation<I, O>;
|
|
80
|
+
whens: TestWhenImplementation<I, O>;
|
|
81
|
+
thens: TestThenImplementation<I, O>;
|
|
82
|
+
checks: TestCheckImplementation<I, O>;
|
|
83
|
+
},
|
|
84
|
+
modifier
|
|
85
|
+
>;
|
|
86
|
+
|
|
87
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
88
|
+
|
|
89
|
+
export type Ibdd_out<
|
|
90
|
+
ISuites extends TestSuiteShape = TestSuiteShape,
|
|
91
|
+
IGivens extends TestGivenShape = TestGivenShape,
|
|
92
|
+
IWhens extends TestWhenShape = TestWhenShape,
|
|
93
|
+
IThens extends TestThenShape = TestThenShape,
|
|
94
|
+
IChecks extends TestCheckShape = TestCheckShape
|
|
95
|
+
> = {
|
|
96
|
+
suites: ISuites;
|
|
97
|
+
givens: IGivens;
|
|
98
|
+
whens: IWhens;
|
|
99
|
+
thens: IThens;
|
|
100
|
+
checks: IChecks;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type Ibdd_out_any = Ibdd_out<
|
|
104
|
+
TestSuiteShape,
|
|
105
|
+
TestGivenShape,
|
|
106
|
+
TestWhenShape,
|
|
107
|
+
TestThenShape,
|
|
108
|
+
TestCheckShape
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
/////////////////////////////////////////////////////////////////////////////////////////
|
|
112
|
+
|
|
113
|
+
export type Ibdd_in<
|
|
114
|
+
IInput, // Type of initial test input
|
|
115
|
+
ISubject, // Type of object being tested
|
|
116
|
+
IStore, // Type for storing test state between steps
|
|
117
|
+
ISelection, // Type for selecting state for assertions
|
|
118
|
+
IGiven, // Type for Given step functions
|
|
119
|
+
IWhen, // Type for When step functions
|
|
120
|
+
IThen // Type for Then step functions
|
|
121
|
+
> = {
|
|
122
|
+
/** Initial input required to start tests */
|
|
123
|
+
iinput: IInput;
|
|
124
|
+
|
|
125
|
+
/** The subject being tested (class, function, etc) */
|
|
126
|
+
isubject: ISubject;
|
|
127
|
+
|
|
128
|
+
/** Complete test state storage */
|
|
129
|
+
istore: IStore;
|
|
130
|
+
|
|
131
|
+
/** Selected portion of state for assertions */
|
|
132
|
+
iselection: ISelection;
|
|
133
|
+
|
|
134
|
+
/** Function type for Given steps */
|
|
135
|
+
given: IGiven;
|
|
136
|
+
|
|
137
|
+
/** Function type for When steps */
|
|
138
|
+
when: IWhen;
|
|
139
|
+
|
|
140
|
+
/** Function type for Then steps */
|
|
141
|
+
then: IThen;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type Ibdd_in_any = Ibdd_in<
|
|
145
|
+
unknown,
|
|
146
|
+
unknown,
|
|
147
|
+
unknown,
|
|
148
|
+
unknown,
|
|
149
|
+
unknown,
|
|
150
|
+
unknown,
|
|
151
|
+
unknown
|
|
152
|
+
>;
|
package/src/Init.ts
CHANGED
|
@@ -25,10 +25,10 @@ export default async () => {
|
|
|
25
25
|
`testeranto/Project.js`
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
fs.copyFileSync(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
);
|
|
28
|
+
// fs.copyFileSync(
|
|
29
|
+
// `node_modules/testeranto/dist/prebuild/ReportClient.js`,
|
|
30
|
+
// `testeranto/ReportClient.js`
|
|
31
|
+
// );
|
|
32
32
|
|
|
33
33
|
fs.copyFileSync(
|
|
34
34
|
`node_modules/testeranto/dist/prebuild/Project.css`,
|