Skip to content

Commit d9719c3

Browse files
authored
Convert to ESModules & export everything (#1)
* πŸ”§ Use Node16 module and moduleResolution * πŸ”§ Update package.json to support Node16 module and moduleResolution * 🚚 Export everything and fix jsdocs * 🚚 Rename file to `token-counts` to align it with the unit test file * βœ… Fix tests by using Vitest instead of Jest * βœ… Fix end-to-end tests in Vitest * ♻️ Make temporary variable for promptTokensEstimate in tests * πŸ§‘β€πŸ’» Add declarationMap to tsconfig.json
1 parent 1118e49 commit d9719c3

9 files changed

+1366
-3572
lines changed

β€ŽREADME.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ const estimate = promptTokensEstimate({
4040

4141
## Development and testing
4242

43-
Built in TypeScript, tested with Jest.
43+
Built in TypeScript, tested with Vitest.
4444

45-
```bash
46-
$ npm install
47-
$ npm test
45+
```sh
46+
npm install
47+
npm test
4848
```
4949

5050
When adding new test cases or debugging token count mismatches, it can be helpful to validate the estimated tokens in the tests against the live OpenAI API. To do this:

β€Žjest.config.js

-5
This file was deleted.

0 commit comments

Comments
Β (0)