Node.js Weekly Update - 24 March, 2017

Below you can find RisingStack's collection of the most important Node.js news, projects & updates from this week:

1. End-to-End Testing with Nightwatch.js

Nightwatch.js enables you to "write end-to-end tests in Node.js quickly and effortlessly that run against a Selenium/WebDriver server".

  • End-to-end testing is part of the black-box testing toolbox. This means that as a test writer, you are examining functionality without any knowledge of internal implementation.
  • End-to-end testing can also be used as user acceptance testing, or UAT. UAT is the process of verifying that the solution actually works for the user.

2. I've been a Web Developer for 17 Years, and this is what I learned

Daniel Khan has a 17 year long web development carrier behind him, so he decided to share his insights during NodeConfBP (RisingStack's Node.js Conference).

Daniel Khan's prezentation during NodeConfBP

A few insights:

  • History repeats itself and the tech industry is most likely heading towards another crash - so developers must prepare themselves.
  • The Broken Windows theory fits well with coding, so remember to always write code for your future self!
  • You shouldn't jump on a latest fashionable JS framework bandwagon all the time.
  • The module system is kind of broken, there are hundreds of modules solving the same problem. It's hard to figure out what to use.
  • Information on StackOverflow is often wrong, don't blindly copypaste code from there!

And so on..

3. npm announced free Orgs for Open-Source projects

Today, we’re excited to announce that npm Orgs, our collaboration tool for helping teams manage permissions and share their code, is free for all developers of open source packages. You may invite an unlimited number of collaborators to manage an unlimited number of public packages for $0.

Node.js News: npm announced free Orgs

4. Build a “Serverless” Slack Bot in 9 Minutes with Node.js and StdLib

Slack bots — they’re fun, they’re useful, and people are building new businesses around bot interaction models on a daily basis.

Node.js news: StdLib & Slack

StdLib is a Function as a Service software library. The easiest way to think of it is to imagine if AWS Lambda and GitHub had a child, then asked NPM and Twilio to be the godparents — scalable microservices with no server administration, easy command line management, version immutability, service discovery, and the ability to charge customers for premium services you’ve built on a per-request basis.

5. Requiring modules in Node.js: Everything you need to know

When Node invokes that require() function with a local file path as the function’s only argument, Node goes through the following sequence of steps:

  • Resolving: To find the absolute path of the file.
  • Loading: To determine the type of the file content.
  • Wrapping: To give the file its private scope. This is what makes both the require and module objects local to every file we require.
  • Evaluating: This is what the VM eventually does with the loaded code.
  • Caching: So that when we require this file again, we don’t go over all the steps another time.

In this article, I’ll attempt to explain with examples these different stages and how they affect the way we write modules in Node.

Latest Node.js Releases

○ Node v6.10.1 (LTS)

IMPORTANT: This Node.js Version became the default on Amazon Lambda!

  • performance: The performance of several APIs has been improved.
  • Buffer.compare() is up to 35% faster on average.
  • buffer.toJSON() is up to 2859% faster on average.
  • fs.*statSync() functions are now up to 9.3% faster on average.
  • os.loadavg is up to 151% faster.
  • process.memoryUsage() is up to 34% faster.
  • querystring.unescape() for Buffers is 15% faster on average.
  • querystring.stringify() is up to 7.8% faster on average.
  • querystring.parse() is up to 21% faster on average.
  • IPC: Batched writes have been enabled for process IPC on platforms that support Unix Domain Sockets.
  • Performance gains may be up to 40% for some workloads.
  • child_process: spawnSync now returns a null status when child is terminated by a signal.
  • This fixes the behavior to act like spawn() does.
  • http:
  • Control characters are now always rejected when using http.request().
  • Debug messages have been added for cases when headers contain invalid values.
  • node: Heap statistics now support values larger than 4GB.
  • timers: Timer callbacks now always maintain order when interacting with domain error handling.

○ Version 7.7.4 (Current)

  • deps: Add node-inspect 1.10.6
  • inspector: proper WS URLs when bound to 0.0.0.0
  • tls: fix segfault on destroy after partial read.

Previously in the Node.js Weekly Update

In the previous Node.js Weekly Update we read fantastic articles about Serverless Node, a new course on Using npm scripts, Client-side routing, Concurrency in Node + v7.7.3 Released was released as well!

We help you to stay up-to-date with Node.js on a daily basis too. Check out our Node.js news page and its Twitter feed!