• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

I Like Kill Nerds

The blog of Australian Front End / Aurelia Javascript Developer & brewing aficionado Dwayne Charrington // Aurelia.io Core Team member.

  • Home
  • Aurelia 2
  • Aurelia 1
  • About
  • Aurelia 2 Consulting/Freelance Work

Writing a GitHub Actions File To Test Against Multiple Node.js Versions

GitHub · February 23, 2023

If you’re distributing a package, say a plugin, you may want to test it against multiple Node versions (especially if you’re using Jest for tests). In my situation, I have a popular plugin for Aurelia called Aurelia Google Maps. It’s for Aurelia 1, but many people use it, so I wanted to test it against the LTS of Node and the latest version.

name: Node.js Jest Tests

on: [push, pull_request]

jobs:
  build-and-test:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'yarn'

    - name: Install dependencies
      run: yarn install

    - name: Run Jest tests
      run: yarn test

    strategy:
      matrix:
        node-version: [18.x, 19.x]

You will want to save this file in your .github/workflows directory at the root of your project. You can save it as whatever you want: run-tests.yml

As you can see in the on part, the tests will run on every push and pull request. It’s also worth going in and ensuring you have some rules to ensure only pull requests that pass the tests meet the criteria for merging too.

Dwayne

Leave a Reply Cancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular

  • Thoughts on the Flipper Zero
  • I Joined Truth Social Using a VPN and Editing Some HTML to Bypass the Phone Verification
  • How To Install Eufy Security Cameras Without Drilling or Using Screws
  • How To Get The Hash of A File In Node.js
  • Wild Natural Deodorant Review
  • The Most Common iPhone Passcodes (and how to guess them)
  • Improving The Coopers Australian Pale Ale Extract Tin (and other tips)
  • NBN Box Installed Inside of Garage, Where Do You Put The Modem?
  • Neural DSP Reveal Details About the Long-Awaited Quad Cortex Desktop Editor
  • How To Paginate An Array In Javascript

Recent Comments

  • CJ on Microsoft Modern Wireless Headset Review
  • Dwayne on Microsoft Modern Wireless Headset Review
  • CJ on Microsoft Modern Wireless Headset Review
  • john on Microsoft Modern Wireless Headset Review
  • Dwayne on Why You Should Be Using globalThis Instead of Window In Your Javascript Code

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz