pimterry / loglevel

:ledger: Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods
MIT License
2.62k stars 157 forks source link

Get tests and builds working in current Node.js versions #195

Closed Mr0grog closed 10 months ago

Mr0grog commented 10 months ago

This gets tests and builds working in current versions of Node.js, from v6 through v20 (current active release), and in MacOS on Apple Silicon. The main goal here is to make it possible to run tests and builds on most types of computers without lots of complex setup, so it’s not too hard for contributors to test and validate their work.

⚠️ There are some messy bits here, and you might want to see some changes here, or might feel any solutions here are too complex and this PR should not be merged at all.

The main changes here are:

This completes the first two items from https://github.com/pimterry/loglevel/issues/191#issuecomment-1894653099.

Mr0grog commented 10 months ago

Realized today that in 72182e5e5deb7a8540c7e02f168ee4cbc4669d62 when I updated the version of grunt-contrib-jasmine to v4, it also upgrade Jasmine to v5.1 for browser tests. I figured I should upgrade the Node.js tests to match, which was pretty simple, but then realized those require at least Node 18+, which seemed like a bit too big of a jump, so I reversed that. This is easy to put back in with a single git revert bb00d4193688255c39544cabf493e4bad461651e, though.

Along the way, I also noticed that cookie support checking in the tests is not actually working correctly, resulting in some tests getting skipped when they shouldn't be (this was fine in PhantomJS since it doesn’t properly support cookies, but different in headless Chrome or in live tests with grunt integration-test). I fixed that check in 160fc4cce49e9607148d23fc6e5c9b17099c0553.

pimterry commented 10 months ago

Some options on making this situation better:

  • Drop grunt-template-jasmine-istanbul entirely.

Yeah, I'm fine with that. It seems like the current approach adds complexity (requiring legacy peer deps options, using unofficial releases, depending on a now-unmaintained dead project) and as we discussed in #191 we're not actually using the coverage data now.

If it was easy to keep working that'd be fine, but this seems more hassle than its worth, so I'm happy to cut it entirely and streamline.

Mr0grog commented 10 months ago

Makes sense. That should be done, and this PR should be ready to go.