Skip to content

Commit

Permalink
5 chalk 5x requires ESM (#6)
Browse files Browse the repository at this point in the history
* new chalk version

* esm support

* mocha config

* README and lint
  • Loading branch information
drernie committed Sep 16, 2023
1 parent b438302 commit 00cebda
Show file tree
Hide file tree
Showing 8 changed files with 3,257 additions and 186 deletions.
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

0 comments on commit 00cebda

Please sign in to comment.