Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github action for testing #404

Merged
merged 9 commits into from
Oct 22, 2024
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ workflows:
jobs:
- fauna-shell-tests:
context: faunadb-drivers
filters:
branches:
# only build the branch "main"
# and branches ending in "-old"
only:
- main
- /^.+-old$/
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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: Test

on:
# temporarily "v3"; change to "main" after merge
push:
branches: [ "v3" ]
pull_request:
branches: [ "v3" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Test (nodeJS ${{ matrix.node-version }})
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm test
env:
TERM: xterm-256color
# Set to the correct color level; 2 is 256 colors
# https://github.com/chalk/chalk?tab=readme-ov-file#supportscolor
FORCE_COLOR: 2
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: '**/test-results.xml'
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fauna-shell",
"description": "faunadb shell",
"version": "3.0.0-beta",
"version": "4.0.0-beta",
"author": "Fauna",
"type": "module",
"bin": {
Expand Down Expand Up @@ -43,7 +43,7 @@
"typescript": "^5.6.3"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"files": [
"/user-entrypoint.mjs",
Expand All @@ -62,7 +62,6 @@
"main": "./user-entrypoint.mjs",
"repository": "fauna/fauna-shell",
"scripts": {
"postpack": "rm -f oclif.manifest.json",
"pretest": "npm run fixlint",
"local-test": "mocha --recursive ./test --require ./test/mocha-root-hooks.mjs",
"lint": "eslint .",
Expand Down
2 changes: 1 addition & 1 deletion test/general-cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe("cli operations", function () {
expect(updateNotifier).to.have.been.calledWith({
pkg: packageJson,
updateCheckInterval: 1000 * 60 * 60 * 24 * 7, // 1 week
})
});
expect(notify).to.have.been.called;
});

Expand Down