Skip to content

Commit

Permalink
Another major rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
myrotvorets-team committed Oct 8, 2023
1 parent fc71a6e commit ae3bdb2
Show file tree
Hide file tree
Showing 49 changed files with 4,944 additions and 5,821 deletions.
5 changes: 5 additions & 0 deletions .c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extension": [".mts"],
"exclude-after-remap": true,
"reporter": ["text", "lcov"]
}
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/*.js
**/*.d.ts
dist/**
node_modules/**
*.cjs
*.mjs
12 changes: 7 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"parserOptions": {
"ecmaVersion": 2019,
"project": ["./tsconfig.json"]
"project": ["./tsconfig.json"],
"sourceType": "module"
},
"extends": [
"@myrotvorets/myrotvorets-ts"
"@myrotvorets/myrotvorets-ts",
"plugin:mocha/recommended"
],
"env": {
"node": true,
"jest": true
"es2022": true,
"mocha": true,
"node": true
}
}
13 changes: 13 additions & 0 deletions .mocharc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import('mocha').MochaOptions} */
module.exports = {
recursive: true,
extension: ['.test.mts'],
'node-option': ['loader=ts-node/esm', 'loader=testdouble', 'no-warnings'],
require: 'mocha.setup.mjs',
reporter: 'mocha-multi',
'reporter-option': [
'spec=-',
process.env.GITHUB_ACTIONS === 'true' ? 'mocha-reporter-gha=-' : null,
process.env.SONARSCANNER === 'true' ? 'mocha-reporter-sonarqube=test-report.xml' : null,
].filter(Boolean),
}
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Development / integration testing only
version: '3.0'

services:
bot:
image: node:lts-slim@sha256:bfa807593c4e904c9dbdeec45a266d38040804e498c714bddf59734a1ed34730
image: node:lts-slim
volumes:
- './:/src/bot'
working_dir: /src/bot
command: npm run nodemon
- './:/srv/bot'
working_dir: /srv/bot
command: npm run start:dev
env_file:
- .env
depends_on:
- zipkin

zipkin:
image: openzipkin/zipkin@sha256:46ee38f01382e72de617f704441fd935390c6eeb762e88869530e661f1339765
image: openzipkin/zipkin
ports:
- '9411:9411'
23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

22 changes: 22 additions & 0 deletions mocha.setup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { use } from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { reset } from 'testdouble';

use(chaiAsPromised);

const env = { ...process.env };
process.env = {
NODE_ENV: 'test',
KNEX_DRIVER: 'better-sqlite3',
KNEX_DATABASE: ':memory:',
};

/** @type {import('mocha').RootHookObject} */
export const mochaHooks = {
afterEach() {
reset();
},
afterAll() {
process.env = { ...env };
},
};
5 changes: 3 additions & 2 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"watch": ["src"],
"ext": "ts",
"exec": "ts-node --transpile-only ./src/index.ts"
"ext": "mts",
"exec": "ts-node --transpile-only ./src/index-dev.mts",
"signal": "SIGTERM"
}
Loading

0 comments on commit ae3bdb2

Please sign in to comment.