---
title: "Irritating inconsistencies in Chai framework versions"
date: 2024-08-24
author: "Andy"
pubDate: "Sat, 24 Aug 2024 23:58:10 GMT"
link: "https://andysylvester.com/2024/08/24/irritating-inconsistencies-in-chai-framework-versions/"
urlPrev: "https://andysylvester.com/2024/08/20/announcing-the-kamala-campaign-timeline-site.md"
urlNext: "https://andysylvester.com/2024/09/02/3531.md"
---

# Irritating inconsistencies in Chai framework versions

This week, I spent some time working to understand how to use the [Mocha ](https://mochajs.org/)testing tool and the [Chai ](https://www.chaijs.com/)assertion tool in developing apps using Node.js. I found [two ](https://www.browserstack.com/guide/unit-testing-for-nodejs-using-mocha-and-chai)[articles ](https://buddy.works/guides/how-automate-nodejs-unit-tests-with-mocha-chai)that I was going to use to get started, and I decided to set up my package.json file to use the latest version of the tools. What I found was that I could not use the example code in the two articles, and kept getting error messages that I could not find answers for, except that several people recommended using an older version of the Chai assertion tool. I took a look at the Chai website releases page, and found that in [version 5](https://www.chaijs.com/releases/#v5.0.0), only ECMAScript Modules were supported. Previously, ECMAScript Modules and CommonJS Modules were allowed. However, this change meant that I would have to change the example code I was using to run the latest version of Chai. I tried numerous combinations of changes, but none were totally successful. After an hour of trial and error, I decided to reinstall version 4.3.7 of Chai in my test project, and everything now worked as I expected. UGH! Onward!