From 0359290dcd319bfab12a0beec4805373b8d58c19 Mon Sep 17 00:00:00 2001 From: "Zach \"theY4Kman\" Kanzler" Date: Thu, 10 Jun 2021 00:33:10 -0400 Subject: [PATCH 1/2] fix(tests): resolve exit code 5 (no tests collected) returned from pytest --- package.json | 2 +- test/integration/tests/mocha.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9835c07..5c7d6f5 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "prepare": "npm run build", "test": "npm run test:unit; npm run test:integration", "test:unit": "mocha", - "test:integration": "pipenv run py.test || true" + "test:integration": "pipenv run py.test" }, "repository": { "type": "git", diff --git a/test/integration/tests/mocha.py b/test/integration/tests/mocha.py index 4ebbe7c..bee961c 100644 --- a/test/integration/tests/mocha.py +++ b/test/integration/tests/mocha.py @@ -231,6 +231,13 @@ def pytest_collection(session: pytest.Session): session.items.append(test) + ### + # NOTE: if this counter remains 0 at end of session, an exit code of 5 will be returned. + # This value is normally set by Session.perform_collect(), but we are bypassing that + # implementation. + # + session.testscollected = len(session.items) + return session.items From b7fad8f658fde06591e586eefe501874951c9f42 Mon Sep 17 00:00:00 2001 From: "Zach \"theY4Kman\" Kanzler" Date: Thu, 10 Jun 2021 00:22:21 -0400 Subject: [PATCH 2/2] chore(ci): add unit/integration test GitHub actions --- .github/workflows/integration.yml | 35 +++++++++++++++++++++++++++++++ .github/workflows/mocha.yml | 26 +++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/integration.yml create mode 100644 .github/workflows/mocha.yml diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..c6adba3 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,35 @@ +name: Integration tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip pipenv + pipenv install --dev + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - name: Install redis-server + uses: shogo82148/actions-setup-redis@v1 + with: + redis-version: '6.x' + auto-start: false + - run: npm ci + - run: npm run test:integration + diff --git a/.github/workflows/mocha.yml b/.github/workflows/mocha.yml new file mode 100644 index 0000000..3a87072 --- /dev/null +++ b/.github/workflows/mocha.yml @@ -0,0 +1,26 @@ +name: Mocha tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x, 15.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm run test:unit +