At Introduct Group, your integrated technology partner, we commit to providing innovative, bespoke software solutions to businesses worldwide. In this article, we’ll closely examine the latest Node.js 22.8.0 release. Also, here you’ll have a chance to look at how new features can help improve the developer experience by increasing performance and better code quality.

Node.js 22.8.0: New JavaScript API for On-Disk Caching

The most exciting feature in Node.js 22.8.0 is the new JavaScript API for compiling cache, module.enableCompileCache(). That API enables on-disk caching of all the modules loaded after that API call and greatly improves performance. Developers until now relied on the NODE_COMPILE_CACHE environment variable under the end-user’s control. With this change, more control falls to tool and library authors because they can enable the caching of their code themselves.

This change provides yet another alternative to third-party caching solutions such as v8-compile-cache, but out of the box with even better performance and support for ESM. This reduces dependencies for developers in this area. By reducing reliance on external packages, developers can streamline their build processes and optimize performance natively within Node.js.

At Introduct, we never miss an opportunity to use the latest technology achievements, looking ahead and trying to make software solutions for clients even more efficient. Eagerly waiting to give a try to a new caching API in Node.js 22.8.0 to make developers’ work simpler and customers’ applications run sooner and respond quicker.

Freezable Contexts with vm.createContext()

The other interesting addition to Node.js 22.8.0 is an option for vm.createContext(). Starting now, the introduction of the vm.constants.DONT_CONTEXTIFY flag allows developers to create a context without running the Contextify operation on its global object. In such a case, this will become useful when freezing the context or accelerating access to the global objects.

This feature be especially useful when sandboxing is required or when performance is vital, and interceptors are simply not needed. It will grant more freedom to the developers to how they handle the global context and, thus, make it more secure and faster.

Code Coverage Thresholds: Ensuring Quality Code

One of the most significant updates for testing-focused developers in Node.js 22.8.0 is its new code coverage thresholds feature. The --experimental-test-coverage flag provides developers with the capability to ensure that their code meets the predefined testing standards before the process is allowed to exit. This means code quality is guaranteed well before it reaches production.

Node.js now allows developers to set thresholds for:

  • Branch coverage: --test-coverage-branches=<threshold>
  • Function coverage: --test-coverage-functions=<threshold>
  • Line coverage: --test-coverage-lines=<threshold>

The <threshold> value must be an integer between 0 and 100, representing the percentage of coverage required. If the threshold is not met, Node.js will exit with an error, providing a clear signal that more tests are needed before deployment. This feature ensures that businesses maintain high code standards, preventing under-tested code from reaching production environments.

Therefore, the feature is most valuable for development teams who have their focus on continuous integration and delivery. It enforces disciplined testing, and reduces the danger of bugs, hence enhancing overall software quality. At Introduct, we design software solutions that can ensure reliability and performance. This enhancement in testing capabilities will surely be crucial in building more robust applications.

Conclusion

Node.js 22.8.0 brings a new set of features into the hands of developers to allow them to write faster, efficient, qualitative code. No doubt, this update has taken a huge leap in JavaScript development.

At Introduct, we make sure our clients receive nothing but the best. The features in Node.js 22.8.0 align with our goal of providing efficient, scalable, high-quality software solutions. Contact us and learn how we can help you leverage these innovations in your next project.