Skip to content

Commit 0684a1e

Browse files
committed
Revert support for Node.js 10 (since its only goig to be a patch version. Support for Node.js 10 will be dropped in the next major version)
1 parent 39e2647 commit 0684a1e

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14
1+
12

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_js:
33
- "16"
44
- "14"
55
- "12"
6+
- "10"
67

78
install:
89
- npm install

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"module": "./dist/esm/index.js",
77
"types": "./dist/types/index.d.ts",
88
"engines": {
9-
"node": ">=12"
9+
"node": ">=10"
1010
},
1111
"scripts": {
1212
"ts-node": "ts-node example/index.ts",

tests/settings.test.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,10 @@ describe("Logger: settings", () => {
281281
const logger: Logger = new Logger({ stdOut: std });
282282
logger.info("test 123");
283283

284-
const [, , , , , , { value: hour }, , { value: minute }] =
285-
new Intl.DateTimeFormat("en", {
284+
let options = {};
285+
// hourCycle only supported > Node.js 10
286+
if (process.version.indexOf("v10") > -1) {
287+
options = {
286288
weekday: undefined,
287289
year: "numeric",
288290
month: "2-digit",
@@ -292,7 +294,23 @@ describe("Logger: settings", () => {
292294
minute: "2-digit",
293295
second: "2-digit",
294296
timeZone: "utc",
295-
}).formatToParts(new Date());
297+
};
298+
} else {
299+
options = {
300+
weekday: undefined,
301+
year: "numeric",
302+
month: "2-digit",
303+
day: "2-digit",
304+
hourCycle: "h23",
305+
hour: "2-digit",
306+
minute: "2-digit",
307+
second: "2-digit",
308+
timeZone: "utc",
309+
};
310+
}
311+
312+
const [, , , , , , { value: hour }, , { value: minute }] =
313+
new Intl.DateTimeFormat("en", options).formatToParts(new Date());
296314
expect(doesLogContain(stdArray, `${hour}:${minute}`)).toBeTruthy();
297315
});
298316

@@ -316,11 +334,11 @@ describe("Logger: settings", () => {
316334
year: "numeric",
317335
month: "2-digit",
318336
day: "2-digit",
319-
hour12: false,
337+
hourCycle: "h23",
320338
hour: "2-digit",
321339
minute: "2-digit",
322340
second: "2-digit",
323-
timeZone: timezone,
341+
timeZone: "Europe/Berlin",
324342
}).formatToParts(new Date());
325343
expect(doesLogContain(stdArray, `${hour}:${minute}`)).toBeTruthy();
326344
});

0 commit comments

Comments
 (0)