From 73961bffc16b2941d5c2674faa12b08d4a9d94ff Mon Sep 17 00:00:00 2001 From: Eric Cornelissen Date: Sat, 21 Oct 2023 17:42:18 +0200 Subject: [PATCH] Document breakage testing in the contributing guidelines --- CONTRIBUTING.md | 13 +++++++++++++ package.json | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fd64032f..0ad7924c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -353,6 +353,19 @@ compatibility tests on all applicable Node.js versions. In the project's continuous integration the compatibility tests are run for all supported Node.js versions as well. +#### Breakage Testing + +The breakage tests aim to ensure that the API of the library isn't broken from +release to release. All breakage tests go into the `test/breakage/` folder. You +can run the breakage test using the command `npm run test:breakage`. + +Breakage test compare both the API itself as well as the behavior of every +function of the API. This is achieved by depending on the latest version of the +library and using it in a differential test for each function in the API. + +Unless the API is extended or a breaking API change is necessary this suite does +not need to be updated. + ### Writing Tests Tests can be written in different ways and using different strategies. This diff --git a/package.json b/package.json index 51cc1ebf3..bb6f7c8a3 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,8 @@ "audit:runtime": "better-npm-audit audit --production", "benchmark": "node bench/bench.js", "clean": "node script/clean.js", - "coverage": "npm run coverage:unit && npm run coverage:integration && npm run coverage:e2e && npm run coverage:compat", + "coverage": "npm run coverage:unit && npm run coverage:integration && npm run coverage:e2e && npm run coverage:compat && npm run coverage:breakage", + "coverage:breakage": "c8 --config .c8/breakage.json npm run test:breakage", "coverage:compat": "c8 --config .c8/compat.json npm run test:compat", "coverage:e2e": "node script/run-platform-coverage.js e2e", "coverage:e2e:unix": "c8 --config .c8/e2e-unix.json npm run test:e2e", @@ -122,7 +123,8 @@ "mutation": "npm run mutation:unit && npm run mutation:integration", "mutation:integration": "stryker run stryker.integration.config.js", "mutation:unit": "stryker run stryker.unit.config.js", - "test": "npm run test:unit && npm run test:integration && npm run test:e2e && npm run test:compat", + "test": "npm run test:unit && npm run test:integration && npm run test:e2e && npm run test:compat && npm run test:breakage", + "test:breakage": "ava test/breakage/**/*.test.js", "test:compat": "ava test/compat/**/*.test.js", "test:compat-all": "nve 14.18.0,16.13.0,18.0.0,19.0.0,20.0.0 npm run test:compat --ignore-scripts", "test:e2e": "ava test/e2e/**/*.test.js --timeout 1m",