Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,55 @@
- Nock AWS - Helper to mock AWS API calls
- YAML - YAML parse with extra tags

## Build

From the repository root:

1. **Install dependencies** (once):

```bash
npm install
```

2. **Build the whole monorepo** — runs dependency packages first (`log`, `assert`, `type-guard`, `dtc`), then every workspace that defines a `build` script:

```bash
npm run build
```

3. **Build one package** — use the `name` from that package’s `package.json`:

```bash
npm run build --workspace @cgauge/dtc
npm run build --workspace @cgauge/dtc-aws-plugin
```

4. **Clean generated `dist` directories** (excluding `node_modules`):

```bash
npm run clean
```

5. **Run tests** in all workspaces that define a `test` script:

```bash
npm test
```

6. **Run tests for a single workspace** — use the package `name` from that workspace’s `package.json`:

```bash
npm test --workspace @cgauge/dtc
npm test --workspace @cgauge/dtc-aws-plugin
```

Or from inside that package’s directory:

```bash
cd dtc
npm test
```

## Contributing

Contributions are always welcome, please have a look at our issues to see if there's something you could help with.
Expand Down
4 changes: 2 additions & 2 deletions assert/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/assert",
"version": "0.25.0",
"version": "0.26.0",
"description": "Extra assert library",
"type": "module",
"repository": {
Expand All @@ -13,7 +13,7 @@
"dist"
],
"dependencies": {
"@cgauge/log": "^0.25.0"
"@cgauge/log": "^0.26.0"
},
"author": "Abdala Cerqueira",
"license": "LGPL-3.0-or-later",
Expand Down
12 changes: 6 additions & 6 deletions dtc-aws-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-aws-plugin",
"version": "0.25.0",
"version": "0.26.0",
"description": "AWS plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand All @@ -22,11 +22,11 @@
"@aws-sdk/client-sns": "^3.645.0",
"@aws-sdk/lib-dynamodb": "^3.645.0",
"@aws-sdk/util-dynamodb": "^3.645.0",
"@cgauge/assert": "^0.25.0",
"@cgauge/dtc": "^0.25.0",
"@cgauge/log": "^0.25.0",
"@cgauge/nock-aws": "^0.25.0",
"@cgauge/type-guard": "^0.25.0"
"@cgauge/assert": "^0.26.0",
"@cgauge/dtc": "^0.26.0",
"@cgauge/log": "^0.26.0",
"@cgauge/nock-aws": "^0.26.0",
"@cgauge/type-guard": "^0.26.0"
},
"scripts": {
"build": "tsc --build --verbose",
Expand Down
4 changes: 2 additions & 2 deletions dtc-aws-plugin/src/dynamo-db-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ export const arrange = async (args: unknown) => {
throw new Error(`(DynamoDB) Invalid argument on arrange: ${mismatch[0]}`)
}

await Promise.all(args.dynamodb.map(executeDynamoStatement))
const result = await Promise.all(args.dynamodb.map(executeDynamoStatement))

return true
return result
}

export const act = async (args: unknown): Promise<boolean> => {
Expand Down
8 changes: 5 additions & 3 deletions dtc-aws-plugin/src/rds-data-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export const arrange = async (args: unknown) => {
throw new Error(`(RDS Data) Invalid argument on arrange: ${mismatch[0]}`)
}

await Promise.all(args.rds.map((v) => executeStatement(v as RDSDataCallSql)))
const result = await Promise.all(args.rds.map((v) => executeStatement(v as RDSDataCallSql)))

return true
return result
}

export const act = async (args: unknown): Promise<boolean> => {
Expand Down Expand Up @@ -92,7 +92,9 @@ export const clean = async (args: unknown) => {
throw new Error(`(RDS Data) Invalid argument on clean: ${mismatch[0]}`)
}

await Promise.all(args.rds.map((v) => executeStatement(v as RDSDataCallSql)))
for (const statement of args.rds) {
await executeStatement(statement as RDSDataCallSql)
}

return true
}
10 changes: 5 additions & 5 deletions dtc-graphql-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-graphql-plugin",
"version": "0.25.0",
"version": "0.26.0",
"description": "GraphQl plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand All @@ -15,10 +15,10 @@
"author": "Salam Suleymanov",
"license": "LGPL-3.0-or-later",
"dependencies": {
"@cgauge/assert": "^0.25.0",
"@cgauge/dtc": "^0.25.0",
"@cgauge/type-guard": "^0.25.0",
"@cgauge/log": "^0.25.0",
"@cgauge/assert": "^0.26.0",
"@cgauge/dtc": "^0.26.0",
"@cgauge/type-guard": "^0.26.0",
"@cgauge/log": "^0.26.0",
"graphql-request": "^7.1.2"
},
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions dtc-mysql-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-mysql-plugin",
"version": "0.25.0",
"version": "0.26.0",
"description": "MySQL plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand All @@ -15,10 +15,10 @@
"author": "Abdala Cerqueira",
"license": "LGPL-3.0-or-later",
"dependencies": {
"@cgauge/assert": "^0.25.0",
"@cgauge/dtc": "^0.25.0",
"@cgauge/log": "^0.25.0",
"@cgauge/type-guard": "^0.25.0",
"@cgauge/assert": "^0.26.0",
"@cgauge/dtc": "^0.26.0",
"@cgauge/log": "^0.26.0",
"@cgauge/type-guard": "^0.26.0",
"mysql2": "^3.11.0",
"node-sql-parser": "^5.1.0",
"type-assurance": "^1.5.1"
Expand Down
10 changes: 5 additions & 5 deletions dtc-playwright-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-playwright-plugin",
"version": "0.25.0",
"version": "0.26.0",
"description": "Playwright plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand All @@ -15,10 +15,10 @@
"author": "Abdala Cerqueira",
"license": "LGPL-3.0-or-later",
"dependencies": {
"@cgauge/assert": "^0.25.0",
"@cgauge/dtc": "^0.25.0",
"@cgauge/log": "^0.25.0",
"@cgauge/type-guard": "^0.25.0",
"@cgauge/assert": "^0.26.0",
"@cgauge/dtc": "^0.26.0",
"@cgauge/log": "^0.26.0",
"@cgauge/type-guard": "^0.26.0",
"@playwright/test": "^1.47.0"
},
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions dtc-redis-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-redis-plugin",
"version": "0.25.0",
"version": "0.26.0",
"description": "Plugin to mock redis",
"repository": {
"type": "git",
Expand All @@ -15,9 +15,9 @@
"author": "Salam Suleymanov",
"license": "LGPL-3.0-or-later",
"dependencies": {
"@cgauge/assert": "^0.25.0",
"@cgauge/dtc": "^0.25.0",
"@cgauge/type-guard": "^0.25.0"
"@cgauge/assert": "^0.26.0",
"@cgauge/dtc": "^0.26.0",
"@cgauge/type-guard": "^0.26.0"
},
"devDependencies": {
"ioredis": "^5.6.1"
Expand Down
8 changes: 4 additions & 4 deletions dtc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc",
"version": "0.25.0",
"version": "0.26.0",
"description": "Declarative TestCases",
"repository": {
"type": "git",
Expand All @@ -18,9 +18,9 @@
"author": "Abdala Cerqueira",
"license": "LGPL-3.0-or-later",
"dependencies": {
"@cgauge/assert": "^0.25.0",
"@cgauge/log": "^0.25.0",
"@cgauge/type-guard": "^0.25.0",
"@cgauge/assert": "^0.26.0",
"@cgauge/log": "^0.26.0",
"@cgauge/type-guard": "^0.26.0",
"cleye": "^1.3.2",
"nock": "^14.0.1"
},
Expand Down
15 changes: 11 additions & 4 deletions dtc/src/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type RequireAtLeastOne<T> = {
}[keyof T]

export type Plugin = RequireAtLeastOne<{
arrange(args: unknown, basePath: string, testRunnerArgs?: unknown): Promise<boolean>
act(args: unknown, basePath: string, testRunnerArgs?: unknown): Promise<boolean>
assert(args: unknown, basePath: string, testRunnerArgs?: unknown): Promise<boolean>
clean(args: unknown, basePath: string, testRunnerArgs?: unknown): Promise<boolean>
arrange(args: unknown, basePath: string, testRunnerArgs?: unknown, context?: unknown): Promise<unknown>
act(args: unknown, basePath: string, testRunnerArgs?: unknown, context?: unknown): Promise<unknown>
assert(args: unknown, basePath: string, testRunnerArgs?: unknown, context?: unknown): Promise<unknown>
clean(args: unknown, basePath: string, testRunnerArgs?: unknown, context?: unknown): Promise<unknown>
}>

export type TestCasePhases = 'arrange' | 'act' | 'assert' | 'clean'
Expand Down Expand Up @@ -71,3 +71,10 @@ export type TestCaseExecution = {
testCase: TestCase,
resolvedLayers?: Layer[]
}

export type Output = {
arrange: Record<string, unknown>
act: Record<string, unknown>
assert: Record<string, unknown>
clean: Record<string, unknown>
}
Loading
Loading