cli icon indicating copy to clipboard operation
cli copied to clipboard

refactor: switch from mocha and chai to the jest

Open magicmatatjahu opened this issue 3 years ago • 3 comments
trafficstars

Description

Switch from mocha and chai to the jest. Simple reason. Mocha and chai (specifically, a ts-node which transpiles code from TS to JS) has a some problems with importing ESM. I found that problems when I started writing tests for https://github.com/asyncapi/cli/pull/347 and new parser uses new module syntaxes.

We still need chai in devDependencies, because @oclif/test uses it underneath.

Related issue(s) See more https://github.com/asyncapi/cli/pull/347

magicmatatjahu avatar Sep 21 '22 13:09 magicmatatjahu

@derberg Done, could you check again? :)

magicmatatjahu avatar Sep 28 '22 17:09 magicmatatjahu

@derberg ping, ping :P

magicmatatjahu avatar Oct 05 '22 15:10 magicmatatjahu

@derberg When I switched to the jest, oclif doesn't recognized errors from stderr but it throws to the stdout, so I log errors by this.logToStderr(${e.name}: ${e.message}); line.

Related to the bump of oclif - I made a bump along with the transition to the jest. Between 1.11 and 1.18 there is nothing big that will cause a breaking change in our cli.

magicmatatjahu avatar Oct 17 '22 11:10 magicmatatjahu

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Oct 17 '22 12:10 sonarqubecloud[bot]

/rtm

magicmatatjahu avatar Oct 17 '22 12:10 magicmatatjahu