Skip to content

Comments

Feat: Add toggle for primitive parsing via env variable#194

Draft
zabil wants to merge 7 commits intomainfrom
fix-strict-primitive-parsing
Draft

Feat: Add toggle for primitive parsing via env variable#194
zabil wants to merge 7 commits intomainfrom
fix-strict-primitive-parsing

Conversation

@zabil
Copy link
Member

@zabil zabil commented May 28, 2025

Introduces an environment variable GAUGE_TS_DISABLE_PRIMITIVE_PARSING to control the automatic parsing of parameters to primitive types (number, boolean).

  • If GAUGE_TS_DISABLE_PRIMITIVE_PARSING is set to true (case-insensitive), the PrimitiveParser will bypass conversions and return all parameters as their original string values. This provides backward compatibility for projects expecting all parameters as strings.
  • If the variable is unset or set to false, the existing (stricter) primitive parsing logic applies.

Unit tests in PrimitiveParserTests.ts have been updated to reflect this toggleable behavior, ensuring that parsing enabling/disabling works as expected.

@zabil
Copy link
Member Author

zabil commented May 28, 2025

Fixes #190

@zabil zabil force-pushed the fix-strict-primitive-parsing branch 2 times, most recently from a43ed13 to 94b382b Compare May 28, 2025 13:38
chadlwilson and others added 3 commits May 29, 2025 10:19
Introduces an environment variable `GAUGE_TS_DISABLE_PRIMITIVE_PARSING`
to control the automatic parsing of parameters to primitive types (number, boolean).

- If `GAUGE_TS_DISABLE_PRIMITIVE_PARSING` is set to `true` (case-insensitive),
  the `PrimitiveParser` will bypass conversions and return all parameters
  as their original string values. This provides backward compatibility
  for projects expecting all parameters as strings.
- If the variable is unset or set to `false`, the existing (stricter)
  primitive parsing logic applies.

Unit tests in `PrimitiveParserTests.ts` have been updated to reflect
this toggleable behavior, ensuring that parsing enabling/disabling
works as expected.
Introduces an environment variable `GAUGE_TS_DISABLE_PRIMITIVE_PARSING`
to control the automatic parsing of parameters to primitive types (number, boolean).

- If `GAUGE_TS_DISABLE_PRIMITIVE_PARSING` is set to `true` (case-insensitive),
  the `PrimitiveParser` will bypass conversions and return all parameters
  as their original string values. This provides backward compatibility
  for projects expecting all parameters as strings.
- If the variable is unset or set to `false`, the existing (stricter)
  primitive parsing logic applies.

Unit tests in `PrimitiveParserTests.ts` have been updated to reflect
this toggleable behavior, ensuring that parsing enabling/disabling
works as expected.

Fix formatting
Fix lint errors

Formatting issues

Use biome formatter
@zabil zabil force-pushed the fix-strict-primitive-parsing branch from 94b382b to 6766467 Compare May 29, 2025 09:19
zabil added 4 commits May 29, 2025 10:20
Updates relative paths in test imports to fix references. Changes 
number parsing logic to handle valid numeric formats using regex 
pattern matching instead of string comparison. Removes ES2023 lib 
from tsconfig and adds explicit tsconfig reference in Jest config.
Improves test command by adding --no-watchman flag and simplifies
test regex pattern.
@zabil zabil marked this pull request as draft May 31, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants