Skip to content

Commit

Permalink
Add EARL_OFFICIAL env var.
Browse files Browse the repository at this point in the history
When set to truthy string will setup tests that are run for official
test result reports.
  • Loading branch information
davidlehn committed Oct 5, 2023
1 parent 758d29c commit a01c5ae
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- **BREAKING**: Check output `format` parameter. Must be omitted, falsy, or
"application/n-quads".
- Add EARL Turtle test result mode.
- Add `EARL_OFFICIAL` env flag to setep official test report mode.
- Add `"react-native"` section to `package.json` (same as `"browser"`), and
instructions for how to use this library with React Native.

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,12 @@ To generate EARL reports:
EARL=earl-node.jsonld npm test

# generate a Turtle EARL report with Node.js
# used for official reports
EARL=js-rdf-canonize-earl.ttl npm test

# generate official Turtle EARL report with Node.js
# turns ASYNC on and SYNC and WEBCRYPTO off
EARL_OFFICIAL=true EARL=js-rdf-canonize-earl.ttl npm test

Benchmark
---------

Expand Down
3 changes: 3 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ module.exports = function(config) {
'process.env.BAIL': JSON.stringify(process.env.BAIL),
'process.env.BENCHMARK': JSON.stringify(process.env.BENCHMARK),
'process.env.EARL': JSON.stringify(process.env.EARL),
'process.env.EARL_OFFICIAL':
JSON.stringify(process.env.EARL_OFFICIAL),
'process.env.SYNC': JSON.stringify(process.env.SYNC),
'process.env.TESTS': JSON.stringify(process.env.TESTS),
'process.env.TEST_ENV': JSON.stringify(process.env.TEST_ENV),
Expand Down Expand Up @@ -97,6 +99,7 @@ module.exports = function(config) {
BAIL: process.env.BAIL,
BENCHMARK: process.env.BENCHMARK,
EARL: process.env.EARL,
EARL_OFFICIAL: process.env.EARL_OFFICIAL,
SYNC: process.env.SYNC,
TESTS: process.env.TESTS,
TEST_ENV: process.env.TEST_ENV,
Expand Down
1 change: 1 addition & 0 deletions test/test-karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const env = {
ASYNC: process.env.ASYNC,
BAIL: process.env.BAIL,
BENCHMARK: process.env.BENCHMARK,
EARL_OFFICIAL: process.env.EARL_OFFICIAL,
SYNC: process.env.SYNC,
TEST_ENV: process.env.TEST_ENV,
VERBOSE_SKIP: process.env.VERBOSE_SKIP,
Expand Down
1 change: 1 addition & 0 deletions test/test-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const env = {
ASYNC: process.env.ASYNC,
BAIL: process.env.BAIL,
BENCHMARK: process.env.BENCHMARK,
EARL_OFFICIAL: process.env.EARL_OFFICIAL,
SYNC: process.env.SYNC,
TEST_ENV: process.env.TEST_ENV,
VERBOSE_SKIP: process.env.VERBOSE_SKIP,
Expand Down
7 changes: 5 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ const bailOnError = isTrue(options.env.BAIL || 'false');
const verboseSkip = isTrue(options.env.VERBOSE_SKIP || 'false');

const doAsync = isTrue(options.env.ASYNC || 'true');
const doSync = isTrue(options.env.SYNC || 'true');
const doWebCrypto = isTrue(options.env.WEBCRYPTO || 'true') && options.nodejs;
const doSync = isTrue(options.env.SYNC || 'true') &&
!isTrue(options.env.EARL_OFFICIAL || 'false');
const doWebCrypto = isTrue(options.env.WEBCRYPTO || 'true') &&
!isTrue(options.env.EARL_OFFICIAL || 'false') &&
options.nodejs;

const benchmarkOptions = {
enabled: false,
Expand Down

0 comments on commit a01c5ae

Please sign in to comment.