test: Set up a mocha test harness (#5)

We use [mocha](https://mochajs.org/) as the test framework, as it is
  the tool used by mathjs and we would like to make tests as similar
  as possible. However, to tighten the linkage between source code and
  tests, we adopt a somewhat different file organization: unit tests
  for a given source file `blah/foo.js` are in `blah/__test__/foo.spec.js`.

  To run all unit tests, execute the script `pnpm test`.

  Resolves #3.

Reviewed-on: glen/nanomath#5
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2025-04-07 16:18:46 +00:00 committed by Glen Whitney
parent 79c6d44fda
commit 036def4a0c
9 changed files with 756 additions and 8 deletions

View file

@ -2,6 +2,26 @@
Sequel to pocomath as a prototype for mathjs overhaul
### Set up
1. Install the `pnpm` package manager on your machine.
2. Clone the repository `https://code.studioinfinity.org/glen/nanomath.git`
and change directory into its top level.
3. `pnpm install`
4. `pnpm test` runs the tests.
## Design philosophy
Note the rest of this README lays out the initial structure and design
goals for the nanomath prototype, and remains a general guide for its
development. Some specific details have been adjusted, and this document
has not necessarily been kept up-to-date. See the
[project wiki](https://code.studioinfinity.org/glen/nanomath/wiki) for
the most recent details; where the wiki and this README differ, the wiki
is presumed to be authoritative.
### Themes
The main themes of nanomath as compared to its predecessor are:
1. Settle on a code organization, rather than merely demonstrating that
@ -29,7 +49,7 @@ The main themes of nanomath as compared to its predecessor are:
ported if a decision were taken to return to something more highly
typescript-integrated.
## Code organization
### Code organization
The pocomath prototype showed that we could have one-file-per-implementation, or
multiple-files-per-implementation, and that we could group implementations by