mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
This breaks down reading and writing into low-level and high level sagas. Opening now takes a lock on the file so that it can only have one writer or have multiple readers. The low-level read and write sagas use the file descriptor to determine if the file is still open before actually performing the action. Since we are using the web locks api, these locks should work across browser tabs/windows. The high-level read/write sagas perform the low-level open, read/write, close operations in a single call. The high-level delete and rename sagas are also updated to take locks on the files while performing the respective operations and will fail if the file is already being used somewhere else.
Testing
NOTE: This directory contains test helpers. Actual tests are in the src/
directory.
Running tests
yarn test
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Code coverage
yarn coverage
Launches the test runner in the code coverage mode. Results are displayed in the terminal.
yarn coverage:html
xdg-open coverage/index.html
Does the same thing except results are converted to more detailed html pages in
the coverage/ directory. (On macOS, use open and on Windows use explorer
instead of xdg-open to open the html in your default web browser.)
Writing tests
Tests are written using the Jest testing framework.