fix(commons): invalid reference to properties.d.ts in dist/types/sdk/reporter/utils.d.ts of allure-js-commons #1162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The PR fixes the invalid reference to
properties.d.ts
, which doesn't exist in the distribution, causing TypeScript compilation to fail.The file contains ad-hoc typings for properties, the package we use to read/write
environment.properties
.*.d.ts
files are never included in the emit phase by TypeScript. A reference comment pointing to the file is emitted if the types defined in the file are exported somehow from*.ts
files.In our case, the reason the reference comment gets emitted is because we reexport the entire
properties.parse
here:allure-js/packages/allure-js-commons/src/sdk/reporter/utils.ts
Line 169 in e3c5f29
TypeScript infers its type as follows:
Which requires access to the type of the original function, hence, the reference.
environment.properties read/write reimplementation
While wrapping
properties.parse
in an explicitly typed function would work, this PR introduces new functions to stringify/parseenvironment.properties
:The implementation is mainly taken from gagle/node-properties with unneeded features stripped off (sections, namespaces, etc). Other code was adjusted to use them instead of the original ones.
Note
We use
parseEnvInfo
for testing purposes only; the production code of the integrations only usesstringifyEnvInfo
.Changes in the dependencies
properties
removed fromallure-js-commons
Fixes #1151.
Checklist