And, of course, it works with the test runner. So you can basically have an auto-restarting test runner very promptly and very easily. There is still limited platform support. Right now, it's only Mac OS and Windows, but we're working on improvements.
We have the async local storage, which is a way to track your asynchronous function calls and have some data in context. And, actually, you are using it every day if you are on Next.js, because these are the foundation for React server components. Without async local storage, you wouldn't have React server components.
We have web crypto, which is still part of the web platform. So, now, the Node crypto is also usable using the web platform API, with an example like that, where you can easily build HMAC of anything, pretty much. And we have the parse args to parse your command line arguments. This is pretty flexible and extensible, and now you don't have to use additional packages if you don't want to. You have everything baked in into Node, so that's a lot.
Finally, single executable application. You can inject Node into the, code into the Node binary, which was originally an idea from Postman Labs. Single command.js is the only supported format so far, and binaries can be distributed without any additional files. So, a single file, like in the Go world, if you're in the Go world. Some other tools you can test, use like postJect, but they're not actively being tested by the Node collaborators at the moment. Permission system, which is crucial for security. So, basically, there are some flags that basically allow you to restrict which API are required in your, sorry, allowed in your code, like FS, like child process worker, we also have net now.
And basically, you can restrict which API can be executed by your script at execution time. And you can check at run time using the process permission as API. There used to be a process permission deny in order to remove permission at run time, and it has been temporarily removed for some implementation details that need to be sorted out and might return in the future. And finally, the test runner. It's very, very flexible and supports subtests, skipping life cycle hooks, supports function and timer mocking, and also module mocking is on the way, coverage support, and it has good reporting defaults, which is defaulting to spec or top protocol depending if you are on a TTY, which means you are a live terminal or an automated system. I use test runner everywhere and it's brilliant, it just rocks. So, I strongly encourage you to take a look to that.
This is an example of a test runner, a test written in Node test runner. As you can see, it's pretty similar on what you are actually accustomed to. So, it should be easy to migrate. And also, we have WebSocket, and I love to thank you, Matthew, for implementing the WebSocket supporting Node.
Comments