From 7281940a3a86813e9a1b729c371a1c5a666f5615 Mon Sep 17 00:00:00 2001 From: Tom Jenkinson Date: Tue, 11 Jun 2024 16:04:35 +0100 Subject: [PATCH] Add CI and set timezone to UTC for tests (#265) * Set timezone to UTC for tests * Add CI --- .github/workflows/build.yml | 23 +++++++++++++++++++++++ package.json | 4 ++-- test/utils/set-alarm.spec.js | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..049da20 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: Build and Test + +on: + push: + pull_request: + +permissions: + contents: read + +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + - name: npm install, build and test + run: | + npm ci + npm run build + npm test diff --git a/package.json b/package.json index 3bc8077..bf4b9a9 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,8 @@ "main": "./dist/index.js", "types": "index.d.ts", "scripts": { - "start": "mocha --require @babel/register --watch --recursive", - "test": "mocha --require @babel/register --recursive", + "start": "TZ=utc mocha --require @babel/register --watch --recursive", + "test": "TZ=utc mocha --require @babel/register --recursive", "build": "rm -r dist; gulp build" }, "repository": { diff --git a/test/utils/set-alarm.spec.js b/test/utils/set-alarm.spec.js index 6abe9c2..8a94797 100644 --- a/test/utils/set-alarm.spec.js +++ b/test/utils/set-alarm.spec.js @@ -26,7 +26,7 @@ describe('utils.setAlarm', () => { `DESCRIPTION:Foo`, `DURATION:P1W15DT3H4M50S`, `ATTACH;FMTTYPE=audio/basic:ftp://example.com/pub/sounds/bell-01.aud`, - `TRIGGER;VALUE=DATE-TIME:19970217T113000Z`, + `TRIGGER;VALUE=DATE-TIME:19970217T063000Z`, `SUMMARY:Bar baz`, `END:VALARM`, ``