Adding vitest for testing

Currently implemented

- FormatBytes
- MathHelpers
This commit is contained in:
2025-03-07 17:24:52 +09:00
parent 2b27dbae86
commit ea9882256e
8 changed files with 1071 additions and 17 deletions

View File

@@ -95,24 +95,24 @@ Parse URL for looking up entries in the paramegter list
## Build
Build with the following commands, the output will be stored in "build/js/utilsAll.js" and "build/js/utilsAll.min.js"
Build with the following commands, the output will be stored in "build/js/output/utils.js" and "build/js/output/utils.min.js"
For full not minified version
```sh
npm build utilsAll-build
npm build utils-build
```
For minified build (but keeps the function names as is)
```sh
npm build utilsAll-min-build
npm build utils-min-build
```
Or build both at the same time
```sh
npm build utilsAll-build-all
npm build utils-build-all
```
## Develop
@@ -126,5 +126,29 @@ npm install
Run watch
```sh
npm run utilsAll-develop
npm run utils-develop
```
## Test
A simple test script is located in "build/test.html"
### General function tests
vitest is used for all usage tests
```sh
npx vitest
```
Currently covered:
- FormatBytes
- MathHelpers
TODO:
- JavaScriptHelpers
- StringHelpers
- UniqIdGenerators
- UrlParser