Skip to content

Commit

Permalink
[test] Rewrites sigma.js testing
Browse files Browse the repository at this point in the history
Details:
- Moves everything testing related to the new test package
- Rewrites unit testing to be based on Vitest, with its browser mode, so
  that it works in an actual environment
- Rewrites e2e testing to be based on Playwright, so that there is less
  code and it is more maintainable
- Rewrites benchmarking to be based on Vitest and its benchmark mode (it
  does not work yet though)

Also, some various random changes blend into this huge refactoring:
- Fixes tiny dependency issues here and there
- Renames vite.config.ts as vite.config.mts to clear some annoying
  warnings
- Fixes root build task, to include sigma bundle generation
  • Loading branch information
jacomyal committed Mar 7, 2024
1 parent 4efab19 commit b558fd8
Show file tree
Hide file tree
Showing 72 changed files with 10,246 additions and 11,553 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ node_modules
build
dist
/www
packages/sigma/test/e2e/reports
packages/sigma/test/e2e/screenshots/*.current.png
packages/sigma/test/e2e/screenshots/*.diff.png
packages/test/e2e/reports
packages/test/e2e/screenshots/*.current.png
packages/test/e2e/screenshots/*.diff.png
packages/storybook/storybook-static

# Built sources:
Expand Down
32 changes: 0 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,6 @@ _List of available examples_

Also, a more realistic sigma.js based web application is available in the [`demo`](https://github.com/jacomyal/sigma.js/tree/main/packages/demo) folder. It aims to show a real-world usecase, and is the main showcase of [sigma.js website](https://www.sigmajs.org/).

## Testing

Some minor helpers are unit tested, but the main way sigma.js is tested is with generated screenshots. Those screenshots are generated with [Puppeteer](https://pptr.dev/) on a headless Chrome/Chromium. Also, there are now some benchmarking scenarii, to ensure some features do not bring a bad impact on performances.

You can check that everything is fine (unit tests and screenshots) by simply running:

```bash
npm run test
```

If at some point, you actually have a good reason to break some screenshots, you can run `npm run e2e:generate-screenshots` to erase reference screenshots.

## Benchmarking

You can run the benchmark scenarii by running:

```bash
cd path/to/sigma.js
cd packages/sigma
npm run e2e:benchmark -- --filename my-report.json
```

This will generate a JSON report at `test/e2e/reports/my-report.json`.

Then, you can compare it to some reference report, by running:

```bash
cd path/to/sigma.js
cd packages/sigma
npm run e2e:compare-benchmarks -- --reference test/e2e/reports/reference-report.json --report test/e2e/reports/my-report.json
```

## Website

The current website is based on [Docusaurus](https://docusaurus.io/), with a static homepage. It is located in the `website` folder. It also showcases the React.js based demo available in the [`demo`](https://github.com/jacomyal/sigma.js/tree/main/packages/demo) folder in an iframe. The website itself does not need any build step, though the demo does.
Expand Down
Loading

0 comments on commit b558fd8

Please sign in to comment.