Skip to content

Commit

Permalink
Revert support for Node.js 10 (since its only goig to be a patch vers…
Browse files Browse the repository at this point in the history
…ion. Support for Node.js 10 will be dropped in the next major version)
  • Loading branch information
terehov committed Sep 1, 2021
1 parent 39e2647 commit 0684a1e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
12
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_js:
- "16"
- "14"
- "12"
- "10"

install:
- npm install
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"engines": {
"node": ">=12"
"node": ">=10"
},
"scripts": {
"ts-node": "ts-node example/index.ts",
Expand Down
28 changes: 23 additions & 5 deletions tests/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@ describe("Logger: settings", () => {
const logger: Logger = new Logger({ stdOut: std });
logger.info("test 123");

const [, , , , , , { value: hour }, , { value: minute }] =
new Intl.DateTimeFormat("en", {
let options = {};
// hourCycle only supported > Node.js 10
if (process.version.indexOf("v10") > -1) {
options = {
weekday: undefined,
year: "numeric",
month: "2-digit",
Expand All @@ -292,7 +294,23 @@ describe("Logger: settings", () => {
minute: "2-digit",
second: "2-digit",
timeZone: "utc",
}).formatToParts(new Date());
};
} else {
options = {
weekday: undefined,
year: "numeric",
month: "2-digit",
day: "2-digit",
hourCycle: "h23",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
timeZone: "utc",
};
}

const [, , , , , , { value: hour }, , { value: minute }] =
new Intl.DateTimeFormat("en", options).formatToParts(new Date());
expect(doesLogContain(stdArray, `${hour}:${minute}`)).toBeTruthy();
});

Expand All @@ -316,11 +334,11 @@ describe("Logger: settings", () => {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour12: false,
hourCycle: "h23",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
timeZone: timezone,
timeZone: "Europe/Berlin",
}).formatToParts(new Date());
expect(doesLogContain(stdArray, `${hour}:${minute}`)).toBeTruthy();
});
Expand Down

0 comments on commit 0684a1e

Please sign in to comment.