Skip to content

Commit

Permalink
Optimize the client-server communication (mckinsey#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Maximilian Schulz <83698606+maxschulz-COL@users.noreply.github.com>
  • Loading branch information
petar-qb and maxschulz-COL authored Sep 25, 2023
1 parent 4bd9b0e commit 3da50d1
Show file tree
Hide file tree
Showing 23 changed files with 5,401 additions and 319 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

# npm node_modules
node_modules/

# Ipynb
ipynb_checkpoints
*/.ipynb_checkpoints/*
Expand Down
2 changes: 1 addition & 1 deletion tools/find_forbidden_words_in_repo.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

words=$"colour\|visualisation"
words_finder=$(grep -Irwno --exclude=find_forbidden_words_in_repo.sh --exclude-dir={.git,*cache*} . -e "$words")
words_finder=$(grep -Irwno --exclude=find_forbidden_words_in_repo.sh --exclude-dir={.git,*cache*,*node_modules*} . -e "$words")

if [[ $words_finder ]]
then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Removed
- A bullet item for the Removed category.
-->
<!--
### Added
- A bullet item for the Added category.
-->

### Changed

- Optimize the client-server communication ([#34](https://github.com/mckinsey/vizro/pull/34))
- Eliminate most server side callbacks in favour of client-side callbacks
- Add tests for client-side callbacks written in Node.js framework called `jest`.
- Add hatch command `hatch run test-js` that runs unit tests written in `jest`.
- Logging information now only displayed for action function carried out (no trigger or finished information)

<!--
### Deprecated
- A bullet item for the Deprecated category.
-->
<!--
### Fixed
- A bullet item for the Fixed category.
-->
<!--
### Security
- A bullet item for the Security category.
-->
18 changes: 16 additions & 2 deletions vizro-core/docs/pages/development/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ If no example is specified (`hatch run example`) then the [default example](http

## Testing

Tests are handled using the [`pytest`](https://docs.pytest.org/) framework, and test environments are managed by Hatch. To run all tests, run
Tests are handled using the [`pytest`](https://docs.pytest.org/) and [`jest`](https://jestjs.io/) frameworks, and test environments are managed by Hatch. To run all python tests, run

```console
hatch run test
```

To run only unit tests, run `hatch run test-unit` and for integration tests only, run `hatch run test-integration`. Note that the latter executes all examples in separate testing sessions due to [this](https://github.com/mckinsey/vizro/issues/10) issue by providing the `-k` tag per example.
To run only python unit tests, run `hatch run test-unit`, and for python integration tests only run `hatch run test-integration`.

For integration tests, all examples are executed in separate testing sessions due to [this](https://github.com/mckinsey/vizro/issues/10) issue by providing the `-k` tag per example.

Arguments are passed through to the underlying `pytest` command, e.g.

Expand All @@ -79,6 +81,18 @@ hatch run all.py3.10:test -vv

The script executed by `hatch run cov` measures test coverage and generates a report.

To run jest unit tests for javascript functions, run `hatch run test-js`.
Note that Node.js is required to run tests written in the jest framework. If you don't have `Node.js` installed, guidelines on how to install Node.js will appear when you run the command: `hatch run test-js`.
Otherwise, if `Node.js` is installed, then the same command (`hatch run test-js`) runs jest unit tests.

Arguments are passed through to the underlying `npx jest` command, e.g.

```console
hatch run test-js --help
```

executes `npx jest --help` and shows all jest optional arguments you can also propagate through `hatch run test-js`.

<!-- ## Documentation
The diagram `docs/assets/diagram.png` is generated with `hatch run docs:diagram` (currently commented out). The documentation (and current changes) can be served locally by running `hatch run docs:serve`. -->
Expand Down
1 change: 1 addition & 0 deletions vizro-core/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ test-integration = [
"pytest tests/integration --headless -k json {args}",
"pytest tests/integration --headless -k yaml {args}"
]
test-js = "./tools/run_jest.sh {args}"
test-unit = "pytest tests/unit {args}"
update-snyk-requirements = "python ../tools/generate_snyk_requirements.py {args}"

Expand Down
Loading

0 comments on commit 3da50d1

Please sign in to comment.