From 40331bea7f09a212a8b6e6b988cda8e879e1e867 Mon Sep 17 00:00:00 2001 From: Kar Rui Lau Date: Wed, 5 Oct 2022 09:58:24 +0800 Subject: [PATCH] chore(v2): misc build pipeline updates in preparation for merging into main branch (#5010) * fix(test): update AngularJS's feedback generator quote check should not have any quotes prefix since AngularJS's generator had no changes * chore: run correct AngularJS test script in GitHub Actions * fix: update test-e2e-build command * feat: update validator package to v13.7.0 * chore: update github actions workflows to work on any branch * chore: update chromatic to run on all branches --- .github/workflows/chromatic.yml | 7 ++-- .github/workflows/ci-angularjs.yml | 32 +------------------ .github/workflows/ci-react.yml | 8 ----- package-lock.json | 18 +++++------ package.json | 3 +- shared/package-lock.json | 14 ++++---- shared/package.json | 2 +- .../__tests__/FeedbackCsvGenerator.spec.ts | 5 +-- 8 files changed, 25 insertions(+), 64 deletions(-) diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 1c9b75e229..d085fa8556 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -12,11 +12,8 @@ on: push: branches: - 'form-v2/develop' + - 'develop' pull_request: - branches: - # PR events to branches matching refs/heads/form-v2 - - 'form-v2' - - 'form-v2/**' # List of jobs jobs: @@ -41,6 +38,6 @@ jobs: # 👇 Chromatic projectToken, refer to the manage page to obtain it. projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} workingDir: frontend - autoAcceptChanges: form-v2/develop + autoAcceptChanges: develop exitOnceUploaded: true onlyChanged: true diff --git a/.github/workflows/ci-angularjs.yml b/.github/workflows/ci-angularjs.yml index cf7b6d179c..c324734c34 100644 --- a/.github/workflows/ci-angularjs.yml +++ b/.github/workflows/ci-angularjs.yml @@ -2,15 +2,7 @@ name: CI (AngularJS) on: push: - branches-ignore: - # Push events to branches matching refs/heads/form-v2 - - 'form-v2' - - 'form-v2/**' pull_request: - branches-ignore: - # PRs to branches matching refs/heads/form-v2 - - 'form-v2' - - 'form-v2/**' types: [opened, reopened] jobs: @@ -104,26 +96,4 @@ jobs: path: ~/.npm key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} - run: npm ci - - run: npm run test:frontend - - test-backend: - needs: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - name: Load Node.js modules - uses: actions/cache@v2 - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} - - run: npm ci - - run: npm run test-backend - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} + - run: npm run test:angularjs diff --git a/.github/workflows/ci-react.yml b/.github/workflows/ci-react.yml index 08b8b1088b..e3b8d4a803 100644 --- a/.github/workflows/ci-react.yml +++ b/.github/workflows/ci-react.yml @@ -2,15 +2,7 @@ name: CI (React) on: push: - branches: - # Push events to branches matching refs/heads/form-v2 - - 'form-v2' - - 'form-v2/**' pull_request: - branches: - # PR events to branches matching refs/heads/form-v2 - - 'form-v2' - - 'form-v2/**' types: [opened, reopened] jobs: diff --git a/package-lock.json b/package-lock.json index cd3ce4389d..99be8b946e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9909,7 +9909,7 @@ "buffer-equal-constant-time": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, "buffer-from": { "version": "1.1.1", @@ -22227,12 +22227,12 @@ "lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" }, "lodash.isboolean": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" }, "lodash.isempty": { "version": "4.4.0", @@ -22247,22 +22247,22 @@ "lodash.isinteger": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" }, "lodash.isnumber": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" }, "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==" + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" }, "lodash.isstring": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==" + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" }, "lodash.kebabcase": { "version": "4.1.1", @@ -22284,7 +22284,7 @@ "lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" }, "lodash.pick": { "version": "4.4.0", @@ -26696,7 +26696,7 @@ "retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==" + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" }, "reusify": { "version": "1.0.4", diff --git a/package.json b/package.json index 0c6784b101..35f9ee84a3 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "test:backend:watch": "env-cmd -f tests/.test-env jest --watch", "test:frontend": "npm --prefix frontend test", "build": "npm run clean && npm run build:backend && npm run build:frontend && npm run build:old-frontend", + "test:angularjs": "jest --config=tests/unit/frontend/jest.config.js", "dev:angularjs": "webpack --config webpack.dev.js", "build:old-frontend": "webpack --config webpack.prod.js", "build:frontend": "npm run --prefix frontend build", @@ -42,7 +43,7 @@ "test": "npm run test:backend && npm run test:frontend", "download-binary": "node tests/end-to-end/helpers/get-mongo-binary.js", "test-e2e": "npm run test-e2e-build && npm run test-e2e-ci", - "test-e2e-build": "npm run build-backend && npm run build-frontend-dev", + "test-e2e-build": "npm run build:backend && npm run dev:angularjs", "test-e2e-ci": "env-cmd -f tests/.test-env --use-shell \"npm run download-binary && npm run testcafe-command\"", "testcafe-command": "testcafe --skip-js-errors -c 2 chrome:headless ./tests/end-to-end --app \"npm run test-e2e-server\" --app-init-delay 10000", "test-e2e-server": "concurrently --success last --kill-others \"mockpass\" \"maildev\" \"node dist/backend/src/app/server.js\" \"node ./tests/mock-webhook-server.js\"", diff --git a/shared/package-lock.json b/shared/package-lock.json index 6f19238200..eb632b3703 100644 --- a/shared/package-lock.json +++ b/shared/package-lock.json @@ -299,7 +299,7 @@ "immediate": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" }, "inherits": { "version": "2.0.4", @@ -330,7 +330,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "json-stringify-safe": { "version": "5.0.1", @@ -486,7 +486,7 @@ "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" }, "slash": { "version": "3.0.0", @@ -534,12 +534,12 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "validator": { - "version": "13.6.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.6.0.tgz", - "integrity": "sha512-gVgKbdbHgtxpRyR8K0O6oFZPhhB5tT1jeEHZR0Znr9Svg03U0+r9DXWMrnRAB+HtCStDQKlaIZm42tVsVjqtjg==" + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz", + "integrity": "sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==" }, "yallist": { "version": "4.0.0", diff --git a/shared/package.json b/shared/package.json index 0d373b07c3..8cbd588bf6 100644 --- a/shared/package.json +++ b/shared/package.json @@ -9,7 +9,7 @@ "libphonenumber-js": "^1.9.43", "lodash": "^4.17.21", "type-fest": "^2.8.0", - "validator": "^13.6.0", + "validator": "^13.7.0", "zod": "^3.11.6" }, "devDependencies": { diff --git a/src/public/modules/forms/helpers/__tests__/FeedbackCsvGenerator.spec.ts b/src/public/modules/forms/helpers/__tests__/FeedbackCsvGenerator.spec.ts index fbff57e6fb..5e2c73e786 100644 --- a/src/public/modules/forms/helpers/__tests__/FeedbackCsvGenerator.spec.ts +++ b/src/public/modules/forms/helpers/__tests__/FeedbackCsvGenerator.spec.ts @@ -66,7 +66,8 @@ describe('FeedbackCsvGenerator', () => { ) }) - it('should add single quote before comment if comment starts with a formula character', () => { + // Testing for no regression in this generator as compared to the one in React. + it('should not add single quote before comment if comment starts with a formula character', () => { // Arrange const feedbackCsv = new FeedbackCsvGenerator(1) const feedback: FormFeedbackDto = { @@ -82,7 +83,7 @@ describe('FeedbackCsvGenerator', () => { .tz('Asia/Singapore') .format('DD MMM YYYY hh:mm:ss A') - const insertedLine = `${insertedCreatedDate},'${feedback.comment},${feedback.rating}` + const insertedLine = `${insertedCreatedDate},${feedback.comment},${feedback.rating}` // Act feedbackCsv.addLineFromFeedback(feedback)