Skip to content

Commit 7a1a8c8

Browse files
adespawnZuzaOsa
authored andcommitted
Add pedantic mode
In pedantic mode any nodeJS warning will be treated as an error
1 parent d0c890b commit 7a1a8c8

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

.github/workflows/examples.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Run examples
33
env:
44
DEBUG: napi:*
55
APP_NAME: scylladb-javascript-driver
6+
PEDANTIC: true
67
"on":
78
push:
89
branches:

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ env:
55
DEBUG: napi:*
66
APP_NAME: scylladb-javascript-driver
77
RUST_BACKTRACE: full
8+
PEDANTIC: true
89
"on":
910
push:
1011
branches:

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
name: Unit tests
44
env:
55
DEBUG: napi:*
6+
PEDANTIC: true
67
"on":
78
push:
89
branches:

main.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
"use strict";
22

3+
// In pedantic mode, when any warnings are detected, exit program imminently
4+
const process = require('node:process');
5+
if (process.env.PEDANTIC == "true") {
6+
process.on('warning', (warning) => {
7+
console.warn(`Warning found in pedantic mode:`);
8+
console.warn(warning.message);
9+
console.warn(warning.stack);
10+
process.exit(1);
11+
});
12+
}
13+
314
const clientOptions = require("./lib/client-options");
415
exports.Client = require("./lib/client");
516
exports.ExecutionProfile = require("./lib/execution-profile").ExecutionProfile;

0 commit comments

Comments
 (0)