@autometa/runner 0.3.3 → 0.4.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +123 -2
  3. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @autometa/runner
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7e9d2bc: feat: Table Documents
8
+
9
+ Introduces a new way of handling tables which are horizontal (HTable) or vertical (VTable) which maps
10
+ the headers of a table to an object properties, defined using a class.
11
+
12
+ [docs](https://bendat.github.io/autometa/docs/cucumber/test_runner/datatables#table-documents)
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [7e9d2bc]
17
+ - @autometa/gherkin@0.6.0
18
+ - @autometa/scopes@0.5.0
19
+ - @autometa/http@1.4.0
20
+ - @autometa/test-builder@0.2.1
21
+ - @autometa/coordinator@0.3.3
22
+ - @autometa/events@0.2.12
23
+ - @autometa/jest-executor@0.4.3
24
+
3
25
  ## 0.3.3
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -1,3 +1,124 @@
1
- # Introduction
1
+ # Autometa
2
2
 
3
- There's nothing here yet
3
+ [Full Docs](https://bendat.github.io/autometa/docs/cucumber/test_runner/intro/)
4
+
5
+ # NOTICE
6
+
7
+ Autometa is under construction. It is currently unstable, poorly documented and not production ready for most cases.
8
+
9
+ Check back soon.
10
+
11
+ The following libraries may be considered relatively stable, but may contain bugs or unclear errors
12
+
13
+ - [Overloaded](libraries/overloaded/) - Function and method overloads that are as pleasant to make as they are to use
14
+ - [Bind Decorator](libraries/bind-decorator/) - Binds the `this` keyword on a class method. Respectfully a fork of [bind-decorator](https://www.npmjs.com/package/autobind-decorator)
15
+ - [Status Codes](libraries/status-codes/) - Object containing HTTP status
16
+ codes and status messages, visible in the editor via `as const`
17
+
18
+ # Autometa
19
+
20
+ _Autometa_ is an early-development automation framework toolkit, which provides libraries to help automate the automation process on node with libraries to
21
+ help bootstrap your node automation framework, for API or E2E testing.
22
+
23
+ [Full Docs](https://bendat.github.io/autometa/docs/cucumber/test_runner/intro/)
24
+
25
+
26
+ ## Cucumber Runner
27
+
28
+ The Cucumber Runner lets you build and execute Cucumber style tests with alternative test runners. Currently supported are `jest` and `vitest`. Mocha
29
+ likely works but has not been tested.
30
+
31
+ Initially inspired by [jest-cucumber](github.com/bencompton/jest-cucumber) provides a customizable hybrid approach between cucumbers flat global steps
32
+ and jest-cucumbers nested spec-like tests.
33
+
34
+ Dependency injection is supported to make initializing client classes needed to interface with your service or website simple and logic-free, with unique copies
35
+ provided to each executing tests.
36
+
37
+ ```ts title='Cucumber like'
38
+ import { Feature, Given, When, Then, Before } from "@autometa/cucumber-runner";
39
+ import { App } from "./my-app";
40
+ import * as seedData from "./seed-data";
41
+
42
+ Before("Seed the database", async ({ dbClient }: App) => {
43
+ await dbClient.seed(seedData);
44
+ });
45
+ Given("a user who wants to log in", () => {});
46
+ When("a user submits their credentials", () => {});
47
+ Then("a user sees their", () => {});
48
+
49
+ // tests assembled automatically
50
+ Feature("./my-feature.feature");
51
+ ```
52
+
53
+ Steps can also be nested or groups to override higher level
54
+ steps.
55
+
56
+ ```ts title='Jest-Cucumber like'
57
+ import {
58
+ Feature,
59
+ Given,
60
+ When,
61
+ Then,
62
+ Before,
63
+ ScenarioOutline,
64
+ Scenario,
65
+ Rule,
66
+ } from "@autometa/cucumber-runner";
67
+ import { App } from "./my-app";
68
+ import * as seedData from "./seed-data";
69
+
70
+ Before("Seed the database", async ({ dbClient }: App) => {
71
+ await dbClient.seed(seedData);
72
+ });
73
+ Given("a user who wants to log in", () => {});
74
+ When("a user submits their credentials", () => {});
75
+
76
+ Feature(() => {
77
+ Scenario("a user logs in successfully", () => {
78
+ Then("a user sees their profile", () => {});
79
+ });
80
+
81
+ Scenario("a user cannot log in without a password", () => {
82
+ Then(
83
+ "a user is informed they cannot log in",
84
+ (expectedError: string) => {}
85
+ );
86
+ });
87
+ Rule("a rule", () => {
88
+ ScenarioOutline("some outline", () => {
89
+ // define steps unique to `some outline`
90
+ });
91
+ });
92
+ }, "./my-feature.feature");
93
+ ```
94
+
95
+ ## Dto Builder
96
+
97
+ Implementation of the Builder pattern that allows automatically generating
98
+ builder classes from a DTO class prototype, with type-safe builder methods in
99
+ place of DTO properties.
100
+
101
+ ```ts
102
+ import { dto, Builder } from '@autometa/dto-builder'
103
+ export class UserDto {
104
+ id: number
105
+ username: string,
106
+ // default values, factories, dtos
107
+ @DTO.dto(AddressDto)
108
+ address: AddressDto
109
+ @DTO.date()
110
+ createdAt: Date
111
+ }
112
+ // or
113
+ // avoid duplicating interface properties
114
+ export class UserDto extends DTO<IUser> {}
115
+
116
+ const UserDtoBuilder = Builder(UserDto);
117
+
118
+ const user = new UserDtoBuilder().id(1).name('bob').build()
119
+
120
+ // compilation error, 'first argument of "id" must be a number"
121
+ new UserDtoBuilder().id('1').name('bob').build()
122
+ // force it to pass a string
123
+ new UserDtoBuilder().id('1' as unknown as number).name('bob').build()
124
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autometa/runner",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -34,20 +34,20 @@
34
34
  "@autometa/asserters": "^0.1.8",
35
35
  "@autometa/bind-decorator": "^0.5.1",
36
36
  "@autometa/config": "^0.1.21",
37
- "@autometa/coordinator": "^0.3.2",
37
+ "@autometa/coordinator": "^0.3.3",
38
38
  "@autometa/cucumber-expressions": "^0.3.11",
39
39
  "@autometa/datetime": "^0.1.16",
40
40
  "@autometa/errors": "^0.2.2",
41
- "@autometa/events": "^0.2.11",
41
+ "@autometa/events": "^0.2.12",
42
42
  "@autometa/file-proxies": "^0.1.0",
43
43
  "@autometa/fixture-proxies": "^0.1.3",
44
- "@autometa/gherkin": "^0.5.8",
45
- "@autometa/http": "^1.3.0",
44
+ "@autometa/gherkin": "^0.6.0",
45
+ "@autometa/http": "^1.4.0",
46
46
  "@autometa/injection": "^0.1.1",
47
- "@autometa/jest-executor": "^0.4.2",
47
+ "@autometa/jest-executor": "^0.4.3",
48
48
  "@autometa/phrases": "^0.1.12",
49
- "@autometa/scopes": "^0.4.14",
50
- "@autometa/test-builder": "^0.2.0",
49
+ "@autometa/scopes": "^0.5.0",
50
+ "@autometa/test-builder": "^0.2.1",
51
51
  "@autometa/types": "^0.4.1",
52
52
  "@cucumber/cucumber-expressions": "^16.1.2",
53
53
  "colors-cli": "^1.0.32"
@@ -61,5 +61,5 @@
61
61
  "build": "tsup",
62
62
  "build:watch": "tsup --watch"
63
63
  },
64
- "readme": "# Introduction\n\nThere's nothing here yet"
64
+ "readme": "# Autometa\n\n[Full Docs](https://bendat.github.io/autometa/docs/cucumber/test_runner/intro/)\n\n# NOTICE\n\nAutometa is under construction. It is currently unstable, poorly documented and not production ready for most cases.\n\nCheck back soon.\n\nThe following libraries may be considered relatively stable, but may contain bugs or unclear errors\n\n- [Overloaded](libraries/overloaded/) - Function and method overloads that are as pleasant to make as they are to use\n- [Bind Decorator](libraries/bind-decorator/) - Binds the `this` keyword on a class method. Respectfully a fork of [bind-decorator](https://www.npmjs.com/package/autobind-decorator)\n- [Status Codes](libraries/status-codes/) - Object containing HTTP status\ncodes and status messages, visible in the editor via `as const`\n\n# Autometa\n\n_Autometa_ is an early-development automation framework toolkit, which provides libraries to help automate the automation process on node with libraries to\nhelp bootstrap your node automation framework, for API or E2E testing.\n\n[Full Docs](https://bendat.github.io/autometa/docs/cucumber/test_runner/intro/)\n\n\n## Cucumber Runner\n\nThe Cucumber Runner lets you build and execute Cucumber style tests with alternative test runners. Currently supported are `jest` and `vitest`. Mocha\nlikely works but has not been tested.\n\nInitially inspired by [jest-cucumber](github.com/bencompton/jest-cucumber) provides a customizable hybrid approach between cucumbers flat global steps\nand jest-cucumbers nested spec-like tests.\n\nDependency injection is supported to make initializing client classes needed to interface with your service or website simple and logic-free, with unique copies\nprovided to each executing tests.\n\n```ts title='Cucumber like'\nimport { Feature, Given, When, Then, Before } from \"@autometa/cucumber-runner\";\nimport { App } from \"./my-app\";\nimport * as seedData from \"./seed-data\";\n\nBefore(\"Seed the database\", async ({ dbClient }: App) => {\n await dbClient.seed(seedData);\n});\nGiven(\"a user who wants to log in\", () => {});\nWhen(\"a user submits their credentials\", () => {});\nThen(\"a user sees their\", () => {});\n\n// tests assembled automatically\nFeature(\"./my-feature.feature\");\n```\n\nSteps can also be nested or groups to override higher level\nsteps.\n\n```ts title='Jest-Cucumber like'\nimport {\n Feature,\n Given,\n When,\n Then,\n Before,\n ScenarioOutline,\n Scenario,\n Rule,\n} from \"@autometa/cucumber-runner\";\nimport { App } from \"./my-app\";\nimport * as seedData from \"./seed-data\";\n\nBefore(\"Seed the database\", async ({ dbClient }: App) => {\n await dbClient.seed(seedData);\n});\nGiven(\"a user who wants to log in\", () => {});\nWhen(\"a user submits their credentials\", () => {});\n\nFeature(() => {\n Scenario(\"a user logs in successfully\", () => {\n Then(\"a user sees their profile\", () => {});\n });\n\n Scenario(\"a user cannot log in without a password\", () => {\n Then(\n \"a user is informed they cannot log in\",\n (expectedError: string) => {}\n );\n });\n Rule(\"a rule\", () => {\n ScenarioOutline(\"some outline\", () => {\n // define steps unique to `some outline`\n });\n });\n}, \"./my-feature.feature\");\n```\n\n## Dto Builder\n\nImplementation of the Builder pattern that allows automatically generating\nbuilder classes from a DTO class prototype, with type-safe builder methods in\nplace of DTO properties.\n\n```ts\nimport { dto, Builder } from '@autometa/dto-builder'\nexport class UserDto {\n id: number\n username: string,\n // default values, factories, dtos\n @DTO.dto(AddressDto)\n address: AddressDto\n @DTO.date()\n createdAt: Date\n}\n// or \n// avoid duplicating interface properties\nexport class UserDto extends DTO<IUser> {}\n\nconst UserDtoBuilder = Builder(UserDto);\n\nconst user = new UserDtoBuilder().id(1).name('bob').build()\n\n// compilation error, 'first argument of \"id\" must be a number\"\n new UserDtoBuilder().id('1').name('bob').build()\n // force it to pass a string\n new UserDtoBuilder().id('1' as unknown as number).name('bob').build()\n```\n"
65
65
  }