mirror of
https://github.com/Cameri/nostream.git
synced 2025-05-03 06:30:15 +02:00
chore(ci): add intg tests coverage
This commit is contained in:
parent
b14f3b536a
commit
321e65014e
@ -1,6 +1,7 @@
|
||||
dist
|
||||
node_modules
|
||||
.test-report
|
||||
.github
|
||||
.test-reports
|
||||
.coverage
|
||||
seeds
|
||||
test
|
||||
@ -8,8 +9,8 @@ test
|
||||
.eslint*
|
||||
.mocha*
|
||||
.nvmrc
|
||||
.nycrc*
|
||||
.nyc_output
|
||||
docker-compose.yml
|
||||
Dockerfile
|
||||
*.env
|
||||
*.md
|
||||
*.md
|
@ -1,2 +1,4 @@
|
||||
node_modules
|
||||
dist
|
||||
.test-reports
|
||||
.coverage
|
||||
|
36
.github/workflows/checks.yml
vendored
36
.github/workflows/checks.yml
vendored
@ -10,8 +10,6 @@ jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:18-alpine3.16
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
@ -22,11 +20,9 @@ jobs:
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npm run lint
|
||||
build:
|
||||
name: Build
|
||||
build-check:
|
||||
name: Build check
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:18-alpine3.16
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
@ -36,12 +32,10 @@ jobs:
|
||||
- name: Install package dependencies
|
||||
run: npm ci
|
||||
- name: Run ESLint
|
||||
run: npm run build
|
||||
test-and-cover:
|
||||
name: Unit Tests
|
||||
run: npm run build:check
|
||||
test-units-and-cover:
|
||||
name: Unit Tests And Coverage
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:18-alpine3.16
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
@ -53,16 +47,20 @@ jobs:
|
||||
- name: Run unit tests
|
||||
run: npm run test:unit
|
||||
- name: Run coverage for unit tests
|
||||
run: npm run cover
|
||||
run: npm run cover:unit
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
path-to-lcov: ./.coverage/lcov.info
|
||||
path-to-lcov: ./.coverage/unit/lcov.info
|
||||
flag-name: Unit
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
test-integration:
|
||||
name: Integration Tests
|
||||
test-integrations-and-cover:
|
||||
name: Integration Tests and Coverage
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- lint
|
||||
- build-check
|
||||
- test-units-and-cover
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
@ -70,3 +68,11 @@ jobs:
|
||||
node-version-file: .nvmrc
|
||||
- name: Run integration tests
|
||||
run: npm run docker:test:integration
|
||||
- name: Run coverage for integration tests
|
||||
run: npm run docker:cover:integration
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
path-to-lcov: ./.coverage/integration/lcov.info
|
||||
flag-name: Integration
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,7 +5,7 @@ npm-debug.log*
|
||||
|
||||
# Coverage
|
||||
.nyc_output
|
||||
.test-report
|
||||
.test-reports
|
||||
.coverage
|
||||
|
||||
# Dependency directories
|
||||
|
@ -3,11 +3,10 @@ module.exports = {
|
||||
require: ['ts-node/register'],
|
||||
reporter: 'mochawesome',
|
||||
slow: 75,
|
||||
sorted: true,
|
||||
'inline-diff': true,
|
||||
diff: true,
|
||||
'reporter-option': [
|
||||
'reportDir=.test-report',
|
||||
'reportDir=.test-reports/unit',
|
||||
'reportFilename=index',
|
||||
'quiet=true',
|
||||
'json=false',
|
||||
|
@ -23,7 +23,6 @@
|
||||
95
|
||||
]
|
||||
},
|
||||
"report-dir": ".coverage",
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
|
@ -1,12 +1,19 @@
|
||||
const config = [
|
||||
const base = [
|
||||
'test/integration/features/**/*.feature',
|
||||
'--require-module ts-node/register',
|
||||
'--require test/integration/features/**/*.ts',
|
||||
'--require test/integration/features/*.ts',
|
||||
].join(' ')
|
||||
|
||||
const config = [
|
||||
base,
|
||||
'--format @cucumber/pretty-formatter',
|
||||
'--format html:.test-reports/integration/report.html',
|
||||
'--format json:.test-reports/integration/report.json',
|
||||
'--publish',
|
||||
].join(' ')
|
||||
|
||||
module.exports = {
|
||||
default: config,
|
||||
cover: base,
|
||||
}
|
||||
|
22
package.json
22
package.json
@ -17,7 +17,7 @@
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
"dev": "node -r ts-node/register src/index.ts",
|
||||
"clean": "rimraf ./dist",
|
||||
"clean": "rimraf ./{dist,.nyc_output,.test-reports,.coverage}",
|
||||
"build": "tsc --project tsconfig.build.json",
|
||||
"prestart": "npm run build",
|
||||
"start": "cd dist && node src/index.js",
|
||||
@ -27,16 +27,24 @@
|
||||
"db:migrate": "knex migrate:latest",
|
||||
"db:migrate:rollback": "knex migrate:rollback",
|
||||
"db:seed": "knex seed:run",
|
||||
"pretest:unit": "mkdir -p .test-reports/unit",
|
||||
"test:unit": "mocha 'test/**/*.spec.ts'",
|
||||
"pretest:integration": "mkdir -p .test-reports/integration",
|
||||
"test:integration": "cucumber-js",
|
||||
"cover:integration": "nyc --report-dir .coverage/integration npm run --ignore-scripts test:integration",
|
||||
"test:unit:watch": "npm run test:unit -- --min --watch --watch-files src/**/*,test/**/*",
|
||||
"cover": "nyc npm run test:unit",
|
||||
"cover:unit": "nyc --report-dir .coverage/unit npm run --ignore-scripts test:unit -- --reporter=false",
|
||||
"docker:build": "docker build -t nostr-ts-relay .",
|
||||
"predocker:compose:up": "[ -d \"$HOME/.nostr\" ] || mkdir -p $HOME/.nostr",
|
||||
"docker:compose:up": "docker compose up --build",
|
||||
"docker:compose:down": "docker compose down",
|
||||
"docker:compose:rm": "docker compose rm",
|
||||
"docker:test:integration": "docker compose -f ./test/integration/docker-compose.yml up tests --build --exit-code-from tests"
|
||||
"docker:compose:start": "docker compose up --build",
|
||||
"docker:compose:stop": "docker compose down",
|
||||
"docker:compose:clean": "docker compose rm",
|
||||
"predocker:test:integration": "docker compose -f ./test/integration/docker-compose.yml up -d --quiet-pull --build",
|
||||
"docker:test:integration": "docker compose -f ./test/integration/docker-compose.yml run tests npm run test:integration",
|
||||
"postdocker:test:integration": "docker compose -f ./test/integration/docker-compose.yml down",
|
||||
"predocker:cover:integration": "docker compose -f ./test/integration/docker-compose.yml up -d --quiet-pull --build",
|
||||
"docker:cover:integration": "docker compose -f ./test/integration/docker-compose.yml run tests npm run cover:integration",
|
||||
"postdocker:cover:integration": "docker compose -f ./test/integration/docker-compose.yml down"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -83,7 +91,7 @@
|
||||
"dependencies": {
|
||||
"@noble/secp256k1": "1.7.0",
|
||||
"joi": "17.6.1",
|
||||
"knex": "2.3.0",
|
||||
"knex": "^2.3.0",
|
||||
"pg": "8.8.0",
|
||||
"pg-query-stream": "4.2.3",
|
||||
"ramda": "0.28.0",
|
||||
|
@ -15,11 +15,11 @@ services:
|
||||
volumes:
|
||||
- ../../src:/code/src
|
||||
- ../../test:/code/test
|
||||
- ../../.coverage:/code/.coverage
|
||||
- ../../.test-reports:/code/.test-reports
|
||||
working_dir: /code
|
||||
ports:
|
||||
- "8008:8008"
|
||||
command:
|
||||
["npm", "run", "test:integration"]
|
||||
depends_on:
|
||||
db-test:
|
||||
condition: service_healthy
|
||||
|
Loading…
x
Reference in New Issue
Block a user