diff --git a/.prettierignore b/.prettierignore index d973ca8..ed95976 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,5 @@ /.github/ /.makefiles/ /artifacts/ -/test/fixture/specification/ -/ENVIRONMENT.md +/CHANGELOG.md +/test/fixture/specification/no-prettier/ diff --git a/.prettierrc.json b/.prettierrc.json index 55c1943..4de95c7 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,3 +1,12 @@ { - "plugins": ["prettier-plugin-organize-imports"] + "plugins": ["prettier-plugin-organize-imports"], + "overrides": [ + { + "files": "*.md", + "options": { + "printWidth": 80, + "proseWrap": "always" + } + } + ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ae3a58..28870f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog], and this project adheres to -[Semantic Versioning]. +The format is based on [Keep a Changelog], and this project adheres to [Semantic +Versioning]. [keep a changelog]: https://keepachangelog.com/en/1.0.0/ [semantic versioning]: https://semver.org/spec/v2.0.0.html @@ -39,8 +39,8 @@ The format is based on [Keep a Changelog], and this project adheres to ### Changed -- **\[BREAKING\]** Explicit examples must be provided in a declaration if - the declaration uses constraints that would make the auto-generated examples +- **\[BREAKING\]** Explicit examples must be provided in a declaration if the + declaration uses constraints that would make the auto-generated examples invalid. ## [v0.8.0] - 2024-03-23 diff --git a/ENVIRONMENT.md b/ENVIRONMENT.md index bc297c0..eaa6cf2 100644 --- a/ENVIRONMENT.md +++ b/ENVIRONMENT.md @@ -1,6 +1,7 @@ # Environment variables -The `example` app uses **declarative environment variables** powered by **[Austenite]**. +The `example` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -30,7 +31,8 @@ The `example` app uses **declarative environment variables** powered by **[Auste _CDN to use when serving static assets_ -The `CDN_URL` variable is a **required** variable that takes **absolute URL** values, with these constraints: +The `CDN_URL` variable is a **required** variable that takes **absolute URL** +values, with these constraints: - Protocol must be `http:` or `https:` @@ -70,7 +72,8 @@ export DEBUG=false # false _Number of atoms on earth_ -The `EARTH_ATOM_COUNT` variable is an **optional** variable that takes **big integer** values. +The `EARTH_ATOM_COUNT` variable is an **optional** variable that takes **big +integer** values. ### Example values @@ -98,7 +101,8 @@ export EARTH_ATOM_COUNT=0b11110001001000000 # binary _GRPC request timeout_ -The `GRPC_TIMEOUT` variable is an **optional** variable that takes **ISO 8601 duration** values, with these constraints: +The `GRPC_TIMEOUT` variable is an **optional** variable that takes **ISO 8601 +duration** values, with these constraints: - Must be >= PT0.1S and <= PT10S @@ -116,7 +120,8 @@ export GRPC_TIMEOUT=PT5S # 5 seconds _The minimum log level to record_ -The `LOG_LEVEL` variable is an **optional** variable that takes `debug`, `info`, `warn`, `error`, or `fatal`. +The `LOG_LEVEL` variable is an **optional** variable that takes `debug`, `info`, +`warn`, `error`, or `fatal`. ### Default value @@ -150,7 +155,8 @@ export LOG_LEVEL=fatal # the application cannot proceed _Listen port for the HTTP server_ -The `PORT` variable is an **optional** variable that takes **port number** values. +The `PORT` variable is an **optional** variable that takes **port number** +values. ### Default value @@ -168,7 +174,8 @@ export PORT=12345 # a port number _Database connection string for read-models_ -The `READ_DSN` variable is a **required** variable that takes **string** values, with these constraints: +The `READ_DSN` variable is a **required** variable that takes **string** values, +with these constraints: - Must have a minimum length of 30 @@ -182,7 +189,8 @@ export READ_DSN='host=localhost dbname=readmodels user=projector' # local databa _Kubernetes `redis-primary` service host_ -The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes **hostname** values. +The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes +**hostname** values. ### Example values @@ -198,7 +206,8 @@ export REDIS_PRIMARY_SERVICE_HOST=10.0.0.11 # an IP address _Kubernetes `redis-primary` service port_ -The `REDIS_PRIMARY_SERVICE_PORT` variable is a **required** variable that takes **port number** values. +The `REDIS_PRIMARY_SERVICE_PORT` variable is a **required** variable that takes +**port number** values. ### Example values @@ -210,7 +219,8 @@ export REDIS_PRIMARY_SERVICE_PORT=12345 # a port number _Ratio of requests to sample_ -The `SAMPLE_RATIO` variable is an **optional** variable that takes **number** values. +The `SAMPLE_RATIO` variable is an **optional** variable that takes **number** +values. ### Example values @@ -246,7 +256,8 @@ export SAMPLE_RATIO=0b11110001001000000 # binary _Session token signing key_ -The `SESSION_KEY` variable is a **required** variable that takes **base64** values. +The `SESSION_KEY` variable is a **required** variable that takes **base64** +values. ### Example values @@ -258,7 +269,8 @@ export SESSION_KEY=Y29ucXVpc3RhZG9y # base64 encoded string _Weighting for this node_ -The `WEIGHT` variable is a **required** variable that takes **integer** values, with these constraints: +The `WEIGHT` variable is a **required** variable that takes **integer** values, +with these constraints: - Must be >= 1 diff --git a/README.md b/README.md index 3aa4b9d..e9bdf89 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,15 @@ _Declarative environment variables for Node.js._ [![Build status][badge-build-image]][badge-build-link] [![Test coverage][badge-coverage-image]][badge-coverage-link] -[badge-build-image]: https://img.shields.io/github/actions/workflow/status/ezzatron/austenite/ci-node-library.yml?branch=main&style=for-the-badge -[badge-build-link]: https://github.com/ezzatron/austenite/actions/workflows/ci-node-library.yml -[badge-coverage-image]: https://img.shields.io/codecov/c/gh/ezzatron/austenite?style=for-the-badge +[badge-build-image]: + https://img.shields.io/github/actions/workflow/status/ezzatron/austenite/ci-node-library.yml?branch=main&style=for-the-badge +[badge-build-link]: + https://github.com/ezzatron/austenite/actions/workflows/ci-node-library.yml +[badge-coverage-image]: + https://img.shields.io/codecov/c/gh/ezzatron/austenite?style=for-the-badge [badge-coverage-link]: https://codecov.io/gh/ezzatron/austenite -[badge-version-image]: https://img.shields.io/npm/v/austenite?label=austenite&logo=npm&style=for-the-badge +[badge-version-image]: + https://img.shields.io/npm/v/austenite?label=austenite&logo=npm&style=for-the-badge [badge-version-link]: https://npmjs.com/package/austenite ## Usage diff --git a/package.json b/package.json index 8cfb005..257a2ae 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,9 @@ "mdast-util-gfm": "^3.0.0", "mdast-util-to-markdown": "^2.1.0" }, + "optionalDependencies": { + "prettier": "^3.0.0" + }, "devDependencies": { "@stryker-mutator/core": "^8.0.0", "@stryker-mutator/typescript-checker": "^8.0.0", diff --git a/src/environment.ts b/src/environment.ts index 99578d0..73661e6 100644 --- a/src/environment.ts +++ b/src/environment.ts @@ -15,9 +15,11 @@ export type InitializeOptions = { readonly onInvalid?: OnInvalid; }; -export function initialize(options: InitializeOptions = {}): void { +export async function initialize( + options: InitializeOptions = {}, +): Promise { if (process.env.AUSTENITE_SPEC === "true") { - console.log(renderSpecification(variablesByName())); + console.log(await renderSpecification(variablesByName())); // eslint-disable-next-line n/no-process-exit process.exit(0); diff --git a/src/specification.ts b/src/specification.ts index e23182d..9079e6d 100644 --- a/src/specification.ts +++ b/src/specification.ts @@ -2,7 +2,7 @@ import type { PhrasingContent, RootContent, TableRow } from "mdast"; import { fromMarkdown } from "mdast-util-from-markdown"; import { gfmToMarkdown } from "mdast-util-gfm"; import { toMarkdown } from "mdast-util-to-markdown"; -import { basename } from "path"; +import { basename, join } from "path"; import { extrinsicConstraints, type ExtrinsicConstraint, @@ -13,20 +13,44 @@ import { Visitor } from "./schema.js"; import { quote } from "./shell.js"; import { Variable } from "./variable.js"; -export function render(variables: Variable[]): string { +export async function render(variables: Variable[]): Promise { const app = appName(); - return toMarkdown( - { - type: "root", - children: [...headerAST(app, variables), ...specificationAST(variables)], - }, - { - bullet: "-", - emphasis: "_", - extensions: [gfmToMarkdown()], - }, - ).trimEnd(); + return prettyPrint( + toMarkdown( + { + type: "root", + children: [ + ...headerAST(app, variables), + ...specificationAST(variables), + ], + }, + { + bullet: "-", + emphasis: "_", + extensions: [gfmToMarkdown()], + }, + ), + ); +} + +async function prettyPrint(markdown: string): Promise { + try { + const prettier = await import("prettier"); + + const options = (await prettier.resolveConfig( + join(process.cwd(), "ENVIRONMENT.md"), + )) ?? { + printWidth: 80, + proseWrap: "always", + }; + + return ( + await prettier.format(markdown, { ...options, parser: "markdown" }) + ).trimEnd(); + } catch { + return markdown.trimEnd(); + } } function appName(): string { diff --git a/test/fixture/example/run.ts b/test/fixture/example/run.ts index 670c07f..d9be2c4 100644 --- a/test/fixture/example/run.ts +++ b/test/fixture/example/run.ts @@ -13,7 +13,7 @@ import { weight, } from "./env.js"; -initialize(); +await initialize(); console.log(""); console.log("Environment is valid 🎉"); diff --git a/test/fixture/specification/app-env-var.md b/test/fixture/specification/app-env-var.md index aad215d..a41beca 100644 --- a/test/fixture/specification/app-env-var.md +++ b/test/fixture/specification/app-env-var.md @@ -1,7 +1,8 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered +by **[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -13,4 +14,5 @@ The `` app uses **declarative environment variables** powered b [declaring]: https://github.com/ezzatron/austenite#declarations + diff --git a/test/fixture/specification/big-integer/default.md b/test/fixture/specification/big-integer/default.md index b21f13d..7278d98 100644 --- a/test/fixture/specification/big-integer/default.md +++ b/test/fixture/specification/big-integer/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Weighting for this node_ -The `WEIGHT` variable is an **optional** variable that takes **big integer** values. +The `WEIGHT` variable is an **optional** variable that takes **big integer** +values. ### Default value diff --git a/test/fixture/specification/big-integer/examples.md b/test/fixture/specification/big-integer/examples.md index 55db17d..bb9b1fe 100644 --- a/test/fixture/specification/big-integer/examples.md +++ b/test/fixture/specification/big-integer/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Weighting for this node_ -The `WEIGHT` variable is a **required** variable that takes **big integer** values. +The `WEIGHT` variable is a **required** variable that takes **big integer** +values. ### Example values diff --git a/test/fixture/specification/big-integer/optional.md b/test/fixture/specification/big-integer/optional.md index b7e6060..53b06b8 100644 --- a/test/fixture/specification/big-integer/optional.md +++ b/test/fixture/specification/big-integer/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Weighting for this node_ -The `WEIGHT` variable is an **optional** variable that takes **big integer** values. +The `WEIGHT` variable is an **optional** variable that takes **big integer** +values. ### Example values diff --git a/test/fixture/specification/big-integer/required.md b/test/fixture/specification/big-integer/required.md index b786789..c32d436 100644 --- a/test/fixture/specification/big-integer/required.md +++ b/test/fixture/specification/big-integer/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Weighting for this node_ -The `WEIGHT` variable is a **required** variable that takes **big integer** values. +The `WEIGHT` variable is a **required** variable that takes **big integer** +values. ### Example values diff --git a/test/fixture/specification/binary/default.md b/test/fixture/specification/binary/default.md index 7ac2b16..f21ca53 100644 --- a/test/fixture/specification/binary/default.md +++ b/test/fixture/specification/binary/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Session token signing key_ -The `SESSION_KEY` variable is an **optional** variable that takes **base64** values. +The `SESSION_KEY` variable is an **optional** variable that takes **base64** +values. ### Default value diff --git a/test/fixture/specification/binary/examples.md b/test/fixture/specification/binary/examples.md index c134443..3d198c1 100644 --- a/test/fixture/specification/binary/examples.md +++ b/test/fixture/specification/binary/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Session token signing key_ -The `SESSION_KEY` variable is a **required** variable that takes **base64** values. +The `SESSION_KEY` variable is a **required** variable that takes **base64** +values. ### Example values diff --git a/test/fixture/specification/binary/optional.md b/test/fixture/specification/binary/optional.md index 9bd747c..9302909 100644 --- a/test/fixture/specification/binary/optional.md +++ b/test/fixture/specification/binary/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Session token signing key_ -The `SESSION_KEY` variable is an **optional** variable that takes **base64** values. +The `SESSION_KEY` variable is an **optional** variable that takes **base64** +values. ### Example values diff --git a/test/fixture/specification/binary/required.md b/test/fixture/specification/binary/required.md index 0d03d0b..beca4f9 100644 --- a/test/fixture/specification/binary/required.md +++ b/test/fixture/specification/binary/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Session token signing key_ -The `SESSION_KEY` variable is a **required** variable that takes **base64** values. +The `SESSION_KEY` variable is a **required** variable that takes **base64** +values. ### Example values diff --git a/test/fixture/specification/boolean/custom-literals.md b/test/fixture/specification/boolean/custom-literals.md index 7625b14..19c939a 100644 --- a/test/fixture/specification/boolean/custom-literals.md +++ b/test/fixture/specification/boolean/custom-literals.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Enable or disable debugging features_ -The `DEBUG` variable is an **optional** variable that takes `y`, `yes`, `n`, or `no`. +The `DEBUG` variable is an **optional** variable that takes `y`, `yes`, `n`, or +`no`. ### Default value diff --git a/test/fixture/specification/boolean/default.md b/test/fixture/specification/boolean/default.md index 515f6a2..8cab1af 100644 --- a/test/fixture/specification/boolean/default.md +++ b/test/fixture/specification/boolean/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -42,7 +43,8 @@ export DEBUG=false # false _Enable or disable production mode_ -The `PRODUCTION` variable is an **optional** variable that takes `true` or `false`. +The `PRODUCTION` variable is an **optional** variable that takes `true` or +`false`. ### Default value diff --git a/test/fixture/specification/boolean/examples.md b/test/fixture/specification/boolean/examples.md index dd1c49e..bee9a24 100644 --- a/test/fixture/specification/boolean/examples.md +++ b/test/fixture/specification/boolean/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Enable or disable debugging features_ -The `DEBUG` variable is a **required** variable that takes `y`, `yes`, `n`, or `no`. +The `DEBUG` variable is a **required** variable that takes `y`, `yes`, `n`, or +`no`. ### Example values diff --git a/test/fixture/specification/boolean/optional.md b/test/fixture/specification/boolean/optional.md index 291d95a..b58c7be 100644 --- a/test/fixture/specification/boolean/optional.md +++ b/test/fixture/specification/boolean/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/boolean/required.md b/test/fixture/specification/boolean/required.md index 5a248b0..82856e6 100644 --- a/test/fixture/specification/boolean/required.md +++ b/test/fixture/specification/boolean/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/constraints.md b/test/fixture/specification/constraints.md index 4aadc91..63b6544 100644 --- a/test/fixture/specification/constraints.md +++ b/test/fixture/specification/constraints.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -47,7 +48,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Example binary with length constraint_ -The `AUSTENITE_BINARY_LENGTH` variable is a **required** variable that takes **base64** values, with these constraints: +The `AUSTENITE_BINARY_LENGTH` variable is a **required** variable that takes +**base64** values, with these constraints: - Must have a decoded length of 1 @@ -61,7 +63,8 @@ export AUSTENITE_BINARY_LENGTH=YQ== # example _Example binary with length range constraint_ -The `AUSTENITE_BINARY_LENGTH_RANGE` variable is a **required** variable that takes **base64** values, with these constraints: +The `AUSTENITE_BINARY_LENGTH_RANGE` variable is a **required** variable that +takes **base64** values, with these constraints: - Must have a decoded length between 4 and 5 @@ -75,7 +78,8 @@ export AUSTENITE_BINARY_LENGTH_RANGE=YWJjZA== # example _Example binary with maximum length constraint_ -The `AUSTENITE_BINARY_MAX_LENGTH` variable is a **required** variable that takes **base64** values, with these constraints: +The `AUSTENITE_BINARY_MAX_LENGTH` variable is a **required** variable that takes +**base64** values, with these constraints: - Must have a maximum decoded length of 3 @@ -89,7 +93,8 @@ export AUSTENITE_BINARY_MAX_LENGTH=YWJj # example _Example binary with minimum length constraint_ -The `AUSTENITE_BINARY_MIN_LENGTH` variable is a **required** variable that takes **base64** values, with these constraints: +The `AUSTENITE_BINARY_MIN_LENGTH` variable is a **required** variable that takes +**base64** values, with these constraints: - Must have a minimum decoded length of 2 @@ -103,7 +108,8 @@ export AUSTENITE_BINARY_MIN_LENGTH=YWI= # example _Custom variable_ -The `AUSTENITE_CUSTOM` variable is a **required** variable that takes **string** values, with these constraints: +The `AUSTENITE_CUSTOM` variable is a **required** variable that takes **string** +values, with these constraints: - Must start with a greeting - Must end with a subject @@ -118,7 +124,8 @@ export AUSTENITE_CUSTOM='Hello, world!' # example _Example duration with maximum constraint_ -The `AUSTENITE_DURATION_MAX` variable is a **required** variable that takes **ISO 8601 duration** values, with these constraints: +The `AUSTENITE_DURATION_MAX` variable is a **required** variable that takes +**ISO 8601 duration** values, with these constraints: - Must be <= PT2S @@ -132,7 +139,8 @@ export AUSTENITE_DURATION_MAX=PT2S # example _Example duration with minimum constraint_ -The `AUSTENITE_DURATION_MIN` variable is a **required** variable that takes **ISO 8601 duration** values, with these constraints: +The `AUSTENITE_DURATION_MIN` variable is a **required** variable that takes +**ISO 8601 duration** values, with these constraints: - Must be >= PT1S @@ -146,7 +154,8 @@ export AUSTENITE_DURATION_MIN=PT1S # example _Example duration with range constraint_ -The `AUSTENITE_DURATION_RANGE` variable is a **required** variable that takes **ISO 8601 duration** values, with these constraints: +The `AUSTENITE_DURATION_RANGE` variable is a **required** variable that takes +**ISO 8601 duration** values, with these constraints: - Must be >= PT3S and <= PT4S @@ -160,7 +169,8 @@ export AUSTENITE_DURATION_RANGE=PT3S # example _Example enumeration with minimum constraint_ -The `AUSTENITE_ENUMERATION_MIN` variable is a **required** variable that takes `foo`, `bar`, or `baz`, with these constraints: +The `AUSTENITE_ENUMERATION_MIN` variable is a **required** variable that takes +`foo`, `bar`, or `baz`, with these constraints: - Must be >= bar @@ -174,7 +184,8 @@ export AUSTENITE_ENUMERATION_MIN=bar # example _Example big integer with maximum constraint_ -The `AUSTENITE_INTEGER_BIG_MAX` variable is a **required** variable that takes **big integer** values, with these constraints: +The `AUSTENITE_INTEGER_BIG_MAX` variable is a **required** variable that takes +**big integer** values, with these constraints: - Must be <= 2 @@ -188,7 +199,8 @@ export AUSTENITE_INTEGER_BIG_MAX=2 # example _Example big integer with minimum constraint_ -The `AUSTENITE_INTEGER_BIG_MIN` variable is a **required** variable that takes **big integer** values, with these constraints: +The `AUSTENITE_INTEGER_BIG_MIN` variable is a **required** variable that takes +**big integer** values, with these constraints: - Must be >= 1 @@ -202,7 +214,8 @@ export AUSTENITE_INTEGER_BIG_MIN=1 # example _Example big integer with range constraint_ -The `AUSTENITE_INTEGER_BIG_RANGE` variable is a **required** variable that takes **big integer** values, with these constraints: +The `AUSTENITE_INTEGER_BIG_RANGE` variable is a **required** variable that takes +**big integer** values, with these constraints: - Must be >= 3 and <= 4 @@ -216,7 +229,8 @@ export AUSTENITE_INTEGER_BIG_RANGE=3 # example _Example integer with maximum constraint_ -The `AUSTENITE_INTEGER_MAX` variable is a **required** variable that takes **integer** values, with these constraints: +The `AUSTENITE_INTEGER_MAX` variable is a **required** variable that takes +**integer** values, with these constraints: - Must be <= 2 @@ -230,7 +244,8 @@ export AUSTENITE_INTEGER_MAX=2 # example _Example integer with minimum constraint_ -The `AUSTENITE_INTEGER_MIN` variable is a **required** variable that takes **integer** values, with these constraints: +The `AUSTENITE_INTEGER_MIN` variable is a **required** variable that takes +**integer** values, with these constraints: - Must be >= 1 @@ -244,7 +259,8 @@ export AUSTENITE_INTEGER_MIN=1 # example _Example integer with range constraint_ -The `AUSTENITE_INTEGER_RANGE` variable is a **required** variable that takes **integer** values, with these constraints: +The `AUSTENITE_INTEGER_RANGE` variable is a **required** variable that takes +**integer** values, with these constraints: - Must be >= 3 and <= 4 @@ -258,7 +274,8 @@ export AUSTENITE_INTEGER_RANGE=3 # example _Example number with inclusive maximum constraint_ -The `AUSTENITE_NUMBER_MAX` variable is a **required** variable that takes **number** values, with these constraints: +The `AUSTENITE_NUMBER_MAX` variable is a **required** variable that takes +**number** values, with these constraints: - Must be <= 3 @@ -272,7 +289,8 @@ export AUSTENITE_NUMBER_MAX=3 # example _Example number with exclusive maximum constraint_ -The `AUSTENITE_NUMBER_MAX_EXCLUSIVE` variable is a **required** variable that takes **number** values, with these constraints: +The `AUSTENITE_NUMBER_MAX_EXCLUSIVE` variable is a **required** variable that +takes **number** values, with these constraints: - Must be < 4 @@ -286,7 +304,8 @@ export AUSTENITE_NUMBER_MAX_EXCLUSIVE=3.9 # example _Example number with inclusive minimum constraint_ -The `AUSTENITE_NUMBER_MIN` variable is a **required** variable that takes **number** values, with these constraints: +The `AUSTENITE_NUMBER_MIN` variable is a **required** variable that takes +**number** values, with these constraints: - Must be >= 1 @@ -300,7 +319,8 @@ export AUSTENITE_NUMBER_MIN=1 # example _Example number with exclusive minimum constraint_ -The `AUSTENITE_NUMBER_MIN_EXCLUSIVE` variable is a **required** variable that takes **number** values, with these constraints: +The `AUSTENITE_NUMBER_MIN_EXCLUSIVE` variable is a **required** variable that +takes **number** values, with these constraints: - Must be > 2 @@ -314,7 +334,8 @@ export AUSTENITE_NUMBER_MIN_EXCLUSIVE=2.1 # example _Example number with range constraint_ -The `AUSTENITE_NUMBER_RANGE` variable is a **required** variable that takes **number** values, with these constraints: +The `AUSTENITE_NUMBER_RANGE` variable is a **required** variable that takes +**number** values, with these constraints: - Must be >= 5 and < 6 @@ -328,7 +349,8 @@ export AUSTENITE_NUMBER_RANGE=5.5 # example _Example port number with maximum constraint_ -The `AUSTENITE_PORT_NUMBER_MAX` variable is a **required** variable that takes **port number** values, with these constraints: +The `AUSTENITE_PORT_NUMBER_MAX` variable is a **required** variable that takes +**port number** values, with these constraints: - Must be <= 22222 @@ -342,7 +364,8 @@ export AUSTENITE_PORT_NUMBER_MAX=22222 # example _Example port number with minimum constraint_ -The `AUSTENITE_PORT_NUMBER_MIN` variable is a **required** variable that takes **port number** values, with these constraints: +The `AUSTENITE_PORT_NUMBER_MIN` variable is a **required** variable that takes +**port number** values, with these constraints: - Must be >= 11111 @@ -356,7 +379,8 @@ export AUSTENITE_PORT_NUMBER_MIN=11111 # example _Example port number with range constraint_ -The `AUSTENITE_PORT_NUMBER_RANGE` variable is a **required** variable that takes **port number** values, with these constraints: +The `AUSTENITE_PORT_NUMBER_RANGE` variable is a **required** variable that takes +**port number** values, with these constraints: - Must be >= 33333 and <= 44444 @@ -370,7 +394,8 @@ export AUSTENITE_PORT_NUMBER_RANGE=33333 # example _Example string with length constraint_ -The `AUSTENITE_STRING_LENGTH` variable is a **required** variable that takes **string** values, with these constraints: +The `AUSTENITE_STRING_LENGTH` variable is a **required** variable that takes +**string** values, with these constraints: - Must have a length of 1 @@ -384,7 +409,8 @@ export AUSTENITE_STRING_LENGTH=a # example _Example string with length range constraint_ -The `AUSTENITE_STRING_LENGTH_RANGE` variable is a **required** variable that takes **string** values, with these constraints: +The `AUSTENITE_STRING_LENGTH_RANGE` variable is a **required** variable that +takes **string** values, with these constraints: - Must have a length between 4 and 5 @@ -398,7 +424,8 @@ export AUSTENITE_STRING_LENGTH_RANGE=abcd # example _Example string with maximum length constraint_ -The `AUSTENITE_STRING_MAX_LENGTH` variable is a **required** variable that takes **string** values, with these constraints: +The `AUSTENITE_STRING_MAX_LENGTH` variable is a **required** variable that takes +**string** values, with these constraints: - Must have a maximum length of 3 @@ -412,7 +439,8 @@ export AUSTENITE_STRING_MAX_LENGTH=abc # example _Example string with minimum length constraint_ -The `AUSTENITE_STRING_MIN_LENGTH` variable is a **required** variable that takes **string** values, with these constraints: +The `AUSTENITE_STRING_MIN_LENGTH` variable is a **required** variable that takes +**string** values, with these constraints: - Must have a minimum length of 2 @@ -426,7 +454,8 @@ export AUSTENITE_STRING_MIN_LENGTH=ab # example _Example URL with protocols constraint_ -The `AUSTENITE_URL_ABSOLUTE` variable is a **required** variable that takes **absolute URL** values, with these constraints: +The `AUSTENITE_URL_ABSOLUTE` variable is a **required** variable that takes +**absolute URL** values, with these constraints: - Protocol must be `https:` @@ -440,7 +469,9 @@ export AUSTENITE_URL_ABSOLUTE=https://example.org/path/to/resource # example _Example URL with base URL and protocols constraint_ -The `AUSTENITE_URL_BASE` variable is a **required** variable that takes **absolute URL** values, or **relative URL** values relative to `https://example.org/path/to/`, with these constraints: +The `AUSTENITE_URL_BASE` variable is a **required** variable that takes +**absolute URL** values, or **relative URL** values relative to +`https://example.org/path/to/`, with these constraints: - Protocol must be `https:` diff --git a/test/fixture/specification/duration/default.md b/test/fixture/specification/duration/default.md index 0246243..cf67872 100644 --- a/test/fixture/specification/duration/default.md +++ b/test/fixture/specification/duration/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _GRPC request timeout_ -The `GRPC_TIMEOUT` variable is an **optional** variable that takes **ISO 8601 duration** values. +The `GRPC_TIMEOUT` variable is an **optional** variable that takes **ISO 8601 +duration** values. ### Default value diff --git a/test/fixture/specification/duration/examples.md b/test/fixture/specification/duration/examples.md index 1edb1c4..07988b6 100644 --- a/test/fixture/specification/duration/examples.md +++ b/test/fixture/specification/duration/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _GRPC request timeout_ -The `GRPC_TIMEOUT` variable is a **required** variable that takes **ISO 8601 duration** values. +The `GRPC_TIMEOUT` variable is a **required** variable that takes **ISO 8601 +duration** values. ### Example values diff --git a/test/fixture/specification/duration/optional.md b/test/fixture/specification/duration/optional.md index a2db2f5..688e4c7 100644 --- a/test/fixture/specification/duration/optional.md +++ b/test/fixture/specification/duration/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _GRPC request timeout_ -The `GRPC_TIMEOUT` variable is an **optional** variable that takes **ISO 8601 duration** values. +The `GRPC_TIMEOUT` variable is an **optional** variable that takes **ISO 8601 +duration** values. ### Example values diff --git a/test/fixture/specification/duration/required.md b/test/fixture/specification/duration/required.md index a1c3038..c84ba33 100644 --- a/test/fixture/specification/duration/required.md +++ b/test/fixture/specification/duration/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _GRPC request timeout_ -The `GRPC_TIMEOUT` variable is a **required** variable that takes **ISO 8601 duration** values. +The `GRPC_TIMEOUT` variable is a **required** variable that takes **ISO 8601 +duration** values. ### Example values diff --git a/test/fixture/specification/empty.md b/test/fixture/specification/empty.md index 2ea9320..1e29945 100644 --- a/test/fixture/specification/empty.md +++ b/test/fixture/specification/empty.md @@ -1,7 +1,8 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -13,4 +14,5 @@ The `` app uses **declarative environment variables** powered by **[Austeni [declaring]: https://github.com/ezzatron/austenite#declarations + diff --git a/test/fixture/specification/enumeration/default.md b/test/fixture/specification/enumeration/default.md index 70f2ac8..0138354 100644 --- a/test/fixture/specification/enumeration/default.md +++ b/test/fixture/specification/enumeration/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _The minimum log level to record_ -The `LOG_LEVEL` variable is an **optional** variable that takes `debug`, `info`, `warn`, `error`, or `fatal`. +The `LOG_LEVEL` variable is an **optional** variable that takes `debug`, `info`, +`warn`, `error`, or `fatal`. ### Default value diff --git a/test/fixture/specification/enumeration/examples.md b/test/fixture/specification/enumeration/examples.md index 9ebffea..d55c5b7 100644 --- a/test/fixture/specification/enumeration/examples.md +++ b/test/fixture/specification/enumeration/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _The minimum log level to record_ -The `LOG_LEVEL` variable is a **required** variable that takes `debug`, `info`, `warn`, `error`, or `fatal`. +The `LOG_LEVEL` variable is a **required** variable that takes `debug`, `info`, +`warn`, `error`, or `fatal`. ### Example values diff --git a/test/fixture/specification/enumeration/optional.md b/test/fixture/specification/enumeration/optional.md index 33daad8..4b3b783 100644 --- a/test/fixture/specification/enumeration/optional.md +++ b/test/fixture/specification/enumeration/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _The minimum log level to record_ -The `LOG_LEVEL` variable is an **optional** variable that takes `debug`, `info`, `warn`, `error`, or `fatal`. +The `LOG_LEVEL` variable is an **optional** variable that takes `debug`, `info`, +`warn`, `error`, or `fatal`. ### Example values diff --git a/test/fixture/specification/enumeration/required.md b/test/fixture/specification/enumeration/required.md index db4169c..e3ba918 100644 --- a/test/fixture/specification/enumeration/required.md +++ b/test/fixture/specification/enumeration/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _The minimum log level to record_ -The `LOG_LEVEL` variable is a **required** variable that takes `debug`, `info`, `warn`, `error`, or `fatal`. +The `LOG_LEVEL` variable is a **required** variable that takes `debug`, `info`, +`warn`, `error`, or `fatal`. ### Example values diff --git a/test/fixture/specification/examples.md b/test/fixture/specification/examples.md index 8f78562..3dbb4fc 100644 --- a/test/fixture/specification/examples.md +++ b/test/fixture/specification/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -30,7 +31,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Example binary_ -The `AUSTENITE_BINARY` variable is a **required** variable that takes **base64** values. +The `AUSTENITE_BINARY` variable is a **required** variable that takes **base64** +values. ### Example values @@ -46,7 +48,8 @@ export AUSTENITE_BINARY=Qm9vcCBiZWVwIQ== # _Example boolean_ -The `AUSTENITE_BOOLEAN` variable is a **required** variable that takes `true` or `false`. +The `AUSTENITE_BOOLEAN` variable is a **required** variable that takes `true` or +`false`. ### Example values @@ -62,7 +65,8 @@ export AUSTENITE_BOOLEAN=false # _Example duration_ -The `AUSTENITE_DURATION` variable is a **required** variable that takes **ISO 8601 duration** values. +The `AUSTENITE_DURATION` variable is a **required** variable that takes **ISO +8601 duration** values. ### Example values @@ -78,7 +82,8 @@ export AUSTENITE_DURATION=PT20S # _Example enumeration_ -The `AUSTENITE_ENUMERATION` variable is a **required** variable that takes `foo`, `bar`, or `baz`. +The `AUSTENITE_ENUMERATION` variable is a **required** variable that takes +`foo`, `bar`, or `baz`. ### Example values @@ -94,7 +99,8 @@ export AUSTENITE_ENUMERATION=bar # _Example integer_ -The `AUSTENITE_INTEGER` variable is a **required** variable that takes **integer** values. +The `AUSTENITE_INTEGER` variable is a **required** variable that takes +**integer** values. ### Example values @@ -110,7 +116,8 @@ export AUSTENITE_INTEGER=654321 # _Example big integer_ -The `AUSTENITE_INTEGER_BIG` variable is a **required** variable that takes **big integer** values. +The `AUSTENITE_INTEGER_BIG` variable is a **required** variable that takes **big +integer** values. ### Example values @@ -126,7 +133,8 @@ export AUSTENITE_INTEGER_BIG=98765432109876543210 # _Example number_ -The `AUSTENITE_NUMBER` variable is a **required** variable that takes **number** values. +The `AUSTENITE_NUMBER` variable is a **required** variable that takes **number** +values. ### Example values @@ -142,7 +150,8 @@ export AUSTENITE_NUMBER=654.321 # _Example port number_ -The `AUSTENITE_PORT_NUMBER` variable is a **required** variable that takes **port number** values. +The `AUSTENITE_PORT_NUMBER` variable is a **required** variable that takes +**port number** values. ### Example values @@ -158,7 +167,8 @@ export AUSTENITE_PORT_NUMBER=234 # _Example string_ -The `AUSTENITE_STRING` variable is a **required** variable that takes **string** values. +The `AUSTENITE_STRING` variable is a **required** variable that takes **string** +values. ### Example values @@ -174,7 +184,8 @@ export AUSTENITE_STRING='' # _Kubernetes `austenite-svc` service host_ -The `AUSTENITE_SVC_SERVICE_HOST` variable is a **required** variable that takes **hostname** values. +The `AUSTENITE_SVC_SERVICE_HOST` variable is a **required** variable that takes +**hostname** values. ### Example values @@ -190,7 +201,8 @@ export AUSTENITE_SVC_SERVICE_HOST=host.example.com # _Example URL_ -The `AUSTENITE_URL` variable is a **required** variable that takes **absolute URL** values, or **relative URL** values relative to `https://example.com/path/to/`. +The `AUSTENITE_URL` variable is a **required** variable that takes **absolute +URL** values, or **relative URL** values relative to +`https://example.com/path/to/`. ### Example values diff --git a/test/fixture/specification/integer/default.md b/test/fixture/specification/integer/default.md index 81c781c..43987e2 100644 --- a/test/fixture/specification/integer/default.md +++ b/test/fixture/specification/integer/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/integer/examples.md b/test/fixture/specification/integer/examples.md index 49a0c2e..146d6f3 100644 --- a/test/fixture/specification/integer/examples.md +++ b/test/fixture/specification/integer/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/integer/optional.md b/test/fixture/specification/integer/optional.md index 08611c8..9c94d41 100644 --- a/test/fixture/specification/integer/optional.md +++ b/test/fixture/specification/integer/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/integer/required.md b/test/fixture/specification/integer/required.md index a9739ed..a4f50d4 100644 --- a/test/fixture/specification/integer/required.md +++ b/test/fixture/specification/integer/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/kubernetes-address/default.md b/test/fixture/specification/kubernetes-address/default.md index b7052b5..8d067e3 100644 --- a/test/fixture/specification/kubernetes-address/default.md +++ b/test/fixture/specification/kubernetes-address/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -20,7 +21,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Kubernetes `redis-primary` service host_ -The `REDIS_PRIMARY_SERVICE_HOST` variable is an **optional** variable that takes **hostname** values. +The `REDIS_PRIMARY_SERVICE_HOST` variable is an **optional** variable that takes +**hostname** values. ### Default value @@ -42,7 +44,8 @@ export REDIS_PRIMARY_SERVICE_HOST=10.0.0.11 # an IP address _Kubernetes `redis-primary` service port_ -The `REDIS_PRIMARY_SERVICE_PORT` variable is an **optional** variable that takes **port number** values. +The `REDIS_PRIMARY_SERVICE_PORT` variable is an **optional** variable that takes +**port number** values. ### Default value diff --git a/test/fixture/specification/kubernetes-address/examples.md b/test/fixture/specification/kubernetes-address/examples.md index 730588c..b4e56b3 100644 --- a/test/fixture/specification/kubernetes-address/examples.md +++ b/test/fixture/specification/kubernetes-address/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -20,7 +21,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Kubernetes `redis-primary` service host_ -The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes **hostname** values. +The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes +**hostname** values. ### Example values @@ -36,7 +38,8 @@ export REDIS_PRIMARY_SERVICE_HOST=redis.localhost # local _Kubernetes `redis-primary` service port_ -The `REDIS_PRIMARY_SERVICE_PORT` variable is a **required** variable that takes **port number** values. +The `REDIS_PRIMARY_SERVICE_PORT` variable is a **required** variable that takes +**port number** values. ### Example values diff --git a/test/fixture/specification/kubernetes-address/named-ports.md b/test/fixture/specification/kubernetes-address/named-ports.md index 319d7d3..bfa5516 100644 --- a/test/fixture/specification/kubernetes-address/named-ports.md +++ b/test/fixture/specification/kubernetes-address/named-ports.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -21,7 +22,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Kubernetes `redis-primary` service host_ -The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes **hostname** values. +The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes +**hostname** values. ### Example values @@ -37,7 +39,8 @@ export REDIS_PRIMARY_SERVICE_HOST=10.0.0.11 # an IP address _Kubernetes `redis-primary` service `db` port_ -The `REDIS_PRIMARY_SERVICE_PORT_DB` variable is a **required** variable that takes **port number** values. +The `REDIS_PRIMARY_SERVICE_PORT_DB` variable is a **required** variable that +takes **port number** values. ### Example values @@ -49,7 +52,8 @@ export REDIS_PRIMARY_SERVICE_PORT_DB=12345 # a port number _Kubernetes `redis-primary` service `observability` port_ -The `REDIS_PRIMARY_SERVICE_PORT_OBSERVABILITY` variable is a **required** variable that takes **port number** values. +The `REDIS_PRIMARY_SERVICE_PORT_OBSERVABILITY` variable is a **required** +variable that takes **port number** values. ### Example values diff --git a/test/fixture/specification/kubernetes-address/optional.md b/test/fixture/specification/kubernetes-address/optional.md index cf9bc64..2fae47e 100644 --- a/test/fixture/specification/kubernetes-address/optional.md +++ b/test/fixture/specification/kubernetes-address/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -20,7 +21,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Kubernetes `redis-primary` service host_ -The `REDIS_PRIMARY_SERVICE_HOST` variable is an **optional** variable that takes **hostname** values. +The `REDIS_PRIMARY_SERVICE_HOST` variable is an **optional** variable that takes +**hostname** values. ### Example values @@ -36,7 +38,8 @@ export REDIS_PRIMARY_SERVICE_HOST=10.0.0.11 # an IP address _Kubernetes `redis-primary` service port_ -The `REDIS_PRIMARY_SERVICE_PORT` variable is an **optional** variable that takes **port number** values. +The `REDIS_PRIMARY_SERVICE_PORT` variable is an **optional** variable that takes +**port number** values. ### Example values diff --git a/test/fixture/specification/kubernetes-address/required.md b/test/fixture/specification/kubernetes-address/required.md index 2e0ec05..340ed95 100644 --- a/test/fixture/specification/kubernetes-address/required.md +++ b/test/fixture/specification/kubernetes-address/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -20,7 +21,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Kubernetes `redis-primary` service host_ -The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes **hostname** values. +The `REDIS_PRIMARY_SERVICE_HOST` variable is a **required** variable that takes +**hostname** values. ### Example values @@ -36,7 +38,8 @@ export REDIS_PRIMARY_SERVICE_HOST=10.0.0.11 # an IP address _Kubernetes `redis-primary` service port_ -The `REDIS_PRIMARY_SERVICE_PORT` variable is a **required** variable that takes **port number** values. +The `REDIS_PRIMARY_SERVICE_PORT` variable is a **required** variable that takes +**port number** values. ### Example values diff --git a/test/fixture/specification/markdown-escaping.md b/test/fixture/specification/markdown-escaping.md index caff2f0..b80f141 100644 --- a/test/fixture/specification/markdown-escaping.md +++ b/test/fixture/specification/markdown-escaping.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _## \[Not a heading]\(https\://malicious.example.org)_ -The `AUSTENITE_STRING` variable is a **required** variable that takes **string** values. +The `AUSTENITE_STRING` variable is a **required** variable that takes **string** +values. ### Example values diff --git a/test/fixture/specification/network-port-number/default.md b/test/fixture/specification/network-port-number/default.md index 4dfdfc6..d520720 100644 --- a/test/fixture/specification/network-port-number/default.md +++ b/test/fixture/specification/network-port-number/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Listen port for the HTTP server_ -The `PORT` variable is an **optional** variable that takes **port number** values. +The `PORT` variable is an **optional** variable that takes **port number** +values. ### Default value diff --git a/test/fixture/specification/network-port-number/examples.md b/test/fixture/specification/network-port-number/examples.md index 4db9704..724fef9 100644 --- a/test/fixture/specification/network-port-number/examples.md +++ b/test/fixture/specification/network-port-number/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Listen port for the HTTP server_ -The `PORT` variable is a **required** variable that takes **port number** values. +The `PORT` variable is a **required** variable that takes **port number** +values. ### Example values diff --git a/test/fixture/specification/network-port-number/optional.md b/test/fixture/specification/network-port-number/optional.md index 3d63c25..fb6d2cf 100644 --- a/test/fixture/specification/network-port-number/optional.md +++ b/test/fixture/specification/network-port-number/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Listen port for the HTTP server_ -The `PORT` variable is an **optional** variable that takes **port number** values. +The `PORT` variable is an **optional** variable that takes **port number** +values. ### Example values diff --git a/test/fixture/specification/network-port-number/required.md b/test/fixture/specification/network-port-number/required.md index 93b6669..26279f5 100644 --- a/test/fixture/specification/network-port-number/required.md +++ b/test/fixture/specification/network-port-number/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Listen port for the HTTP server_ -The `PORT` variable is a **required** variable that takes **port number** values. +The `PORT` variable is a **required** variable that takes **port number** +values. ### Example values diff --git a/test/fixture/specification/no-prettier/prettier-not-configured.md b/test/fixture/specification/no-prettier/prettier-not-configured.md new file mode 100644 index 0000000..eb78f5d --- /dev/null +++ b/test/fixture/specification/no-prettier/prettier-not-configured.md @@ -0,0 +1,35 @@ +# Environment variables + +The `` app uses **declarative environment variables** powered by +**[Austenite]**. + +[austenite]: https://github.com/ezzatron/austenite + +| Name | Usage | Description | +| :-------------- | :------- | :-------------- | +| [`LOGO`](#logo) | Required | Main logo image | + + + +> [!TIP] +> If you set an empty value for an environment variable, the app behaves as if that variable isn't set. + + + +## `LOGO` + +_Main logo image_ + +The `LOGO` variable is a **required** variable that takes **absolute URL** +values, or **relative URL** values relative to +`https://base.example.org/path/to/resource`. + +### Example values + +```sh +export LOGO=https://host.example.org/path/to/resource # URL (absolute) +``` + +```sh +export LOGO=path/to/resource # URL (relative) +``` diff --git a/test/fixture/specification/no-prettier/prettier-unavailable.md b/test/fixture/specification/no-prettier/prettier-unavailable.md new file mode 100644 index 0000000..da39ad8 --- /dev/null +++ b/test/fixture/specification/no-prettier/prettier-unavailable.md @@ -0,0 +1,35 @@ + +# Environment variables + +The `` app uses **declarative environment variables** powered by **[Austenite]**. + +[austenite]: https://github.com/ezzatron/austenite + +| Name | Usage | Description | +| :-------------- | :------- | :-------------- | +| [`LOGO`](#logo) | Required | Main logo image | + + + +> [!TIP] +> If you set an empty value for an environment variable, the app behaves as if that variable isn't set. + + + +## `LOGO` + +_Main logo image_ + +The `LOGO` variable is a **required** variable that takes **absolute URL** values, or **relative URL** values relative to `https://base.example.org/path/to/resource`. + +### Example values + +```sh +export LOGO=https://host.example.org/path/to/resource # URL (absolute) +``` + +```sh +export LOGO=path/to/resource # URL (relative) +``` + + diff --git a/test/fixture/specification/number/default.md b/test/fixture/specification/number/default.md index 2366911..a1befdb 100644 --- a/test/fixture/specification/number/default.md +++ b/test/fixture/specification/number/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/number/examples.md b/test/fixture/specification/number/examples.md index fdeeefd..c009ecd 100644 --- a/test/fixture/specification/number/examples.md +++ b/test/fixture/specification/number/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/number/optional.md b/test/fixture/specification/number/optional.md index f0f70a7..a142906 100644 --- a/test/fixture/specification/number/optional.md +++ b/test/fixture/specification/number/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/number/required.md b/test/fixture/specification/number/required.md index bed594d..9f3e60d 100644 --- a/test/fixture/specification/number/required.md +++ b/test/fixture/specification/number/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/sensitive.md b/test/fixture/specification/sensitive.md index 11b1417..47336ef 100644 --- a/test/fixture/specification/sensitive.md +++ b/test/fixture/specification/sensitive.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -31,7 +32,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Example binary_ -The `AUSTENITE_BINARY` variable is an **optional** variable that takes **base64** values. +The `AUSTENITE_BINARY` variable is an **optional** variable that takes +**base64** values. ### Default value @@ -52,7 +54,8 @@ export AUSTENITE_BINARY=Y29ucXVpc3RhZG9y # base64 encoded string _Example boolean_ -The `AUSTENITE_BOOLEAN` variable is an **optional** variable that takes `y`, `yes`, `n`, or `no`. +The `AUSTENITE_BOOLEAN` variable is an **optional** variable that takes `y`, +`yes`, `n`, or `no`. ### Default value @@ -85,7 +88,8 @@ export AUSTENITE_BOOLEAN=no # false _Example duration_ -The `AUSTENITE_DURATION` variable is an **optional** variable that takes **ISO 8601 duration** values. +The `AUSTENITE_DURATION` variable is an **optional** variable that takes **ISO +8601 duration** values. ### Default value @@ -110,7 +114,8 @@ export AUSTENITE_DURATION=P1M15DT12H # ISO 8601 duration _Example enumeration_ -The `AUSTENITE_ENUMERATION` variable is an **optional** variable that takes `foo`, `bar`, or `baz`. +The `AUSTENITE_ENUMERATION` variable is an **optional** variable that takes +`foo`, `bar`, or `baz`. ### Default value @@ -139,7 +144,8 @@ export AUSTENITE_ENUMERATION=baz # baz _Example integer_ -The `AUSTENITE_INTEGER` variable is an **optional** variable that takes **integer** values. +The `AUSTENITE_INTEGER` variable is an **optional** variable that takes +**integer** values. ### Default value @@ -180,7 +186,8 @@ export AUSTENITE_INTEGER=0b11110001001000000 # binary _Example big integer_ -The `AUSTENITE_INTEGER_BIG` variable is an **optional** variable that takes **big integer** values. +The `AUSTENITE_INTEGER_BIG` variable is an **optional** variable that takes +**big integer** values. ### Default value @@ -217,7 +224,8 @@ export AUSTENITE_INTEGER_BIG=0b11110001001000000 # binary _Example number_ -The `AUSTENITE_NUMBER` variable is an **optional** variable that takes **number** values. +The `AUSTENITE_NUMBER` variable is an **optional** variable that takes +**number** values. ### Default value @@ -262,7 +270,8 @@ export AUSTENITE_NUMBER=0b11110001001000000 # binary _Example port number_ -The `AUSTENITE_PORT_NUMBER` variable is an **optional** variable that takes **port number** values. +The `AUSTENITE_PORT_NUMBER` variable is an **optional** variable that takes +**port number** values. ### Default value @@ -283,7 +292,8 @@ export AUSTENITE_PORT_NUMBER=12345 # a port number _Example string_ -The `AUSTENITE_STRING` variable is an **optional** variable that takes **string** values. +The `AUSTENITE_STRING` variable is an **optional** variable that takes +**string** values. ### Default value @@ -308,7 +318,8 @@ export AUSTENITE_STRING='alabaster parakeet' # some values may need escaping _Kubernetes `austenite-svc` service host_ -The `AUSTENITE_SVC_SERVICE_HOST` variable is an **optional** variable that takes **hostname** values. +The `AUSTENITE_SVC_SERVICE_HOST` variable is an **optional** variable that takes +**hostname** values. ### Default value @@ -333,7 +344,8 @@ export AUSTENITE_SVC_SERVICE_HOST=10.0.0.11 # an IP address _Kubernetes `austenite-svc` service port_ -The `AUSTENITE_SVC_SERVICE_PORT` variable is an **optional** variable that takes **port number** values. +The `AUSTENITE_SVC_SERVICE_PORT` variable is an **optional** variable that takes +**port number** values. ### Default value @@ -354,7 +366,8 @@ export AUSTENITE_SVC_SERVICE_PORT=12345 # a port number _Example URL_ -The `AUSTENITE_URL` variable is an **optional** variable that takes **absolute URL** values. +The `AUSTENITE_URL` variable is an **optional** variable that takes **absolute +URL** values. ### Default value @@ -375,7 +388,8 @@ export AUSTENITE_URL=https://host.example.org/path/to/resource # URL (absolute) _Trigger failure_ -The `AUSTENITE_XTRIGGER` variable is a **required** variable that takes **string** values. +The `AUSTENITE_XTRIGGER` variable is a **required** variable that takes +**string** values. ### Example values diff --git a/test/fixture/specification/string/default.md b/test/fixture/specification/string/default.md index 095bdc8..34d7b6c 100644 --- a/test/fixture/specification/string/default.md +++ b/test/fixture/specification/string/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Database connection string for read-models_ -The `READ_DSN` variable is an **optional** variable that takes **string** values. +The `READ_DSN` variable is an **optional** variable that takes **string** +values. ### Default value diff --git a/test/fixture/specification/string/examples.md b/test/fixture/specification/string/examples.md index 1ed29db..c349301 100644 --- a/test/fixture/specification/string/examples.md +++ b/test/fixture/specification/string/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/string/optional.md b/test/fixture/specification/string/optional.md index f1c703d..c6ab3cb 100644 --- a/test/fixture/specification/string/optional.md +++ b/test/fixture/specification/string/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Database connection string for read-models_ -The `READ_DSN` variable is an **optional** variable that takes **string** values. +The `READ_DSN` variable is an **optional** variable that takes **string** +values. ### Example values diff --git a/test/fixture/specification/string/quoting.md b/test/fixture/specification/string/quoting.md index 243df5d..3d46be3 100644 --- a/test/fixture/specification/string/quoting.md +++ b/test/fixture/specification/string/quoting.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/string/required.md b/test/fixture/specification/string/required.md index 0f111bf..7f83791 100644 --- a/test/fixture/specification/string/required.md +++ b/test/fixture/specification/string/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite diff --git a/test/fixture/specification/url/base.md b/test/fixture/specification/url/base.md index 77c4a1c..eb78f5d 100644 --- a/test/fixture/specification/url/base.md +++ b/test/fixture/specification/url/base.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,9 @@ The `` app uses **declarative environment variables** powered by **[Austeni _Main logo image_ -The `LOGO` variable is a **required** variable that takes **absolute URL** values, or **relative URL** values relative to `https://base.example.org/path/to/resource`. +The `LOGO` variable is a **required** variable that takes **absolute URL** +values, or **relative URL** values relative to +`https://base.example.org/path/to/resource`. ### Example values diff --git a/test/fixture/specification/url/default.md b/test/fixture/specification/url/default.md index e54b626..a631fa3 100644 --- a/test/fixture/specification/url/default.md +++ b/test/fixture/specification/url/default.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _CDN to use when serving static assets_ -The `CDN_URL` variable is an **optional** variable that takes **absolute URL** values. +The `CDN_URL` variable is an **optional** variable that takes **absolute URL** +values. ### Default value diff --git a/test/fixture/specification/url/examples.md b/test/fixture/specification/url/examples.md index 3844d67..7931eda 100644 --- a/test/fixture/specification/url/examples.md +++ b/test/fixture/specification/url/examples.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,9 @@ The `` app uses **declarative environment variables** powered by **[Austeni _CDN to use when serving static assets_ -The `CDN_URL` variable is a **required** variable that takes **absolute URL** values, or **relative URL** values relative to `https://host.example.org/path/to/`. +The `CDN_URL` variable is a **required** variable that takes **absolute URL** +values, or **relative URL** values relative to +`https://host.example.org/path/to/`. ### Example values diff --git a/test/fixture/specification/url/optional.md b/test/fixture/specification/url/optional.md index 1717259..5907c4a 100644 --- a/test/fixture/specification/url/optional.md +++ b/test/fixture/specification/url/optional.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _CDN to use when serving static assets_ -The `CDN_URL` variable is an **optional** variable that takes **absolute URL** values. +The `CDN_URL` variable is an **optional** variable that takes **absolute URL** +values. ### Example values diff --git a/test/fixture/specification/url/protocols.md b/test/fixture/specification/url/protocols.md index 1085cf7..1f00b30 100644 --- a/test/fixture/specification/url/protocols.md +++ b/test/fixture/specification/url/protocols.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -20,7 +21,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _CDN to use when serving static assets_ -The `CDN_URL` variable is a **required** variable that takes **absolute URL** values, with these constraints: +The `CDN_URL` variable is a **required** variable that takes **absolute URL** +values, with these constraints: - Protocol must be `https:` @@ -34,7 +36,8 @@ export CDN_URL=https://host.example.org/path/to/resource # URL (https:) _WebSocket server to use_ -The `SOCKET_SERVER` variable is a **required** variable that takes **absolute URL** values, with these constraints: +The `SOCKET_SERVER` variable is a **required** variable that takes **absolute +URL** values, with these constraints: - Protocol must be `ws:` or `wss:` diff --git a/test/fixture/specification/url/required.md b/test/fixture/specification/url/required.md index 523029f..67ba7d9 100644 --- a/test/fixture/specification/url/required.md +++ b/test/fixture/specification/url/required.md @@ -1,6 +1,7 @@ # Environment variables -The `` app uses **declarative environment variables** powered by **[Austenite]**. +The `` app uses **declarative environment variables** powered by +**[Austenite]**. [austenite]: https://github.com/ezzatron/austenite @@ -19,7 +20,8 @@ The `` app uses **declarative environment variables** powered by **[Austeni _CDN to use when serving static assets_ -The `CDN_URL` variable is a **required** variable that takes **absolute URL** values. +The `CDN_URL` variable is a **required** variable that takes **absolute URL** +values. ### Example values diff --git a/test/suite/constraint/length.spec.ts b/test/suite/constraint/length.spec.ts index 8418130..b557392 100644 --- a/test/suite/constraint/length.spec.ts +++ b/test/suite/constraint/length.spec.ts @@ -76,10 +76,10 @@ describe.each` }); describe("when the value is too short", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = tooShort; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -96,10 +96,10 @@ describe.each` }); describe("when the value is too long", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = tooLong; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -116,10 +116,10 @@ describe.each` }); describe("when the value is the right length", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = shortest; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -143,10 +143,10 @@ describe.each` }); describe("when the value is too short", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = tooShort; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -163,10 +163,10 @@ describe.each` }); describe("when the value is the long enough", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = shortest; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -190,10 +190,10 @@ describe.each` }); describe("when the value is too long", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = tooLong; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -210,10 +210,10 @@ describe.each` }); describe("when the value is short enough", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = longest; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -238,10 +238,10 @@ describe.each` }); describe("when the value is too short", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = tooShort; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -258,10 +258,10 @@ describe.each` }); describe("when the value is too long", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = tooLong; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -278,10 +278,10 @@ describe.each` }); describe("when the value is the shortest allowed", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = shortest; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -294,10 +294,10 @@ describe.each` }); describe("when the value is the longest allowed", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = longest; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/constraint/range.spec.ts b/test/suite/constraint/range.spec.ts index 9b3ff02..0fbe2dd 100644 --- a/test/suite/constraint/range.spec.ts +++ b/test/suite/constraint/range.spec.ts @@ -96,10 +96,10 @@ describe.each` }); describe("when the value is less than the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = low; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -114,10 +114,10 @@ describe.each` }); describe("when the value is equal to the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = minCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -128,10 +128,10 @@ describe.each` }); describe("when the value is greater than the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = ok; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -152,10 +152,10 @@ describe.each` }); describe("when the value is less than the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = low; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -170,10 +170,10 @@ describe.each` }); describe("when the value is equal to the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = minCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -188,10 +188,10 @@ describe.each` }); describe("when the value is greater than the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = ok; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -203,7 +203,7 @@ describe.each` }); describe("when the declaration has a minimum with no explicit exclusivity", () => { - beforeEach(() => { + beforeEach(async () => { declaration = create({ min, examples, @@ -211,7 +211,7 @@ describe.each` process.env.AUSTENITE_VAR = minCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to an inclusive minimum", () => { @@ -229,10 +229,10 @@ describe.each` }); describe("when the value is greater than the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = high; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -247,10 +247,10 @@ describe.each` }); describe("when the value is equal to the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = maxCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -261,10 +261,10 @@ describe.each` }); describe("when the value is less than the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = ok; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -285,10 +285,10 @@ describe.each` }); describe("when the value is greater than the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = high; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -303,10 +303,10 @@ describe.each` }); describe("when the value is equal to the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = maxCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -321,10 +321,10 @@ describe.each` }); describe("when the value is less than the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = ok; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -336,7 +336,7 @@ describe.each` }); describe("when the declaration has a maximum with no explicit exclusivity", () => { - beforeEach(() => { + beforeEach(async () => { declaration = create({ max, examples, @@ -344,7 +344,7 @@ describe.each` process.env.AUSTENITE_VAR = maxCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to an inclusive maximum", () => { @@ -362,10 +362,10 @@ describe.each` }); describe("when the value is less than the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = low; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -380,10 +380,10 @@ describe.each` }); describe("when the value is equal to the minimum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = minCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -394,10 +394,10 @@ describe.each` }); describe("when the value is between the minimum and maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = ok; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -408,10 +408,10 @@ describe.each` }); describe("when the value is equal to the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = maxCanonical; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -422,10 +422,10 @@ describe.each` }); describe("when the value is greater than the maximum", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_VAR = high; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/big-integer.spec-d.ts b/test/suite/declaration/big-integer.spec-d.ts index 07855a9..150f6f5 100644 --- a/test/suite/declaration/big-integer.spec-d.ts +++ b/test/suite/declaration/big-integer.spec-d.ts @@ -5,11 +5,11 @@ import { noop } from "../../helpers.js"; describe("Big integer declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a bigint value", () => { + it("returns a bigint value", async () => { const declaration = bigInteger("AUSTENITE_INTEGER", ""); process.env.AUSTENITE_INTEGER = "123456"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -19,12 +19,12 @@ describe("Big integer declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional bigint value", () => { + it("returns an optional bigint value", async () => { const declaration = bigInteger("AUSTENITE_INTEGER", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/big-integer.spec.ts b/test/suite/declaration/big-integer.spec.ts index f9f503f..e3b6cd6 100644 --- a/test/suite/declaration/big-integer.spec.ts +++ b/test/suite/declaration/big-integer.spec.ts @@ -48,10 +48,10 @@ describe("Big integer declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = bigInteger("AUSTENITE_INTEGER", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -64,10 +64,10 @@ describe("Big integer declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = bigInteger("AUSTENITE_INTEGER", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -87,10 +87,10 @@ describe("Big integer declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, integer: string, expected: bigint) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -109,10 +109,10 @@ describe("Big integer declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, integer: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -126,8 +126,8 @@ describe("Big integer declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -152,10 +152,10 @@ describe("Big integer declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, integer: string, expected: bigint) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -169,10 +169,10 @@ describe("Big integer declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, integer: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -187,12 +187,12 @@ describe("Big integer declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = bigInteger("AUSTENITE_INTEGER", "", { default: -123456n, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -203,12 +203,12 @@ describe("Big integer declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = bigInteger("AUSTENITE_INTEGER", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -238,10 +238,10 @@ describe("Big integer declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = "6"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -252,10 +252,10 @@ describe("Big integer declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = "3"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -270,10 +270,10 @@ describe("Big integer declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = "2"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -307,10 +307,10 @@ describe("Big integer declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.EARTH_ATOM_COUNT = "5972200000000000000000000"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -321,10 +321,10 @@ describe("Big integer declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.EARTH_ATOM_COUNT = "5972200000000000000000001"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/binary.spec-d.ts b/test/suite/declaration/binary.spec-d.ts index 3f0459d..b0727a1 100644 --- a/test/suite/declaration/binary.spec-d.ts +++ b/test/suite/declaration/binary.spec-d.ts @@ -6,11 +6,11 @@ import { noop } from "../../helpers.js"; describe("Binary declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a Buffer value", () => { + it("returns a Buffer value", async () => { const declaration = binary("AUSTENITE_BINARY", ""); process.env.AUSTENITE_BINARY = "bGlnaHQgd29y"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -20,12 +20,12 @@ describe("Binary declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional Binary value", () => { + it("returns an optional Binary value", async () => { const declaration = binary("AUSTENITE_BINARY", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/binary.spec.ts b/test/suite/declaration/binary.spec.ts index 0e69e36..c4007d8 100644 --- a/test/suite/declaration/binary.spec.ts +++ b/test/suite/declaration/binary.spec.ts @@ -47,8 +47,8 @@ describe("Binary declarations", () => { declaration = binary("AUSTENITE_BINARY", ""); }); - it("defaults to a required declaration", () => { - initialize({ onInvalid: noop }); + it("defaults to a required declaration", async () => { + await initialize({ onInvalid: noop }); expect(() => { declaration.value(); @@ -57,19 +57,19 @@ describe("Binary declarations", () => { ); }); - it("defaults to base64 encoding", () => { + it("defaults to base64 encoding", async () => { process.env.AUSTENITE_BINARY = "bGlnaHQgd29y"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); expect(declaration.value().toString("utf-8")).toEqual("light wor"); }); }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -85,13 +85,13 @@ describe("Binary declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, encoding, encoded, expected) => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", { encoding, }); process.env.AUSTENITE_BINARY = encoded; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -110,13 +110,13 @@ describe("Binary declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, encoding, encoded, expected) => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", { encoding, }); process.env.AUSTENITE_BINARY = encoded; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -130,9 +130,9 @@ describe("Binary declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -151,14 +151,14 @@ describe("Binary declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, encoding, encoded, expected) => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", { encoding, default: undefined, }); process.env.AUSTENITE_BINARY = encoded; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -172,14 +172,14 @@ describe("Binary declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, encoding, encoded, expected) => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", { encoding, default: undefined, }); process.env.AUSTENITE_BINARY = encoded; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -194,12 +194,12 @@ describe("Binary declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", { default: Buffer.from("", "utf-8"), }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -210,12 +210,12 @@ describe("Binary declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -247,10 +247,10 @@ describe("Binary declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BINARY = "YWJjZGVm"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -261,10 +261,10 @@ describe("Binary declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BINARY = "YWJj"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -279,10 +279,10 @@ describe("Binary declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BINARY = "YWI="; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -317,13 +317,13 @@ describe("Binary declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.SESSION_KEY = Buffer.from( "SUPER_SECRET_256_BIT_SIGNING_KEY", "utf-8", ).toString("base64"); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -336,12 +336,12 @@ describe("Binary declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.SESSION_KEY = Buffer.from("INVALID", "utf-8").toString( "base64", ); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/boolean.spec-d.ts b/test/suite/declaration/boolean.spec-d.ts index 67f5ac6..88434cb 100644 --- a/test/suite/declaration/boolean.spec-d.ts +++ b/test/suite/declaration/boolean.spec-d.ts @@ -5,11 +5,11 @@ import { noop } from "../../helpers.js"; describe("Boolean declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a boolean value", () => { + it("returns a boolean value", async () => { const declaration = boolean("AUSTENITE_BOOLEAN", ""); process.env.AUSTENITE_BOOLEAN = "false"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -19,12 +19,12 @@ describe("Boolean declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional boolean value", () => { + it("returns an optional boolean value", async () => { const declaration = boolean("AUSTENITE_BOOLEAN", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/boolean.spec.ts b/test/suite/declaration/boolean.spec.ts index b2e2e27..6008159 100644 --- a/test/suite/declaration/boolean.spec.ts +++ b/test/suite/declaration/boolean.spec.ts @@ -8,10 +8,10 @@ describe("Boolean declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = boolean("AUSTENITE_BOOLEAN", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -24,10 +24,10 @@ describe("Boolean declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = boolean("AUSTENITE_BOOLEAN", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -51,10 +51,10 @@ describe("Boolean declarations", () => { `( "when the value is one of the accepted literals ($value)", ({ value, expected }: { value: string; expected: boolean }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -77,10 +77,10 @@ describe("Boolean declarations", () => { `( "when the value is invalid ($value)", ({ value, expected }: { value: string; expected: string }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -94,8 +94,8 @@ describe("Boolean declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -124,10 +124,10 @@ describe("Boolean declarations", () => { `( "when the value is one of the accepted literals ($value)", ({ value, expected }: { value: string; expected: boolean }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -145,10 +145,10 @@ describe("Boolean declarations", () => { `( "when the value is invalid ($value)", ({ value, expected }: { value: string; expected: string }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -165,12 +165,12 @@ describe("Boolean declarations", () => { describe.each([[true], [false]])( "when there is a default value (%s)", (def: boolean) => { - beforeEach(() => { + beforeEach(async () => { declaration = boolean("AUSTENITE_BOOLEAN", "", { default: def, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -182,12 +182,12 @@ describe("Boolean declarations", () => { ); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = boolean("AUSTENITE_BOOLEAN", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -220,10 +220,10 @@ describe("Boolean declarations", () => { `( "when the value matches a custom literal ($value)", ({ value, expected }: { value: string; expected: boolean }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -241,10 +241,10 @@ describe("Boolean declarations", () => { `( "when the value does not match a custom literal ($value)", ({ value, expected }: { value: string; expected: string }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -344,10 +344,10 @@ describe("Boolean declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = "true"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -358,10 +358,10 @@ describe("Boolean declarations", () => { }); describe("when the value violates a constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = "false"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -401,10 +401,10 @@ describe("Boolean declarations", () => { }); describe("when the value is false", () => { - beforeEach(() => { + beforeEach(async () => { process.env.DEBUG = "false"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -415,11 +415,11 @@ describe("Boolean declarations", () => { }); describe("when the value is true and the platform is not Windows", () => { - beforeEach(() => { + beforeEach(async () => { process.env.DEBUG = "true"; Object.defineProperty(process, "platform", { value: "darwin" }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -430,11 +430,11 @@ describe("Boolean declarations", () => { }); describe("when the value is true and the platform is Windows", () => { - beforeEach(() => { + beforeEach(async () => { process.env.DEBUG = "true"; Object.defineProperty(process, "platform", { value: "win32" }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/duration.spec-d.ts b/test/suite/declaration/duration.spec-d.ts index 85cc4a9..cc12bd8 100644 --- a/test/suite/declaration/duration.spec-d.ts +++ b/test/suite/declaration/duration.spec-d.ts @@ -9,11 +9,11 @@ type Duration = Temporal.Duration; describe("Duration declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a Duration value", () => { + it("returns a Duration value", async () => { const declaration = duration("AUSTENITE_DURATION", ""); process.env.AUSTENITE_DURATION = "P1Y"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -23,12 +23,12 @@ describe("Duration declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional Duration value", () => { + it("returns an optional Duration value", async () => { const declaration = duration("AUSTENITE_DURATION", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/duration.spec.ts b/test/suite/declaration/duration.spec.ts index 1c59d57..3c5304e 100644 --- a/test/suite/declaration/duration.spec.ts +++ b/test/suite/declaration/duration.spec.ts @@ -40,10 +40,10 @@ describe("Duration declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = duration("AUSTENITE_DURATION", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -56,10 +56,10 @@ describe("Duration declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = duration("AUSTENITE_DURATION", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -77,10 +77,10 @@ describe("Duration declarations", () => { }); describe("when the value is a valid duration", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_DURATION = "P1Y"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -98,10 +98,10 @@ describe("Duration declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, duration: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_DURATION = duration; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -115,8 +115,8 @@ describe("Duration declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -139,10 +139,10 @@ describe("Duration declarations", () => { }); describe("when the value is a valid duration", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_DURATION = "P1Y"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -155,10 +155,10 @@ describe("Duration declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, duration: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_DURATION = duration; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -173,12 +173,12 @@ describe("Duration declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = duration("AUSTENITE_DURATION", "", { default: Duration.from("P2D"), }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -189,12 +189,12 @@ describe("Duration declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = duration("AUSTENITE_DURATION", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -224,10 +224,10 @@ describe("Duration declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_DURATION = "P6D"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -238,10 +238,10 @@ describe("Duration declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_DURATION = "P3D"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -256,10 +256,10 @@ describe("Duration declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_DURATION = "P2D"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -295,10 +295,10 @@ describe("Duration declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.GRPC_TIMEOUT = "PT1S"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -309,10 +309,10 @@ describe("Duration declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.GRPC_TIMEOUT = "PT0.01S"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/enumeration.spec-d.ts b/test/suite/declaration/enumeration.spec-d.ts index baf893f..93986ee 100644 --- a/test/suite/declaration/enumeration.spec-d.ts +++ b/test/suite/declaration/enumeration.spec-d.ts @@ -20,7 +20,7 @@ describe("Enumeration declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a value that has a union type of all member types", () => { + it("returns a value that has a union type of all member types", async () => { const declaration = enumeration( "AUSTENITE_ENUMERATION", "", @@ -28,7 +28,7 @@ describe("Enumeration declarations", () => { ); process.env.AUSTENITE_ENUMERATION = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf<0 | 1 | 2>(); @@ -38,7 +38,7 @@ describe("Enumeration declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns a value that has a union type of all member types plus undefined", () => { + it("returns a value that has a union type of all member types plus undefined", async () => { const declaration = enumeration( "AUSTENITE_ENUMERATION", "", @@ -48,7 +48,7 @@ describe("Enumeration declarations", () => { }, ); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf<0 | 1 | 2 | undefined>(); diff --git a/test/suite/declaration/enumeration.spec.ts b/test/suite/declaration/enumeration.spec.ts index 780803b..80b4153 100644 --- a/test/suite/declaration/enumeration.spec.ts +++ b/test/suite/declaration/enumeration.spec.ts @@ -23,14 +23,14 @@ describe("Enumeration declarations", () => { let declaration: Declaration<0 | 1 | 2, Options<0 | 1 | 2>>; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = enumeration( "AUSTENITE_ENUMERATION", "", members, ); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -43,7 +43,7 @@ describe("Enumeration declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = enumeration( "AUSTENITE_ENUMERATION", "", @@ -51,7 +51,7 @@ describe("Enumeration declarations", () => { {}, ); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -80,10 +80,10 @@ describe("Enumeration declarations", () => { `( "when the value is one of the members ($value)", ({ value, expected }: { value: string; expected: number }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_ENUMERATION = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -100,10 +100,10 @@ describe("Enumeration declarations", () => { ); describe("when the value is invalid", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_ENUMERATION = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -118,8 +118,8 @@ describe("Enumeration declarations", () => { }); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -154,10 +154,10 @@ describe("Enumeration declarations", () => { `( "when the value is one of the members ($value)", ({ value, expected }: { value: string; expected: number }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_ENUMERATION = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -169,10 +169,10 @@ describe("Enumeration declarations", () => { ); describe("when the value is invalid", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_ENUMERATION = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -188,7 +188,7 @@ describe("Enumeration declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = enumeration( "AUSTENITE_ENUMERATION", "", @@ -198,7 +198,7 @@ describe("Enumeration declarations", () => { }, ); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -209,7 +209,7 @@ describe("Enumeration declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = enumeration( "AUSTENITE_ENUMERATION", "", @@ -219,7 +219,7 @@ describe("Enumeration declarations", () => { }, ); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -292,10 +292,10 @@ describe("Enumeration declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_ENUMERATION = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -306,10 +306,10 @@ describe("Enumeration declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_ENUMERATION = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -324,10 +324,10 @@ describe("Enumeration declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_ENUMERATION = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -399,10 +399,10 @@ describe("Enumeration declarations", () => { }); describe("when the value is not debug", () => { - beforeEach(() => { + beforeEach(async () => { process.env.LOG_LEVEL = "error"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -413,11 +413,11 @@ describe("Enumeration declarations", () => { }); describe("when the value is debug and the platform is not Windows", () => { - beforeEach(() => { + beforeEach(async () => { process.env.LOG_LEVEL = "debug"; Object.defineProperty(process, "platform", { value: "darwin" }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -428,11 +428,11 @@ describe("Enumeration declarations", () => { }); describe("when the value is debug and the platform is Windows", () => { - beforeEach(() => { + beforeEach(async () => { process.env.LOG_LEVEL = "debug"; Object.defineProperty(process, "platform", { value: "win32" }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/integer.spec-d.ts b/test/suite/declaration/integer.spec-d.ts index 4a28135..e5863b7 100644 --- a/test/suite/declaration/integer.spec-d.ts +++ b/test/suite/declaration/integer.spec-d.ts @@ -5,11 +5,11 @@ import { noop } from "../../helpers.js"; describe("Integer declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a number value", () => { + it("returns a number value", async () => { const declaration = integer("AUSTENITE_INTEGER", ""); process.env.AUSTENITE_INTEGER = "123456"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -19,12 +19,12 @@ describe("Integer declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional number value", () => { + it("returns an optional number value", async () => { const declaration = integer("AUSTENITE_INTEGER", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/integer.spec.ts b/test/suite/declaration/integer.spec.ts index 1d44269..3be275f 100644 --- a/test/suite/declaration/integer.spec.ts +++ b/test/suite/declaration/integer.spec.ts @@ -44,10 +44,10 @@ describe("Integer declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = integer("AUSTENITE_INTEGER", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -60,10 +60,10 @@ describe("Integer declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = integer("AUSTENITE_INTEGER", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -83,10 +83,10 @@ describe("Integer declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, integer: string, expected: number) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -105,10 +105,10 @@ describe("Integer declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, integer: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -122,8 +122,8 @@ describe("Integer declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -148,10 +148,10 @@ describe("Integer declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, integer: string, expected: number) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -165,10 +165,10 @@ describe("Integer declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, integer: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -183,12 +183,12 @@ describe("Integer declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = integer("AUSTENITE_INTEGER", "", { default: -123456, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -199,12 +199,12 @@ describe("Integer declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = integer("AUSTENITE_INTEGER", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -258,10 +258,10 @@ describe("Integer declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = "6"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -272,10 +272,10 @@ describe("Integer declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = "3"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -290,10 +290,10 @@ describe("Integer declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_INTEGER = "2"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -322,10 +322,10 @@ describe("Integer declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.WEIGHT = "300"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -336,10 +336,10 @@ describe("Integer declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.WEIGHT = "301"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/kubernetes-address.spec-d.ts b/test/suite/declaration/kubernetes-address.spec-d.ts index 71d6b42..bb997dc 100644 --- a/test/suite/declaration/kubernetes-address.spec-d.ts +++ b/test/suite/declaration/kubernetes-address.spec-d.ts @@ -9,12 +9,12 @@ import { noop } from "../../helpers.js"; describe("Kubernetes address declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a kubernetes address", () => { + it("returns a kubernetes address", async () => { const declaration = kubernetesAddress("austenite-svc"); process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.org"; process.env.AUSTENITE_SVC_SERVICE_PORT = "12345"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -24,12 +24,12 @@ describe("Kubernetes address declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional kubernetes address", () => { + it("returns an optional kubernetes address", async () => { const declaration = kubernetesAddress("austenite-svc", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/kubernetes-address.spec.ts b/test/suite/declaration/kubernetes-address.spec.ts index eb15728..da8035d 100644 --- a/test/suite/declaration/kubernetes-address.spec.ts +++ b/test/suite/declaration/kubernetes-address.spec.ts @@ -103,10 +103,10 @@ describe("Kubernetes address declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc"); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -119,10 +119,10 @@ describe("Kubernetes address declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -159,11 +159,11 @@ describe("Kubernetes address declarations", () => { `( "when the host and port are valid ($host:$port)", ({ host, port }: { host: string; port: string }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = host; process.env.AUSTENITE_SVC_SERVICE_PORT = port; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -190,11 +190,11 @@ describe("Kubernetes address declarations", () => { describe.each(invalidHostValueTable)( "when the host is invalid (%s)", (_, value: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = value; process.env.AUSTENITE_SVC_SERVICE_PORT = "12345"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -210,11 +210,11 @@ describe("Kubernetes address declarations", () => { describe.each(invalidPortValueTable)( "when the port is invalid (%s)", (_, value: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.org"; process.env.AUSTENITE_SVC_SERVICE_PORT = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -228,10 +228,10 @@ describe("Kubernetes address declarations", () => { ); describe("when the host is empty", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_PORT = "12345"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -246,10 +246,10 @@ describe("Kubernetes address declarations", () => { }); describe("when the port is empty", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.org"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -264,8 +264,8 @@ describe("Kubernetes address declarations", () => { }); describe("when the host and port are empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -294,11 +294,11 @@ describe("Kubernetes address declarations", () => { `( "when the host and port are valid ($host:$port)", ({ host, port }: { host: string; port: string }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = host; process.env.AUSTENITE_SVC_SERVICE_PORT = port; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -315,11 +315,11 @@ describe("Kubernetes address declarations", () => { describe.each(invalidHostValueTable)( "when the host is invalid (%s)", (_, value: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = value; process.env.AUSTENITE_SVC_SERVICE_PORT = "12345"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -335,11 +335,11 @@ describe("Kubernetes address declarations", () => { describe.each(invalidPortValueTable)( "when the port is invalid (%s)", (_, value: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.org"; process.env.AUSTENITE_SVC_SERVICE_PORT = value; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -358,12 +358,12 @@ describe("Kubernetes address declarations", () => { }); describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc", { default: def, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -377,12 +377,12 @@ describe("Kubernetes address declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -401,12 +401,12 @@ describe("Kubernetes address declarations", () => { }); describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc", { default: def, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -420,12 +420,12 @@ describe("Kubernetes address declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -440,12 +440,12 @@ describe("Kubernetes address declarations", () => { describe("when the host and port are empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc", { default: def, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -456,12 +456,12 @@ describe("Kubernetes address declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = kubernetesAddress("austenite-svc", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -496,11 +496,11 @@ describe("Kubernetes address declarations", () => { ); describe("when the host and port are valid", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.org"; process.env.AUSTENITE_SVC_SERVICE_PORT_AUSTENITE_PRT = "12345"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -535,11 +535,11 @@ describe("Kubernetes address declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.org"; process.env.AUSTENITE_SVC_SERVICE_PORT = "1234"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -553,11 +553,11 @@ describe("Kubernetes address declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.com"; process.env.AUSTENITE_SVC_SERVICE_PORT = "1234"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -570,11 +570,11 @@ describe("Kubernetes address declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_SVC_SERVICE_HOST = "host.example.org"; process.env.AUSTENITE_SVC_SERVICE_PORT = "1235"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -604,11 +604,11 @@ describe("Kubernetes address declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.REDIS_PRIMARY_SERVICE_HOST = "secure.redis.example.org"; process.env.REDIS_PRIMARY_SERVICE_PORT = "443"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -622,11 +622,11 @@ describe("Kubernetes address declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.REDIS_PRIMARY_SERVICE_HOST = "secure.redis.example.org"; process.env.REDIS_PRIMARY_SERVICE_PORT = "80"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/network-port-number.spec-d.ts b/test/suite/declaration/network-port-number.spec-d.ts index 9c66c24..ab7c7a0 100644 --- a/test/suite/declaration/network-port-number.spec-d.ts +++ b/test/suite/declaration/network-port-number.spec-d.ts @@ -5,14 +5,14 @@ import { noop } from "../../helpers.js"; describe("Network port number declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a number value", () => { + it("returns a number value", async () => { const declaration = networkPortNumber( "AUSTENITE_PORT", "", ); process.env.AUSTENITE_PORT = "12345"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -22,7 +22,7 @@ describe("Network port number declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional number value", () => { + it("returns an optional number value", async () => { const declaration = networkPortNumber( "AUSTENITE_PORT", "", @@ -31,7 +31,7 @@ describe("Network port number declarations", () => { }, ); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/network-port-number.spec.ts b/test/suite/declaration/network-port-number.spec.ts index c50e66c..f6bc882 100644 --- a/test/suite/declaration/network-port-number.spec.ts +++ b/test/suite/declaration/network-port-number.spec.ts @@ -51,10 +51,10 @@ describe("Network port number declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = networkPortNumber("AUSTENITE_PORT", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -65,10 +65,10 @@ describe("Network port number declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = networkPortNumber("AUSTENITE_PORT", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -86,10 +86,10 @@ describe("Network port number declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, integer: string, expected: number) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_PORT = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -108,10 +108,10 @@ describe("Network port number declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, integer: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_PORT = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -125,8 +125,8 @@ describe("Network port number declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -151,10 +151,10 @@ describe("Network port number declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, integer: string, expected: number) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_PORT = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -168,10 +168,10 @@ describe("Network port number declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, integer: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_PORT = integer; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -186,12 +186,12 @@ describe("Network port number declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = networkPortNumber("AUSTENITE_PORT", "", { default: 54321, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -202,12 +202,12 @@ describe("Network port number declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = networkPortNumber("AUSTENITE_PORT", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -317,10 +317,10 @@ describe("Network port number declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_PORT = "6"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -331,10 +331,10 @@ describe("Network port number declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_PORT = "3"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -349,10 +349,10 @@ describe("Network port number declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_PORT = "2"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -385,10 +385,10 @@ describe("Network port number declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.PORT = "8080"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -399,10 +399,10 @@ describe("Network port number declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.PORT = "1337"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/number.spec-d.ts b/test/suite/declaration/number.spec-d.ts index a0480fa..20860c6 100644 --- a/test/suite/declaration/number.spec-d.ts +++ b/test/suite/declaration/number.spec-d.ts @@ -5,11 +5,11 @@ import { noop } from "../../helpers.js"; describe("Number declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a number value", () => { + it("returns a number value", async () => { const declaration = number("AUSTENITE_NUMBER", ""); process.env.AUSTENITE_NUMBER = "123.456"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -19,12 +19,12 @@ describe("Number declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional number value", () => { + it("returns an optional number value", async () => { const declaration = number("AUSTENITE_NUMBER", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/number.spec.ts b/test/suite/declaration/number.spec.ts index aaaacfb..d338d31 100644 --- a/test/suite/declaration/number.spec.ts +++ b/test/suite/declaration/number.spec.ts @@ -39,10 +39,10 @@ describe("Number declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = number("AUSTENITE_NUMBER", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -55,10 +55,10 @@ describe("Number declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = number("AUSTENITE_NUMBER", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -78,10 +78,10 @@ describe("Number declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, number: string, expected: number) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_NUMBER = number; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -100,10 +100,10 @@ describe("Number declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, number: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_NUMBER = number; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -117,8 +117,8 @@ describe("Number declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -143,10 +143,10 @@ describe("Number declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, number: string, expected: number) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_NUMBER = number; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -160,10 +160,10 @@ describe("Number declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, number: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_NUMBER = number; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -178,12 +178,12 @@ describe("Number declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = number("AUSTENITE_NUMBER", "", { default: -123.456, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -194,12 +194,12 @@ describe("Number declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = number("AUSTENITE_NUMBER", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -229,10 +229,10 @@ describe("Number declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_NUMBER = "6"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -243,10 +243,10 @@ describe("Number declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_NUMBER = "3"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -261,10 +261,10 @@ describe("Number declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_NUMBER = "2"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -293,10 +293,10 @@ describe("Number declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.SAMPLE_RATIO = "0.01"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -307,10 +307,10 @@ describe("Number declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.SAMPLE_RATIO = "0.001"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/string.spec-d.ts b/test/suite/declaration/string.spec-d.ts index 51e2e77..4b1f51e 100644 --- a/test/suite/declaration/string.spec-d.ts +++ b/test/suite/declaration/string.spec-d.ts @@ -5,11 +5,11 @@ import { noop } from "../../helpers.js"; describe("String declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a string value", () => { + it("returns a string value", async () => { const declaration = string("AUSTENITE_STRING", ""); process.env.AUSTENITE_STRING = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -19,12 +19,12 @@ describe("String declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional string value", () => { + it("returns an optional string value", async () => { const declaration = string("AUSTENITE_STRING", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/string.spec.ts b/test/suite/declaration/string.spec.ts index e323b2c..40ad0f8 100644 --- a/test/suite/declaration/string.spec.ts +++ b/test/suite/declaration/string.spec.ts @@ -8,10 +8,10 @@ describe("String declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = string("AUSTENITE_STRING", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -24,10 +24,10 @@ describe("String declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = string("AUSTENITE_STRING", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -45,10 +45,10 @@ describe("String declarations", () => { }); describe("when the value is not empty", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_STRING = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -64,8 +64,8 @@ describe("String declarations", () => { }); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -88,10 +88,10 @@ describe("String declarations", () => { }); describe("when the value is not empty", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_STRING = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -103,12 +103,12 @@ describe("String declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = string("AUSTENITE_STRING", "", { default: "", }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -119,12 +119,12 @@ describe("String declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = string("AUSTENITE_STRING", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -156,10 +156,10 @@ describe("String declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_STRING = "abcdef"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -170,10 +170,10 @@ describe("String declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_STRING = "abc"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -188,10 +188,10 @@ describe("String declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_STRING = "ab"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -230,11 +230,11 @@ describe("String declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.READ_DSN = "host=localhost dbname=readmodels user=projector"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -247,11 +247,11 @@ describe("String declarations", () => { }); describe("when the value violates the constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.READ_DSN = "host=localhost dbname=readmodels user=projector password=secret"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/declaration/url.spec-d.ts b/test/suite/declaration/url.spec-d.ts index 8f447a2..8a001ff 100644 --- a/test/suite/declaration/url.spec-d.ts +++ b/test/suite/declaration/url.spec-d.ts @@ -5,11 +5,11 @@ import { noop } from "../../helpers.js"; describe("URL declarations", () => { describe("when the declaration is required", () => { describe(".value()", () => { - it("returns a URL value", () => { + it("returns a URL value", async () => { const declaration = url("AUSTENITE_URL", ""); process.env.AUSTENITE_URL = "https://host.example.org/path/to/resource"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); @@ -19,12 +19,12 @@ describe("URL declarations", () => { describe("when the declaration is optional", () => { describe(".value()", () => { - it("returns an optional URL value", () => { + it("returns an optional URL value", async () => { const declaration = url("AUSTENITE_URL", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); const actual = declaration.value(); expectTypeOf(actual).toEqualTypeOf(); diff --git a/test/suite/declaration/url.spec.ts b/test/suite/declaration/url.spec.ts index 79872f7..0d90e23 100644 --- a/test/suite/declaration/url.spec.ts +++ b/test/suite/declaration/url.spec.ts @@ -30,10 +30,10 @@ describe("URL declarations", () => { let declaration: Declaration; describe("when no options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = url("AUSTENITE_URL", ""); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -44,10 +44,10 @@ describe("URL declarations", () => { }); describe("when empty options are supplied", () => { - beforeEach(() => { + beforeEach(async () => { declaration = url("AUSTENITE_URL", "", {}); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("defaults to a required declaration", () => { @@ -65,10 +65,10 @@ describe("URL declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, url: string, expected: URL) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = url; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -87,10 +87,10 @@ describe("URL declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, url: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = url; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -104,8 +104,8 @@ describe("URL declarations", () => { ); describe("when the value is empty", () => { - beforeEach(() => { - initialize({ onInvalid: noop }); + beforeEach(async () => { + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -130,10 +130,10 @@ describe("URL declarations", () => { describe.each(validValueTable)( "when the value is valid (%s)", (_, url: string, expected: URL) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = url; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -147,10 +147,10 @@ describe("URL declarations", () => { describe.each(invalidValueTable)( "when the value is invalid (%s)", (_, url: string, expected: string) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = url; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -165,12 +165,12 @@ describe("URL declarations", () => { describe("when the value is empty", () => { describe("when there is a default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = url("AUSTENITE_URL", "", { default: new URL("https://default.example.org/path/to/resource"), }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -183,12 +183,12 @@ describe("URL declarations", () => { }); describe("when there is no default value", () => { - beforeEach(() => { + beforeEach(async () => { declaration = url("AUSTENITE_URL", "", { default: undefined, }); - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -218,10 +218,10 @@ describe("URL declarations", () => { `( "when the value is a relative URL ($description)", ({ relative, expected }: { relative: string; expected: string }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = relative; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -233,10 +233,10 @@ describe("URL declarations", () => { ); describe("when the value is an absolute URL", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = "wss://other.example.org/path/to/resource"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -265,10 +265,10 @@ describe("URL declarations", () => { `( "when the value matches one of the protocols ($protocol)", ({ url }: { url: string }) => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = url; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -280,10 +280,10 @@ describe("URL declarations", () => { ); describe("when the value does not match any of the protocols", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = "https://host.example.org/path/to/resource"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -388,10 +388,10 @@ describe("URL declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = "https://example.org/"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -402,10 +402,10 @@ describe("URL declarations", () => { }); describe("when the value violates the first constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = "https://example.com/"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -420,10 +420,10 @@ describe("URL declarations", () => { }); describe("when the value violates the second constraint", () => { - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_URL = "http://example.org/"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -458,10 +458,10 @@ describe("URL declarations", () => { }); describe("when the value satisfies the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.CDN_URL = "https://host.example.org/path/to/resource"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { @@ -474,10 +474,10 @@ describe("URL declarations", () => { }); describe("when the value violates the constraints", () => { - beforeEach(() => { + beforeEach(async () => { process.env.CDN_URL = "https://host.local/path/to/resource"; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); describe(".value()", () => { diff --git a/test/suite/initialize.spec.ts b/test/suite/initialize.spec.ts index 09d75c2..d7ac65e 100644 --- a/test/suite/initialize.spec.ts +++ b/test/suite/initialize.spec.ts @@ -24,12 +24,12 @@ describe("initialize()", () => { describe("after being called", () => { let declaration: Declaration>; - beforeEach(() => { + beforeEach(async () => { declaration = string("AUSTENITE_VAR", "", { default: undefined, }); - initialize(); + await initialize(); }); it("allows access to values", () => { @@ -39,10 +39,8 @@ describe("initialize()", () => { }); describe("when called again", () => { - it("does nothing", () => { - expect(() => { - initialize(); - }).not.toThrow(); + it("does nothing", async () => { + await expect(initialize()).resolves.not.toThrow(); }); }); }); @@ -54,8 +52,8 @@ describe("initialize()", () => { onInvalid = mockFn(); }); - it("does not call the handler", () => { - initialize({ onInvalid }); + it("does not call the handler", async () => { + await initialize({ onInvalid }); expect(onInvalid).not.toHaveBeenCalled(); }); @@ -64,11 +62,11 @@ describe("initialize()", () => { describe("when the environment is invalid", () => { describe("when called", () => { - beforeEach(() => { + beforeEach(async () => { string("AUSTENITE_STRING", "example string"); boolean("AUSTENITE_BOOLEAN", "example boolean"); - initialize(); + await initialize(); }); it("outputs a summary table", () => { @@ -88,7 +86,7 @@ describe("initialize()", () => { let results: Results | undefined; let defaultHandler: () => unknown; - beforeEach(() => { + beforeEach(async () => { process.env.AUSTENITE_BOOLEAN = "true"; string("AUSTENITE_STRING", "example string"); @@ -96,7 +94,7 @@ describe("initialize()", () => { results = undefined; - initialize({ + await initialize({ onInvalid(args) { results = args.results; defaultHandler = args.defaultHandler; diff --git a/test/suite/sensitive.spec.ts b/test/suite/sensitive.spec.ts index e79c584..d3ead4c 100644 --- a/test/suite/sensitive.spec.ts +++ b/test/suite/sensitive.spec.ts @@ -8,14 +8,14 @@ describe("Sensitive declarations", () => { describe("when the value is not valid", () => { let declaration: Declaration; - beforeEach(() => { + beforeEach(async () => { declaration = binary("AUSTENITE_BINARY", "", { isSensitive: true, }); process.env.AUSTENITE_BINARY = ""; - initialize({ onInvalid: noop }); + await initialize({ onInvalid: noop }); }); it("doesn't leak the value", () => { diff --git a/test/suite/specification-prettier.spec.ts b/test/suite/specification-prettier.spec.ts new file mode 100644 index 0000000..57f794b --- /dev/null +++ b/test/suite/specification-prettier.spec.ts @@ -0,0 +1,100 @@ +import { join } from "path"; +import { fileURLToPath } from "url"; +import { + afterAll, + beforeAll, + beforeEach, + describe, + expect, + it, + vi, +} from "vitest"; +import { initialize, url } from "../../src/index.js"; +import { MockConsole, createMockConsole } from "../helpers.js"; + +const fixturesPath = fileURLToPath( + new URL("../fixture/specification", import.meta.url), +); + +describe("Specification documents (Prettier unavailable)", () => { + let exitCode: number | undefined; + let mockConsole: MockConsole; + + beforeEach(() => { + exitCode = undefined; + vi.spyOn(process, "exit").mockImplementation((code) => { + exitCode = code ?? 0; + + return undefined as never; + }); + + process.env = { + AUSTENITE_SPEC: "true", + }; + + mockConsole = createMockConsole(); + }); + + describe("when Prettier is not installed", () => { + beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/require-await + vi.doMock("prettier", async () => { + throw new Error('Cannot find module "prettier"'); + }); + }); + + afterAll(() => { + vi.doUnmock("prettier"); + }); + + it("doesn't pretty print the specification output", async () => { + url("LOGO", "Main logo image", { + base: new URL("https://base.example.org/path/to/resource"), + }); + await initialize(); + + await expect( + "\n" + mockConsole.readStdout() + "\n\n", + ).toMatchFileSnapshot(fixturePath("no-prettier/prettier-unavailable")); + expect(exitCode).toBe(0); + }); + }); + + describe("when Prettier is installed but not configured", () => { + beforeAll(() => { + // eslint-disable-next-line @typescript-eslint/require-await + vi.doMock("prettier", async () => { + const prettier = await vi.importActual("prettier"); + + return { + ...prettier, + + // eslint-disable-next-line @typescript-eslint/require-await + async resolveConfig() { + return null; + }, + }; + }); + }); + + afterAll(() => { + vi.doUnmock("prettier"); + }); + + it("uses prose wrap at 80 columns", async () => { + url("LOGO", "Main logo image", { + base: new URL("https://base.example.org/path/to/resource"), + }); + await initialize(); + + await expect(mockConsole.readStdout()).toMatchFileSnapshot( + fixturePath("no-prettier/prettier-not-configured"), + ); + expect(exitCode).toBe(0); + }); + }); +}); + +function fixturePath(name: string): string { + return join(fixturesPath, `${name}.md`); +} diff --git a/test/suite/specification.spec.ts b/test/suite/specification.spec.ts index b8b69c1..679e9f4 100644 --- a/test/suite/specification.spec.ts +++ b/test/suite/specification.spec.ts @@ -46,7 +46,7 @@ describe("Specification documents", () => { describe("when there are big integers", () => { it("describes required big integers", async () => { bigInteger("WEIGHT", "weighting for this node"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("big-integer/required"), @@ -58,7 +58,7 @@ describe("Specification documents", () => { bigInteger("WEIGHT", "weighting for this node", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("big-integer/optional"), @@ -70,7 +70,7 @@ describe("Specification documents", () => { bigInteger("WEIGHT", "weighting for this node", { default: 10000000000000001n, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("big-integer/default"), @@ -89,7 +89,7 @@ describe("Specification documents", () => { }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("big-integer/examples"), @@ -101,7 +101,7 @@ describe("Specification documents", () => { describe("when there are binaries", () => { it("describes required binaries", async () => { binary("SESSION_KEY", "session token signing key"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("binary/required"), @@ -113,7 +113,7 @@ describe("Specification documents", () => { binary("SESSION_KEY", "session token signing key", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("binary/optional"), @@ -128,7 +128,7 @@ describe("Specification documents", () => { "base64", ), }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("binary/default"), @@ -150,7 +150,7 @@ describe("Specification documents", () => { }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("binary/examples"), @@ -162,7 +162,7 @@ describe("Specification documents", () => { describe("when there are booleans", () => { it("describes required booleans", async () => { boolean("DEBUG", "enable or disable debugging features"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("boolean/required"), @@ -174,7 +174,7 @@ describe("Specification documents", () => { boolean("DEBUG", "enable or disable debugging features", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("boolean/optional"), @@ -189,7 +189,7 @@ describe("Specification documents", () => { boolean("PRODUCTION", "enable or disable production mode", { default: true, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("boolean/default"), @@ -207,7 +207,7 @@ describe("Specification documents", () => { no: false, }, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("boolean/custom-literals"), @@ -223,7 +223,7 @@ describe("Specification documents", () => { { value: false, as: "no", label: "disabled" }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("boolean/examples"), @@ -235,7 +235,7 @@ describe("Specification documents", () => { describe("when there are durations", () => { it("describes required durations", async () => { duration("GRPC_TIMEOUT", "gRPC request timeout"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("duration/required"), @@ -247,7 +247,7 @@ describe("Specification documents", () => { duration("GRPC_TIMEOUT", "gRPC request timeout", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("duration/optional"), @@ -259,7 +259,7 @@ describe("Specification documents", () => { duration("GRPC_TIMEOUT", "gRPC request timeout", { default: Duration.from("PT0.01S"), }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("duration/default"), @@ -281,7 +281,7 @@ describe("Specification documents", () => { }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("duration/examples"), @@ -307,7 +307,7 @@ describe("Specification documents", () => { it("describes required enumerations", async () => { enumeration("LOG_LEVEL", "the minimum log level to record", members); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("enumeration/required"), @@ -319,7 +319,7 @@ describe("Specification documents", () => { enumeration("LOG_LEVEL", "the minimum log level to record", members, { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("enumeration/optional"), @@ -331,7 +331,7 @@ describe("Specification documents", () => { enumeration("LOG_LEVEL", "the minimum log level to record", members, { default: "error", }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("enumeration/default"), @@ -349,7 +349,7 @@ describe("Specification documents", () => { }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("enumeration/examples"), @@ -361,7 +361,7 @@ describe("Specification documents", () => { describe("when there are integers", () => { it("describes required integers", async () => { integer("WEIGHT", "weighting for this node"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("integer/required"), @@ -373,7 +373,7 @@ describe("Specification documents", () => { integer("WEIGHT", "weighting for this node", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("integer/optional"), @@ -385,7 +385,7 @@ describe("Specification documents", () => { integer("WEIGHT", "weighting for this node", { default: 101, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("integer/default"), @@ -400,7 +400,7 @@ describe("Specification documents", () => { { value: 1000, as: "1e3", label: "highest weight" }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("integer/examples"), @@ -412,7 +412,7 @@ describe("Specification documents", () => { describe("when there are kubernetes addresses", () => { it("describes required addresses", async () => { kubernetesAddress("redis-primary"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("kubernetes-address/required"), @@ -424,7 +424,7 @@ describe("Specification documents", () => { kubernetesAddress("redis-primary", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("kubernetes-address/optional"), @@ -439,7 +439,7 @@ describe("Specification documents", () => { port: 6379, }, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("kubernetes-address/default"), @@ -454,7 +454,7 @@ describe("Specification documents", () => { kubernetesAddress("redis-primary", { portName: "observability", }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("kubernetes-address/named-ports"), @@ -475,7 +475,7 @@ describe("Specification documents", () => { ], }, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("kubernetes-address/examples"), @@ -487,7 +487,7 @@ describe("Specification documents", () => { describe("when there are network port numbers", () => { it("describes required port numbers", async () => { networkPortNumber("PORT", "listen port for the HTTP server"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("network-port-number/required"), @@ -499,7 +499,7 @@ describe("Specification documents", () => { networkPortNumber("PORT", "listen port for the HTTP server", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("network-port-number/optional"), @@ -511,7 +511,7 @@ describe("Specification documents", () => { networkPortNumber("PORT", "listen port for the HTTP server", { default: 8080, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("network-port-number/default"), @@ -526,7 +526,7 @@ describe("Specification documents", () => { { value: 50080, label: "ephemeral" }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("network-port-number/examples"), @@ -538,7 +538,7 @@ describe("Specification documents", () => { describe("when there are numbers", () => { it("describes required numbers", async () => { number("WEIGHT", "weighting for this node"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("number/required"), @@ -550,7 +550,7 @@ describe("Specification documents", () => { number("WEIGHT", "weighting for this node", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("number/optional"), @@ -562,7 +562,7 @@ describe("Specification documents", () => { number("WEIGHT", "weighting for this node", { default: 100.001, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("number/default"), @@ -577,7 +577,7 @@ describe("Specification documents", () => { { value: 0.25, as: "2.5e-1", label: "25%" }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("number/examples"), @@ -589,7 +589,7 @@ describe("Specification documents", () => { describe("when there are strings", () => { it("describes required strings", async () => { string("READ_DSN", "database connection string for read-models"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("string/required"), @@ -601,7 +601,7 @@ describe("Specification documents", () => { string("READ_DSN", "database connection string for read-models", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("string/optional"), @@ -613,7 +613,7 @@ describe("Specification documents", () => { string("READ_DSN", "database connection string for read-models", { default: "host=localhost dbname=readmodels user=projector", }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("string/default"), @@ -625,7 +625,7 @@ describe("Specification documents", () => { string("MESSAGE", "message to output", { default: "Season's greetings, world!", }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("string/quoting"), @@ -646,7 +646,7 @@ describe("Specification documents", () => { }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("string/examples"), @@ -658,7 +658,7 @@ describe("Specification documents", () => { describe("when there are URLs", () => { it("describes required URLs", async () => { url("CDN_URL", "CDN to use when serving static assets"); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("url/required"), @@ -670,7 +670,7 @@ describe("Specification documents", () => { url("CDN_URL", "CDN to use when serving static assets", { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("url/optional"), @@ -682,7 +682,7 @@ describe("Specification documents", () => { url("CDN_URL", "CDN to use when serving static assets", { default: new URL("https://default.example.org/path/to/resource"), }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("url/default"), @@ -694,7 +694,7 @@ describe("Specification documents", () => { url("LOGO", "Main logo image", { base: new URL("https://base.example.org/path/to/resource"), }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("url/base"), @@ -709,7 +709,7 @@ describe("Specification documents", () => { url("SOCKET_SERVER", "WebSocket server to use", { protocols: ["ws:", "wss:"], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("url/protocols"), @@ -732,7 +732,7 @@ describe("Specification documents", () => { }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("url/examples"), @@ -1021,7 +1021,7 @@ describe("Specification documents", () => { ], examples: [{ value: "Hello, world!", label: "example" }], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("constraints"), @@ -1196,7 +1196,7 @@ describe("Specification documents", () => { }, ], }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("examples"), @@ -1279,7 +1279,7 @@ describe("Specification documents", () => { isSensitive: true, default: Buffer.from("Beep boop!", "utf-8"), }); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("sensitive"), @@ -1290,10 +1290,10 @@ describe("Specification documents", () => { describe("when there are no declarations", () => { it("describes an empty environment", async () => { - initialize(); + await initialize(); await expect( - "\n" + mockConsole.readStdout() + "\n", + "\n" + mockConsole.readStdout() + "\n\n", ).toMatchFileSnapshot(fixturePath("empty")); expect(exitCode).toBe(0); }); @@ -1305,10 +1305,10 @@ describe("Specification documents", () => { }); it("uses the value as the app name", async () => { - initialize(); + await initialize(); await expect( - "\n" + mockConsole.readStdout() + "\n", + "\n" + mockConsole.readStdout() + "\n\n", ).toMatchFileSnapshot(fixturePath("app-env-var")); expect(exitCode).toBe(0); }); @@ -1321,7 +1321,7 @@ describe("Specification documents", () => { "## [Not a heading](https://malicious.example.org)", ); - initialize(); + await initialize(); await expect(mockConsole.readStdout()).toMatchFileSnapshot( fixturePath("markdown-escaping"), diff --git a/test/suite/summary.spec.ts b/test/suite/summary.spec.ts index e37a15d..74e4802 100644 --- a/test/suite/summary.spec.ts +++ b/test/suite/summary.spec.ts @@ -88,7 +88,7 @@ describe("Validation summary", () => { }); binary("AUSTENITE_BINARY", "example binary"); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("required"), @@ -156,7 +156,7 @@ describe("Validation summary", () => { default: undefined, }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("optional"), @@ -227,7 +227,7 @@ describe("Validation summary", () => { default: Buffer.from("Beep boop!", "utf-8"), }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("default"), @@ -253,7 +253,7 @@ describe("Validation summary", () => { duration("AUSTENITE_DURATION", "example duration"); binary("AUSTENITE_BINARY", "example binary"); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("non-canonical"), @@ -303,7 +303,7 @@ describe("Validation summary", () => { boolean("AUSTENITE_BOOLEAN", "example boolean"); binary("AUSTENITE_BINARY", "example binary"); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("invalid"), @@ -327,7 +327,7 @@ describe("Validation summary", () => { ], }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("composite-partially-defined"), @@ -351,7 +351,7 @@ describe("Validation summary", () => { ], }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("composite-partially-invalid"), @@ -377,7 +377,7 @@ describe("Validation summary", () => { ], }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("composite-invalid"), @@ -462,7 +462,7 @@ describe("Validation summary", () => { ], }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("constraint-violation"), @@ -547,7 +547,7 @@ describe("Validation summary", () => { isSensitive: true, }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("sensitive"), @@ -629,7 +629,7 @@ describe("Validation summary", () => { default: Buffer.from("Beep boop!", "utf-8"), }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("sensitive-default"), @@ -645,7 +645,7 @@ describe("Validation summary", () => { isSensitive: true, }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("sensitive-non-canonical"), @@ -720,7 +720,7 @@ describe("Validation summary", () => { isSensitive: true, }); - initialize(); + await initialize(); await expect(mockConsole.readStderr()).toMatchFileSnapshot( fixturePath("senstive-invalid"),