name: Run unit tests on: push: branches: - master - release - 'spring*' - 'summer*' - 'winter*' pull_request: branches: - master - release - 'spring*' - 'summer*' - 'winter*' env: PUPPETEER_SKIP_DOWNLOAD: 'true' # only needed for @best/runner-local, unused here CHROME_VERSION: 130 NODE_VERSION: '24.11.1' permissions: contents: read jobs: run-unit-tests: runs-on: ubuntu-22.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' - name: Install dependencies run: yarn install --frozen-lockfile - name: Check package.json integrity run: node ./scripts/tasks/check-and-rewrite-package-json.js --test - name: Check licenses are up to date run: node ./scripts/tasks/generate-license-files.mjs --test - name: Verify @lwc/shared is tree-shakable run: node ./scripts/tasks/verify-treeshakable.mjs ./packages/@lwc/shared/dist/index.js - name: Verify that dependencies are declared run: node ./scripts/tasks/check-imports-are-declared-dependencies.js - name: Check formatting run: yarn prettier --check '{packages,scripts}/**/*.{js,ts,json,md}' - name: Run linter run: yarn lint - name: Check the size of the LWC bundle run: yarn bundlesize - name: Check types run: yarn test:types - name: Run unit tests run: yarn test:ci - name: Run unit tests in production mode run: yarn test:production --no-watch - name: Upload unit test coverage report uses: actions/upload-artifact@v4 with: name: test-coverage-report path: coverage/ # Needed for perf smoke tests, matches the chromedriver version installed by tachometer (https://github.com/google/tachometer/blob/main/README.md#on-demand-dependencies) # chrome-version documentation can be found here: https://github.com/browser-actions/setup-chrome?tab=readme-ov-file#usage - name: Setup chrome uses: browser-actions/setup-chrome@v2 with: chrome-version: ${{ env.CHROME_VERSION }} id: setup-chrome # Pin chromedriver to the same version as Chrome above, so Tachometer uses this version. # See: https://github.com/google/tachometer#on-demand-dependencies - name: Install chromedriver run: yarn add -W chromedriver@^${{ env.CHROME_VERSION }} --ignore-scripts - name: Run benchmark smoke tests run: yarn test:performance env: BENCHMARK_SMOKE_TEST: 1 CHROME_BINARY: ${{ steps.setup-chrome.outputs.chrome-path }} - name: Add step summary # 1. Remove leading/trailing "border" lines from output # 2. Wrap file names in backticks # 3. Convert leading whitespace to non-breaking to approximate plaintext output run: sed -E '$d;1d;4,$s/^( ?)([^ ]+)/\1`\2`/g;4,$s/^ /\ \ /g' coverage/coverage.txt >> "$GITHUB_STEP_SUMMARY"