Hentai Library Thingy
Go to file
Xymorot 8a16067ce1 doc: create a CHANGELOG.md file 2019-11-27 20:21:10 +01:00
declarations test: add test framework (spectron + mocha), combined with refactoring of the directory structures 2019-11-20 23:21:24 +01:00
mocks feat: install and use fs-extra instead of fs, implement groundwork for more sophisticated error reporting 2019-11-20 23:21:34 +01:00
resources feat: add icon/logo 2019-07-26 22:18:56 +02:00
src refactor: remove @Entity annotation from abstract entities 2019-11-26 22:51:55 +01:00
templates refactor: remove redundant initialization 2019-11-27 16:27:45 +01:00
tests refactor: move mock file (containing mock interface) into a new types folder inside tests 2019-11-27 16:41:21 +01:00
workspace meta: add schema folder in workspace with draw.io and pdf file 2019-11-26 22:51:52 +01:00
.editorconfig install tslint and prettier with stuff around to make them work together 2019-06-04 22:54:56 +02:00
.eslintignore config: add mocks folder to eslint 2019-11-26 22:51:52 +01:00
.eslintrc.json config: add rules to eslint concerning arrow functions 2019-11-20 23:21:32 +01:00
.gitignore test: add test setup files for backing up store and database folders before tests 2019-11-26 22:51:54 +01:00
.mocharc.yml test: remove split between integration and unit tests, use tags instead 2019-11-20 23:21:27 +01:00
.nycrc.yml config: turn off per-file coverage checking in nyc 2019-11-20 23:21:34 +01:00
.prettierrc.yml refactor: use handlebars template engine to render the index html conditionally 2019-11-20 23:21:33 +01:00
CHANGELOG.md doc: create a CHANGELOG.md file 2019-11-27 20:21:10 +01:00
LICENSE.md doc: add a "license" file 2019-11-26 22:51:55 +01:00
README.md doc: clarify mocks documentation 2019-11-26 22:51:54 +01:00
forge.config.js config: add database-backup and store-backup folders to forge ignore list 2019-11-26 22:51:55 +01:00
gulpfile.js refactor: use handlebars template engine to render the index html conditionally 2019-11-20 23:21:33 +01:00
ormconfig.yml test: add test framework (spectron + mocha), combined with refactoring of the directory structures 2019-11-20 23:21:24 +01:00
package-lock.json update: run npm update 2019-11-26 22:51:53 +01:00
package.json test: add test setup files for backing up store and database folders before tests 2019-11-26 22:51:54 +01:00
tsconfig.json feat: install and use fs-extra instead of fs, implement groundwork for more sophisticated error reporting 2019-11-20 23:21:34 +01:00
tslint.json config: add only-arrow-functions rule to tslint 2019-11-20 23:21:33 +01:00
webpack.config.js test: add test framework (spectron + mocha), combined with refactoring of the directory structures 2019-11-20 23:21:24 +01:00

README.md

Renai

レンアイ - Hentai Library Thingy

Development

Quickstart

  • npm install, the postinstall runs
    • npm run rebuild
      • might need to install some build tools depending on your platform
  • npm run watch for code transpilation (starts watchers)
  • npm run start

Git Commits

This project uses Conventional Commits with the following types:

type description
feat implementing a new feature or changes an existing one
remove removing an existing feature
fix repairing a feature which does not work correctly
refactor reworking code so that its function does not change (but could have in unexpected ways)
update updating dependencies and associated code changes
test any of the above, but with tests/mocks
config changing configuration (npm scripts, linters, build process)
meta updating something not directly related to function or documentation (e.g. branding)
doc updating documentation, including code comments
reformat rewriting code in a way in which it is impossible for function to change

Always try to split up your changes into coherent commits, a single commit should do a single thing. If your commit needs to do more than one thing it should be labeled with the type coming first in this list.

Database Migrations

Migrations are stored in src/main/migrations and handled by typeorm. Migrations are run on app start inside database.ts.

To auto-generate a migration:
node_modules/.bin/typeorm migration:generate -n <migration name> -c <connection name>

To create an empty creation which can be filled with custom migration code:
node_modules/.bin/typeorm migration:create -n <migration name> -c <connection name>

To run migrations:
node_modules/.bin/typeorm migration:run -c <connection name>
This is also pre-defined in the npm script typeorm:migrate.

Testing

The testing framework of choice is Mocha. Call npm run test to run all tests. Tests are written in typescript and need to be transpiled before testing.

  • assertion is (mainly) done by Chai
  • Electron specific testing is done by Spectron
  • spies, stubs and mocks are provided by Sinon.JS
  • HTTP server mocking is done by nock
  • property based testing is made possible by fast-check

Mocks

There are 2 ways in which mocks are defined/used:

  1. for external modules, in mocks
    • uses the rewiremock package
    • use this only when there is some magic happening like for electron which normally runs in its own node process
  2. for own modules, just beside their test file in tests
    • name the file *.mock.ts and use existing mock files for orientation on how to build them
    • use sparingly and only when not having a mock makes it more complex e.g. for modules which interact with the file system

Tagging

Mocha does not have a seperate tagging feature, but it can filter via title. Us the following tags in your test titles:

  • @slow when the test is particularly slow

Coverage

Code coverage is provided by nyc. The detailed code coverage can be found here after running the tests (open in browser).