Add source location URL to CI test failures.#311
Conversation
| G: Concurrent[F], | ||
| C: Clock[F]): F[TestOutcome] = { | ||
| C: Clock[F], | ||
| E: Env[F] |
There was a problem hiding this comment.
I'm not sure it's necessary for the change to impact these layers of the framework. You could centralise the querying of the environment in the formatter (in an unsafe fashion), and apply the github-specific rendering there.
I appreciate that reading the environment does not fall strictly in the pure-FP paradigm that Typelevel ougth to strive for, but the sbt-test-interface that weaver implements forces some compromise onto us. I'm happy to deviate a little bit out of the CE idioms if it minimises the impact / the amount of things the information needs to be threaded through. Additionally, the set of environment variables is pretty much immutable during the lifetime of a program.
There was a problem hiding this comment.
I'd be happy to remove it with querying within the formatter, but it would be good if we could still test the code path.
In particular, our DogFoodTests should render the same message when running locally to in CI. We do this currently by overriding the Env here. It alsp allows us to test the codepath for the WEAVER_SOURCE_URL, as currently done here.
One alternative is to pass the suite's isCI boolean value through to Test and Result. The same information would need to be threaded through, so the code wouldn't necessarily be cleaner.
Another approach, if possible, would be for us to set WEAVER_SOURCE_URL within our own SBT build environment variables. We wouldn't be able to test the WEAVER_SOURCE_URL codepath, but the DogFoodTests would render the same output. I'll experiment with this.
There was a problem hiding this comment.
The environment variable in SBT works for running DogFoodTests agnostic to CI.
Note that we need to have a different implementation for JS that uses process.env. @Baccata , what do you think of this approach?
20ce5f8 to
e6ea5fe
Compare
| newlines.implicitParamListModifierPrefer = before | ||
| newlines.sometimesBeforeColonInMethodReturnType = false | ||
|
|
||
| assumeStandardLibraryStripMargin = true |
There was a problem hiding this comment.
This helps with the assertInlineSnapshot tests - updated tests now include stripMargin, but they're not aligned without scalafmt.
EDIT: I've moved it to PR #313 to make this diff easier.
e6ea5fe to
6dce82c
Compare
6dce82c to
7271981
Compare
7271981 to
6597dea
Compare
6597dea to
e38a503
Compare
| [error] <a href="https://github.com/typelevel/weaver-test/tree/4390ba8e91faa6e9ed2e0d112271d9c8e80d7034/modules/framework-cats/shared/src/test/scala/ExpectationsTests.scala#L107">https://github.com/typelevel/weaver-test/tree/4390ba8e91faa6e9ed2e0d112271d9c8e80d7034/modules/framework-cats/shared/src/test/scala/ExpectationsTests.scala#L107</a> | ||
| [error] expect.eql(1, 2) | ||
| [error] ^""" | ||
| </pre></div> |
Baccata
left a comment
There was a problem hiding this comment.
Great idea, and great work !

This resolves #310 .
Source locations in GitHub Actions are displayed as navigable URLs. This can be configured for other CI providers using the
WEAVER_SOURCE_URLenvironment variable.Example
You can find an example in our own GitHub Actions logs

Public API changes
While this is a breaking API change, most users aren't affected by it.
Testconstructor requires an implicitEnv. Most users writing custom test functions will be usingIO, so will have this already.EffectCompatnow requires anEnv. This affects anyone implementing custom effect types.