From e3d80310f590f3eee0e1a56c34ad9ca19e988c2e Mon Sep 17 00:00:00 2001 From: Isaac Cambron Date: Sat, 26 Aug 2023 14:09:39 -0400 Subject: [PATCH] upgrade node test version --- .github/workflows/test.yml | 31 +++++++-------- scripts/test | 2 +- test/datetime/format.test.js | 8 ++-- test/datetime/toFormat.test.js | 72 +++++++++++++++++----------------- 4 files changed, 56 insertions(+), 57 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f44a6b202..273e2ed69 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,13 +2,12 @@ name: Test on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build-and-test: - runs-on: ubuntu-latest env: @@ -18,18 +17,18 @@ jobs: strategy: matrix: - node-version: [19.7.0] + node-version: [20.5.1] steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run build - - run: npm run format-check - - run: npm run test - - run: npm run site - - run: bash <(curl -s https://codecov.io/bash) + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - run: npm ci + - run: npm run build + - run: npm run format-check + - run: npm run test + - run: npm run site + - run: bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/scripts/test b/scripts/test index 7eea7fedd..def0897a9 100755 --- a/scripts/test +++ b/scripts/test @@ -1,2 +1,2 @@ #!/usr/bin/env bash -TZ="America/New_York" NODE_ICU_DATA="$(pwd)/node_modules/full-icu" LANG=en_US.utf8 npm run test +TZ="America/New_York" LANG=en_US.utf8 npm run test \ No newline at end of file diff --git a/test/datetime/format.test.js b/test/datetime/format.test.js index 66ef19e5b..d598a38f7 100644 --- a/test/datetime/format.test.js +++ b/test/datetime/format.test.js @@ -426,17 +426,17 @@ test("DateTime#toLocaleString() returns something different for invalid DateTime test("DateTime#toLocaleString() shows things in the right IANA zone", () => { expect(dt.setZone("America/New_York").toLocaleString(DateTime.DATETIME_SHORT)).toBe( - "5/25/1982, 5:23 AM" + "5/25/1982, 5:23 AM" ); }); test("DateTime#toLocaleString() shows things in the right fixed-offset zone", () => { - expect(dt.setZone("UTC-8").toLocaleString(DateTime.DATETIME_SHORT)).toBe("5/25/1982, 1:23 AM"); + expect(dt.setZone("UTC-8").toLocaleString(DateTime.DATETIME_SHORT)).toBe("5/25/1982, 1:23 AM"); }); test("DateTime#toLocaleString() shows things in the right fixed-offset zone when showing the zone", () => { expect(dt.setZone("UTC-8").toLocaleString(DateTime.DATETIME_FULL)).toBe( - "May 25, 1982 at 1:23 AM GMT-8" + "May 25, 1982 at 1:23 AM GMT-8" ); }); @@ -503,7 +503,7 @@ test("DateTime#toLocaleString() accepts a zone even when the zone is set", () => timeZoneName: "short", timeZone: "America/Los_Angeles", }) - ).toBe("2:23 AM PDT"); + ).toBe("2:23 AM PDT"); }); //------ diff --git a/test/datetime/toFormat.test.js b/test/datetime/toFormat.test.js index f73b5aa0f..7f5b20b7e 100644 --- a/test/datetime/toFormat.test.js +++ b/test/datetime/toFormat.test.js @@ -3,20 +3,20 @@ import { DateTime } from "../../src/luxon"; const dt = DateTime.fromObject( - { - year: 1982, - month: 5, - day: 25, - hour: 9, - minute: 23, - second: 54, - millisecond: 123, - }, - { - zone: "utc", - } - ), - ny = dt.setZone("America/New_York", { keepLocalTime: true }); + { + year: 1982, + month: 5, + day: 25, + hour: 9, + minute: 23, + second: 54, + millisecond: 123, + }, + { + zone: "utc", + } +); +const ny = dt.setZone("America/New_York", { keepLocalTime: true }); //------ // #toFormat() @@ -414,16 +414,16 @@ test("DateTime#toFormat('TTT') returns a medium time representation", () => { }); test("DateTime#toFormat('f') returns a short date/time representation without seconds", () => { - expect(dt.toFormat("f")).toBe("5/25/1982, 9:23 AM"); - expect(dt.set({ hour: 13 }).toFormat("f")).toBe("5/25/1982, 1:23 PM"); + expect(dt.toFormat("f").replace(/\s+/g, " ")).toBe("5/25/1982, 9:23 AM"); + expect(dt.set({ hour: 13 }).toFormat("f").replace(/\s+/g, " ")).toBe("5/25/1982, 1:23 PM"); expect(dt.reconfigure({ locale: "fr" }).toFormat("f")).toBe("25/05/1982 09:23"); expect(dt.set({ hour: 13 }).reconfigure({ locale: "fr" }).toFormat("f")).toBe("25/05/1982 13:23"); }); test("DateTime#toFormat('ff') returns a medium date/time representation without seconds", () => { - expect(dt.toFormat("ff")).toBe("May 25, 1982, 9:23 AM"); - expect(dt.set({ hour: 13 }).toFormat("ff")).toBe("May 25, 1982, 1:23 PM"); - expect(dt.set({ month: 8 }).toFormat("ff")).toBe("Aug 25, 1982, 9:23 AM"); + expect(dt.toFormat("ff").replace(/\s+/g, " ")).toBe("May 25, 1982, 9:23 AM"); + expect(dt.set({ hour: 13 }).toFormat("ff").replace(/\s+/g, " ")).toBe("May 25, 1982, 1:23 PM"); + expect(dt.set({ month: 8 }).toFormat("ff").replace(/\s+/g, " ")).toBe("Aug 25, 1982, 9:23 AM"); expect(dt.reconfigure({ locale: "fr" }).toFormat("ff")).toBe("25 mai 1982, 09:23"); expect(dt.set({ month: 2 }).reconfigure({ locale: "fr" }).toFormat("ff")).toBe( "25 févr. 1982, 09:23" @@ -434,9 +434,9 @@ test("DateTime#toFormat('ff') returns a medium date/time representation without }); test("DateTime#toFormat('fff') returns a medium date/time representation without seconds", () => { - expect(ny.toFormat("fff")).toBe("May 25, 1982 at 9:23 AM EDT"); - expect(ny.set({ hour: 13 }).toFormat("fff")).toBe("May 25, 1982 at 1:23 PM EDT"); - expect(ny.set({ month: 8 }).toFormat("fff")).toBe("August 25, 1982 at 9:23 AM EDT"); + expect(ny.toFormat("fff")).toBe("May 25, 1982 at 9:23 AM EDT"); + expect(ny.set({ hour: 13 }).toFormat("fff")).toBe("May 25, 1982 at 1:23 PM EDT"); + expect(ny.set({ month: 8 }).toFormat("fff")).toBe("August 25, 1982 at 9:23 AM EDT"); expect(ny.reconfigure({ locale: "fr" }).toFormat("fff")).toBe("25 mai 1982 à 09:23 UTC−4"); expect(ny.set({ month: 2 }).reconfigure({ locale: "fr" }).toFormat("fff")).toBe( "25 février 1982 à 09:23 UTC−5" @@ -447,12 +447,12 @@ test("DateTime#toFormat('fff') returns a medium date/time representation without }); test("DateTime#toFormat('ffff') returns a long date/time representation without seconds", () => { - expect(ny.toFormat("ffff")).toBe("Tuesday, May 25, 1982 at 9:23 AM Eastern Daylight Time"); + expect(ny.toFormat("ffff")).toBe("Tuesday, May 25, 1982 at 9:23 AM Eastern Daylight Time"); expect(ny.set({ hour: 13 }).toFormat("ffff")).toBe( - "Tuesday, May 25, 1982 at 1:23 PM Eastern Daylight Time" + "Tuesday, May 25, 1982 at 1:23 PM Eastern Daylight Time" ); expect(ny.set({ month: 2 }).toFormat("ffff")).toBe( - "Thursday, February 25, 1982 at 9:23 AM Eastern Standard Time" + "Thursday, February 25, 1982 at 9:23 AM Eastern Standard Time" ); expect(ny.reconfigure({ locale: "fr" }).toFormat("ffff")).toBe( "mardi 25 mai 1982 à 09:23 heure d’été de l’Est nord-américain" @@ -466,8 +466,8 @@ test("DateTime#toFormat('ffff') returns a long date/time representation without }); test("DateTime#toFormat('F') returns a short date/time representation with seconds", () => { - expect(dt.toFormat("F")).toBe("5/25/1982, 9:23:54 AM"); - expect(dt.set({ hour: 13 }).toFormat("F")).toBe("5/25/1982, 1:23:54 PM"); + expect(dt.toFormat("F").replace(/\s+/g, " ")).toBe("5/25/1982, 9:23:54 AM"); + expect(dt.set({ hour: 13 }).toFormat("F").replace(/\s+/g, " ")).toBe("5/25/1982, 1:23:54 PM"); expect(dt.reconfigure({ locale: "fr" }).toFormat("F")).toBe("25/05/1982 09:23:54"); expect(dt.set({ hour: 13 }).reconfigure({ locale: "fr" }).toFormat("F")).toBe( "25/05/1982 13:23:54" @@ -475,9 +475,9 @@ test("DateTime#toFormat('F') returns a short date/time representation with secon }); test("DateTime#toFormat('FF') returns a medium date/time representation with seconds", () => { - expect(dt.toFormat("FF")).toBe("May 25, 1982, 9:23:54 AM"); - expect(dt.set({ hour: 13 }).toFormat("FF")).toBe("May 25, 1982, 1:23:54 PM"); - expect(dt.set({ month: 8 }).toFormat("FF")).toBe("Aug 25, 1982, 9:23:54 AM"); + expect(dt.toFormat("FF").replace(/\s+/g, " ")).toBe("May 25, 1982, 9:23:54 AM"); + expect(dt.set({ hour: 13 }).toFormat("FF").replace(/\s+/g, " ")).toBe("May 25, 1982, 1:23:54 PM"); + expect(dt.set({ month: 8 }).toFormat("FF").replace(/\s+/g, " ")).toBe("Aug 25, 1982, 9:23:54 AM"); expect(dt.reconfigure({ locale: "fr" }).toFormat("FF")).toBe("25 mai 1982, 09:23:54"); expect(dt.set({ month: 2 }).reconfigure({ locale: "fr" }).toFormat("FF")).toBe( "25 févr. 1982, 09:23:54" @@ -488,9 +488,9 @@ test("DateTime#toFormat('FF') returns a medium date/time representation with sec }); test("DateTime#toFormat('FFF') returns a medium date/time representation without seconds", () => { - expect(ny.toFormat("FFF")).toBe("May 25, 1982 at 9:23:54 AM EDT"); - expect(ny.set({ hour: 13 }).toFormat("FFF")).toBe("May 25, 1982 at 1:23:54 PM EDT"); - expect(ny.set({ month: 8 }).toFormat("FFF")).toBe("August 25, 1982 at 9:23:54 AM EDT"); + expect(ny.toFormat("FFF")).toBe("May 25, 1982 at 9:23:54 AM EDT"); + expect(ny.set({ hour: 13 }).toFormat("FFF")).toBe("May 25, 1982 at 1:23:54 PM EDT"); + expect(ny.set({ month: 8 }).toFormat("FFF")).toBe("August 25, 1982 at 9:23:54 AM EDT"); expect(ny.reconfigure({ locale: "fr" }).toFormat("FFF")).toBe("25 mai 1982 à 9:23:54 UTC−4"); expect(ny.set({ month: 2 }).reconfigure({ locale: "fr" }).toFormat("FFF")).toBe( "25 février 1982 à 9:23:54 UTC−5" @@ -501,12 +501,12 @@ test("DateTime#toFormat('FFF') returns a medium date/time representation without }); test("DateTime#toFormat('FFFF') returns a long date/time representation without seconds", () => { - expect(ny.toFormat("FFFF")).toBe("Tuesday, May 25, 1982 at 9:23:54 AM Eastern Daylight Time"); + expect(ny.toFormat("FFFF")).toBe("Tuesday, May 25, 1982 at 9:23:54 AM Eastern Daylight Time"); expect(ny.set({ hour: 13 }).toFormat("FFFF")).toBe( - "Tuesday, May 25, 1982 at 1:23:54 PM Eastern Daylight Time" + "Tuesday, May 25, 1982 at 1:23:54 PM Eastern Daylight Time" ); expect(ny.set({ month: 2 }).toFormat("FFFF")).toBe( - "Thursday, February 25, 1982 at 9:23:54 AM Eastern Standard Time" + "Thursday, February 25, 1982 at 9:23:54 AM Eastern Standard Time" ); expect(ny.reconfigure({ locale: "fr" }).toFormat("FFFF")).toBe( "mardi 25 mai 1982 à 9:23:54 heure d’été de l’Est nord-américain"