Testing
Last updated
Was this helpful?
Last updated
Was this helpful?
The TS-Utils package uses , a popular testing framework for JavaScript and TypeScript, to ensure the reliability and correctness of its utility functions. Each utility category has its corresponding test file located in the , named after the category (e.g., string.test.ts
, object.test.ts
).
To write tests for your contributions, create a new test file in the test
folder, following the naming convention of <category>.test.ts
. For example, if you're adding a new utility function to the array
category, create/add to the file named array.test.ts
Inside the test file, write your tests using Jest's testing syntax. Here's an example of how to structure a test for a chunk
function in the array
category:
To run the tests for a specific utility category, use the following command:
To run all the tests for the entire TS-Utils package, use the following command:
This will execute all the tests defined in the test
folder.
The TS-Utils package uses GitHub Actions for continuous integration (CI). When you submit a pull request, the CI workflow will automatically run the tests to ensure that your changes do not break existing functionality.
By following these guidelines and writing comprehensive tests for your contributions, you can help maintain the quality and reliability of the TS-Utils package.