Skip to content

Merge pull request #1485 from GravityPDF/product-table-html-in-labels #2310

Merge pull request #1485 from GravityPDF/product-table-html-in-labels

Merge pull request #1485 from GravityPDF/product-table-html-in-labels #2310

name: JavaScript Tests
on: [push, pull_request]
jobs:
# Runs the QUnit tests for WordPress.
#
# Performs the following steps:
# - Cancels all previous workflow runs for pull requests that have not completed.
# - Checks out the repository.
# - Logs debug information about the runner container.
# - Installs NodeJS 12
# - Sets up caching for NPM.
# - Logs updated debug information.
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress QUnit tests.
test-js:
name: JavaScript Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node JS
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache node modules
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Log debug information
run: |
node --version
yarn --version
- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: yarn install
- name: Run Jest tests
run: yarn test:js:coverage
- name: Code Coverage
run: |
bash <(curl -s https://codecov.io/bash);