Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gajus/slonik
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v37.0.3
Choose a base ref
...
head repository: gajus/slonik
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v37.1.0
Choose a head ref
  • 8 commits
  • 7 files changed
  • 1 contributor

Commits on Oct 23, 2023

  1. test: refactor TEST_ONLY

    gajus committed Oct 23, 2023
    Copy the full SHA
    cd29a7c View commit details
  2. test: refactor test matrix

    gajus committed Oct 23, 2023
    Copy the full SHA
    969b8f8 View commit details
  3. test: refactor test matrix

    gajus committed Oct 23, 2023
    Copy the full SHA
    5c45cf6 View commit details
  4. test: add missing POSTGRES_DSN

    gajus committed Oct 23, 2023
    Copy the full SHA
    29ba255 View commit details
  5. Copy the full SHA
    d6ba07f View commit details
  6. Copy the full SHA
    7ebb09b View commit details
  7. Copy the full SHA
    1c5e3c6 View commit details
  8. Copy the full SHA
    dd97d3a View commit details
Showing with 38 additions and 130 deletions.
  1. +0 −1 .README/README.md
  2. +3 −3 .README/TESTING.md
  3. +14 −58 .github/workflows/feature.yaml
  4. +14 −60 .github/workflows/main.yaml
  5. +0 −1 README.md
  6. +4 −6 ava.config.js
  7. +3 −1 src/routines/establishConnection.ts
1 change: 0 additions & 1 deletion .README/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Slonik

[![Travis build status](http://img.shields.io/travis/gajus/slonik/master.svg?style=flat-square)](https://travis-ci.com/github/gajus/slonik)
[![NPM version](http://img.shields.io/npm/v/slonik.svg?style=flat-square)](https://www.npmjs.org/package/slonik)
[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)
[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social&label=Follow)](https://twitter.com/kuizinas)
6 changes: 3 additions & 3 deletions .README/TESTING.md
Original file line number Diff line number Diff line change
@@ -13,11 +13,11 @@ Run tests:
npm run test

# Run all non-integration tests
TEST_ONLY_NON_INTEGRATION=true npm run test
TEST_ONLY="utilities" npm run test

# Run all "pg" integration tests
TEST_ONLY_PG_INTEGRATION=true npm run test
TEST_ONLY="pg-integration" npm run test

# Run all "postgres" integration tests
TEST_ONLY_POSTGRES_INTEGRATION=true npm run test
TEST_ONLY="postgres-integration" npm run test
```
72 changes: 14 additions & 58 deletions .github/workflows/feature.yaml
Original file line number Diff line number Diff line change
@@ -34,64 +34,8 @@ jobs:
- run: npm run lint
timeout-minutes: 10
test:
env:
TEST_ONLY_NON_INTEGRATION: 'true'
environment: release
name: Test
runs-on: ubuntu-latest
steps:
- name: setup repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18'
- run: npm ci
- run: npm run test
timeout-minutes: 10
test-pg-integration:
env:
TEST_ONLY_PG_INTEGRATION: 'true'
environment: release
name: Test "pg" integration
runs-on: ubuntu-latest
services:
postgres:
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
image: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: setup repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18'
- run: npm ci
- env:
POSTGRES_DSN: postgres:postgres@localhost:5432
run: npm run test
timeout-minutes: 10
test-postgres-integration:
env:
TEST_ONLY_POSTGRES_INTEGRATION: 'true'
environment: release
name: Test "postgres" integration
name: 'Test node_version:${{ matrix.node_version }} test_only:${{ matrix.test_only }}'
runs-on: ubuntu-latest
services:
postgres:
@@ -116,11 +60,23 @@ jobs:
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18'
node-version: '${{ matrix.node_version }}'
- run: npm ci
- env:
POSTGRES_DSN: postgres:postgres@localhost:5432
TEST_ONLY: '${{ matrix.test_only }}'
run: npm run test
strategy:
fail-fast: false
matrix:
test_only:
- utilities
- pg-integration
- postgres-integration
node_version:
- 18
- 20
max-parallel: 3
timeout-minutes: 10
name: Test and build
on:
74 changes: 14 additions & 60 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -22,8 +22,6 @@ jobs:
needs:
- lint
- test
- test-pg-integration
- test-postgres-integration
runs-on: ubuntu-latest
steps:
- name: setup repository
@@ -42,64 +40,8 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
test:
env:
TEST_ONLY_NON_INTEGRATION: 'true'
environment: release
name: Test
runs-on: ubuntu-latest
steps:
- name: setup repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18'
- run: npm ci
- run: npm run test
timeout-minutes: 10
test-pg-integration:
env:
TEST_ONLY_PG_INTEGRATION: 'true'
environment: release
name: Test "pg" integration
runs-on: ubuntu-latest
services:
postgres:
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
image: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: setup repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: setup node.js
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18'
- run: npm ci
- env:
POSTGRES_DSN: postgres:postgres@localhost:5432
run: npm run test
timeout-minutes: 10
test-postgres-integration:
env:
TEST_ONLY_POSTGRES_INTEGRATION: 'true'
environment: release
name: Test "postgres" integration
name: 'Test node_version:${{ matrix.node_version }} test_only:${{ matrix.test_only }}'
runs-on: ubuntu-latest
services:
postgres:
@@ -124,11 +66,23 @@ jobs:
uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '18'
node-version: '${{ matrix.node_version }}'
- run: npm ci
- env:
POSTGRES_DSN: postgres:postgres@localhost:5432
TEST_ONLY: '${{ matrix.test_only }}'
run: npm run test
strategy:
fail-fast: false
matrix:
test_only:
- utilities
- pg-integration
- postgres-integration
node_version:
- 18
- 20
max-parallel: 3
timeout-minutes: 10
name: Lint, build and release
on:
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
<a name="slonik"></a>
# Slonik

[![Travis build status](http://img.shields.io/travis/gajus/slonik/master.svg?style=flat-square)](https://travis-ci.com/github/gajus/slonik)
[![NPM version](http://img.shields.io/npm/v/slonik.svg?style=flat-square)](https://www.npmjs.org/package/slonik)
[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)
[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social&label=Follow)](https://twitter.com/kuizinas)
10 changes: 4 additions & 6 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
const {
TEST_ONLY_NON_INTEGRATION,
TEST_ONLY_PG_INTEGRATION,
TEST_ONLY_POSTGRES_INTEGRATION,
TEST_ONLY,
// eslint-disable-next-line node/no-process-env
} = process.env;

module.exports = () => {
let files = ['test/slonik/**/*'];

if (TEST_ONLY_NON_INTEGRATION) {
if (TEST_ONLY === 'utilities') {
files = ['test/slonik/**/*', '!test/slonik/integration'];
}

if (TEST_ONLY_PG_INTEGRATION) {
if (TEST_ONLY === 'pg-integration') {
files = ['test/slonik/integration/pg.ts'];
}

if (TEST_ONLY_POSTGRES_INTEGRATION) {
if (TEST_ONLY === 'postgres-integration') {
files = ['test/slonik/integration/postgres.ts'];
}

4 changes: 3 additions & 1 deletion src/routines/establishConnection.ts
Original file line number Diff line number Diff line change
@@ -47,7 +47,9 @@ export const establishConnection = async (

continue;
} else {
throw new ConnectionError(error.message);
throw new ConnectionError(error.message, {
cause: error,
});
}
}
}