Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5 chalk 5x requires ESM #6

Merged
merged 4 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"url" : "https://stackoverflow.com/questions/64261239/mocha-tests-with-esm-support-for-native-es6-modules"
}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ to create and test Command-Line Interfaces (CLIs) written in TypeScript.

This project updates the
[How to Create a Testable CLI using TypeScript?](https://www.realpythonproject.com/how-to-create-a-testable-cli-using-typescript/)
from Jan 2023 with various fixes that were not obvious (at least to me).
tutorial from Jan 2023 with various fixes that were not obvious (at least to me).

These include:
In particular, it modifies the import syntax and tsconfig.json to work with
ECMAScript Modules (ESM), such as Chalk v5.x.

Other changes include:

* Restricting "chalk" to "^4.1.2"
* Avoiding the confusingly-named 'npm run install'
* import { expect } from "chai";
* "test" : "mocha --require ts-node/register test/**/*.ts"
* Add node GitHub Action (tests dist/src/index.js, not installed version)
* Adding node GitHub Action (for continuous testing)


## Usage
Expand Down