From 4a82133801151c496e148cbd7d877b58ebca28c3 Mon Sep 17 00:00:00 2001 From: Sjur Sutterud Sagen Date: Tue, 9 Apr 2024 15:10:39 +0200 Subject: [PATCH 1/4] Create ci-tests.yml for running tests in pipeline --- .github/workflows/ci-tests.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/ci-tests.yml diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml new file mode 100644 index 00000000..e853b207 --- /dev/null +++ b/.github/workflows/ci-tests.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 16.x, 18.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + 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 test From 97540ebf32d9fb53f9cb373100f55a5a18e1c80c Mon Sep 17 00:00:00 2001 From: Sjur Sutterud Sagen Date: Tue, 9 Apr 2024 15:17:55 +0200 Subject: [PATCH 2/4] Change name and node version --- .github/workflows/ci-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index e853b207..1ed450a9 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -1,7 +1,7 @@ # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs -name: Node.js CI +name: Node.js CI Tests on: push: @@ -16,7 +16,7 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x, 18.x] + node-version: [20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: From b5a81c28d571cb8c1189dec1366b329a2ce0cdd5 Mon Sep 17 00:00:00 2001 From: Sjur Sutterud Sagen Date: Tue, 9 Apr 2024 15:08:15 +0200 Subject: [PATCH 3/4] PXWEB2-166 Add command for running tests in all projects (#104) Since we need to run tests easily, in various places, we need a script for running all tests easily. Co-authored-by: Kent Mossbaeck <> Co-authored-by: Michael Pande <> Co-authored-by: Per Inge Vaaje <60141320+PerIngeVaaje@users.noreply.github.com> Co-authored-by: Mikael Nordberg <54406826+MikaelNordberg@users.noreply.github.com> --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 3222580a..62640a2d 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "start": "npx nx run pxweb2:serve", "prebuild": "npm run build-style-dictionary", "build": "nx run pxweb2:build && nx run pxweb2-ui:build-storybook", + "test": "nx run-many -t test -p pxweb2 pxweb2-ui", "start-storybook": "npx nx run pxweb2-ui:storybook", "build-storybook": "npx nx run pxweb2-ui:build-storybook", "build-style-dictionary": "node libs/pxweb2-ui/style-dictionary/build.js", From 71736fb8e33d4deaa2bb3fa3668429a4765ad342 Mon Sep 17 00:00:00 2001 From: Sjur Sutterud Sagen Date: Tue, 9 Apr 2024 15:25:38 +0200 Subject: [PATCH 4/4] Delete old, failing test from app --- apps/pxweb2/src/app/app.spec.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/apps/pxweb2/src/app/app.spec.tsx b/apps/pxweb2/src/app/app.spec.tsx index 2152cbdf..6f2c6642 100644 --- a/apps/pxweb2/src/app/app.spec.tsx +++ b/apps/pxweb2/src/app/app.spec.tsx @@ -7,9 +7,4 @@ describe('App', () => { const { baseElement } = render(); expect(baseElement).toBeTruthy(); }); - - it('should have a greeting as the title', () => { - const { getByText } = render(); - expect(getByText(/Welcome pxweb2/gi)).toBeTruthy(); - }); });