Skip to content

Commit

Permalink
fix: remove yaml warnings
Browse files Browse the repository at this point in the history
Due to the fact that newer versions of yaml library (1.7.0+)
produce warning when trying to print nested objects in `set`
and at the same time tap-mocha-reporter doesn't support yaml
output that fixes this warning (mapAsMap: true) we have to just
silence them like this.
This would still result in "empty" diff on some reporters but
at least we will not get warnings that clutter whole report.

Refs: #265
  • Loading branch information
lundibundi committed Mar 16, 2022
1 parent 4261d8a commit a66c9f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to

- bug where `test.endAfterSubtests()` would cause an error if the test was
finished before `endAfterSubtests` got a chance to process its checks.
- remove warnings from `yaml` library that are not actionable right now
[see issue](https://github.com/metarhia/metatests/issues/265).

## [0.8.1][] - 2022-03-06

Expand Down
9 changes: 9 additions & 0 deletions lib/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ const { iter, capitalize } = require('@metarhia/common');
const yaml = require('yaml');
const yamlCustomTags = require('tap-yaml/lib/types/index.js');

// TODO: replace tap-yaml and tap-mocha-reporter - due to the fact that
// newer versions of yaml library (1.7.0+) produce warning when trying to print
// nested objects in `set` and at the same time tap-mocha-reporter doesn't
// support yaml output that fixes this warning (mapAsMap: true) we have to just
// silence them like this.
// This would still result in "empty" diff on some reporters but at least we
// will not get warnings that clutter whole report.
process.env.YAML_SILENCE_WARNINGS = 'true';

const { inspect, packageRegex, isDate, isRegExp, isError } = require('./utils');

let TSR = null;
Expand Down

0 comments on commit a66c9f8

Please sign in to comment.