Registry / testing / gemini-configparser

gemini-configparser

JSON →
library1.4.2jsnpmunverified

A configuration parser module for the Gemini (testplane) testing framework, version 1.4.2. It provides a declarative way to define configuration schemas using composable functions like `option`, `section`, `map`, and `root`. Supports parsing from CLI arguments, environment variables, and objects with validation and transformation. Differentiates from alternatives like `convict` by being tightly integrated with Gemini/testplane and offering a nested structure with functions.

npm install gemini-configparser
INSTALL
IMPORT
SIG · GEMINI-CONFIGPARSE
G
gemini-configparser
testingjavascriptv1.4.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

option
✓ import { option } from 'gemini-configparser'
✗ import option from 'gemini-configparser'
Default import is not supported; use named import.
section
✓ import { section } from 'gemini-configparser'
✗ const section = require('gemini-configparser').section
CommonJS require works but TypeScript prefers import.
map
✓ import { map } from 'gemini-configparser'
✗ const map = require('gemini-configparser/map')
map is a named export, not a submodule.
root
✓ import { root } from 'gemini-configparser'
✗ const root = require('gemini-configparser').root
root is exported as named export.

Defines a config parser with nested sections, options with defaults and validation, then parses from options, env, and CLI arguments.

import { root, section, option } from 'gemini-configparser'; const configParser = root(section({ server: section({ port: option({ defaultValue: 8080, parseEnv: Number, parseCli: Number, validate: (v) => { if (v < 0) throw new Error('port must be positive'); } }), host: option({ defaultValue: 'localhost', parseEnv: String, parseCli: String }) }) }), { envPrefix: 'MY_APP_', cliPrefix: '--' }); const config = configParser({ options: { server: { port: 3000 } }, env: { MY_APP_SERVER_HOST: '0.0.0.0' }, argv: ['--server:port', '4000'] }); console.log(config); // { server: { port: 4000, host: '0.0.0.0' } }
Debug
Known issues
gotchaAll keys in the schema must be defined; unknown keys in input will be treated as errors.
fix
Include all possible keys in the section definition.
affects: >=1.0.0
gotchaparseCli and parseEnv functions are applied to the raw string value; ensure they handle strings correctly.
fix
Wrap with Number() or String() as shown in quickstart.
affects: >=1.0.0
gotchadefaultValue can be a function receiving config and currentNode for dynamic defaults.
fix
If you need a dynamic default, provide a function: defaultValue: (config, node) => ...
affects: >=1.0.0
Errors
Common errors & fixes
Error: Unknown field 'extraField'
Input data contains a key not defined in the schema.
fix
Remove the unknown key from input or add it to the section definition.
Error: Expected number, got string
parseEnv or parseCli returns a non-number when Number is expected.
fix
Ensure parseEnv/parseCli functions return the correct type; e.g., Number(rawValue) for numbers.
Upgrade
Version history
1.4.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
gemini-configparser — npm install gemini-configparser · libregistry