Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 2.99 KB

CONTRIBUTING.md

File metadata and controls

71 lines (50 loc) · 2.99 KB

Contributor's guide

How to run tests

You can run specific tests, here is an example for the core module and the test SerdeTest#testMaps:

gradle :core:test --tests '*serde.SerdeTest.testMaps'

Note that since we are building a Multi-Release JAR, we have multiple java versions, each with their own set of tests. For instance, the sources of the Java 17 tests are in src/test/java17.

To run all the tests, do:

gradle test-everything

The results will be in the build directory of each module, in a subdirectory per test task:

How to generate code coverage reports

Run code coverage (here for the core module):

gradle :core:jacocoTestReport :core:java11JacocoTestReport :core:java17JacocoTestReport

The results will be in the build directory of each module, in a subdirectory per report task:

How to check for backward-compatibility

  1. Get the JAR files of the previous release and put them into japicmp-previous-version.
  2. Run the API compatibility check with the japicmp task of the root project:
gradle japicmp

You will find the japicmp report in build/reports/japicmp.html.

If a compatibility breaks is detected, the task will fail with an error that looks like the following:

> Task :japicmp FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':japicmp'.
> A failure occurred while executing me.champeau.gradle.japicmp.JApiCmpWorkAction
   > Detected binary changes.
         - current: core-3.7.0-beta.jar, hocon-3.7.0-beta.jar, json-3.7.0-beta.jar, toml-3.7.0-beta.jar, yaml-3.7.0-beta.jar
         - baseline: core-3.6.7.jar, hocon-3.6.7.jar, json-3.6.7.jar, toml-3.6.7.jar, yaml-3.6.7.jar.

     See failure report at file:///home/guillaume/Documents/Projets/night-config/build/reports/japicmp.html

Multi-module test suite

The Gradle module test-multiple implements tests that require multiple NightConfig modules.

In particular, it executes the tests of the language agnostic TOML test suite. To avoid a test dependency on another programming language, we don't run the provided binary, but rather reimplement the tests using the same resources (valid and invalid TOML files).