Suppress deprecation warnings when running tests on the CI
| 1 Warning | |
|---|---|
| :warning: | Unless you're refactoring existing code or improving documentation, please update CHANGELOG.md. |
Here's an example of a CHANGELOG.md entry:
* [#410](https://github.com/slack-ruby/slack-ruby-client/pull/410): Suppress deprecation warnings when running tests on the ci - [@schinery](https://github.com/schinery).
Generated by :no_entry_sign: Danger
This seems a bit excessive, and will swallow all warnings, including useful ones.
The failing test runs the command line CLI and checks for output, wanting to ensure that it only contains what we expect. But it is broken if there are warnings:
2022-06-05T17:59:03.6640113Z 1) Slack globals requires --slack-api-token
2022-06-05T17:59:03.6640576Z Failure/Error:
2022-06-05T17:59:03.6640915Z expect(err).to(
2022-06-05T17:59:03.6641229Z start_with(
2022-06-05T17:59:03.6641833Z 'error: parse error: Set Slack API token via --slack-api-token or SLACK_API_TOKEN.'
2022-06-05T17:59:03.6642284Z )
2022-06-05T17:59:03.6642578Z )
2022-06-05T17:59:03.6642787Z
2022-06-05T17:59:03.6643831Z expected "Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeR...lack [global options] auth test \n\n\n\nDESCRIPTION\n Checks authentication & identity. \n\n\n\n" to start with "error: parse error: Set Slack API token via --slack-api-token or SLACK_API_TOKEN."
2022-06-05T17:59:03.6644725Z # ./spec/slack/slack_spec.rb:35:in `block (3 levels) in <top (required)>'
I would edit the failing tests to break up the output line-by-line, and ensure that these include the expected output instead of start_with.
@dblock the problem is (as put here) the issue is with the 2 tests that are doing json = Slack::Messages::Message.new(JSON[#{command}]) as command is expected to be a just a JSON string but now also contains the Top level ::CompositeIO is deprecated... warnings.
I don't see an easy way around this.
@schinery I wonder whether the deprecation warnings are going to stderr and the expected output to stdout?