@wswebcreation NODE.JS AND TESTING
 
 Knowing the 
 dependency of your dependencies
@wswebcreation
@wswebcreation You’re like ... @wswebcreation
@wswebcreation Agenda •Node.JS •History •How does it work? •Installing •NPM •Node.JS & Testing •Q&A
@wswebcreation
@wswebcreation Node.JS
 It’s rising • 1995 by Brendan Eich @wswebcreation
@wswebcreation Node.JS
 It’s rising • 1995 by Brendan Eich • Created in 10 days @wswebcreation
@wswebcreation Node.JS
 It’s rising • 1995 by Brendan Eich • Created in 10 days • Started as LiveScript @wswebcreation
@wswebcreation Node.JS
 It’s rising • 1995 by Brendan Eich • Created in 10 days • Started as LiveScript • 1996 ECMA standard @wswebcreation
@wswebcreation Node.JS
 It’s rising • 1995 by Brendan Eich • Created in 10 days • Started as LiveScript • 1996 ECMA standard • 2005 Ajax was created @wswebcreation
@wswebcreation Node.JS
 It’s rising • 1995 by Brendan Eich • Created in 10 days • Started as LiveScript • 1996 ECMA standard • 2005 Ajax was created @wswebcreation
@wswebcreation Node.JS
 It’s rising • 1995 by Brendan Eich • Created in 10 days • Started as LiveScript • 1996 ECMA standard • 2005 Ajax was created • 2006 jQuery @wswebcreation
@wswebcreation Node.JS - What it’s NOT? !!PROGRAMMING LANGUAGE!!
@wswebcreation Node.JS - What is it? Node is an open source cross platform runtime environment for JavaScript outside of a browser, based on Chromes V8 engine.
@wswebcreation Node.JS •Founded in 2009 @wswebcreation
@wswebcreation Node.JS •Founded in 2009 •Chromes V8 engine @wswebcreation
@wswebcreation Node.JS •Founded in 2009 •Chromes V8 engine •NodeJS evolved rapidly @wswebcreation • 2010: Express • 2011: • npm 1.0 released • LinkedIn, Uber,.. adopt NodeJS • 2012-2014: lots of improvements • 2015: • Node.JS Foundation is born • ES6 support • Private modules • Yarn is born • 2016-now: 📈
@wswebcreation Node.JS •Founded in 2009 •Chromes V8 engine •NodeJS evolved rapidly •Build whatever you want •Complex Websites @wswebcreation
@wswebcreation Node.JS •Founded in 2009 •Chromes V8 engine •NodeJS evolved rapidly •Build whatever you want •Complex Websites •Build Mobile Apps @wswebcreation
@wswebcreation Node.JS •Founded in 2009 •Chromes V8 engine •NodeJS evolved rapidly •Build whatever you want •Complex Websites •Build Mobile Apps •Build desktop apps @wswebcreation
@wswebcreation Node.JS vs Java •Do NOT use Node for CPU-intensive tasks •Meant for data intensive and real time applications •Asynchronous vs synchronous
@wswebcreation How does it work?
@wswebcreation Asynchronous Handle multiple 
 non-blocking requests 
 on a single thread.
@wswebcreation Kitchen Table 1 Table2 Asynchronous Handle multiple 
 non-blocking requests 
 on a single thread.
@wswebcreation Kitchen Table 1 Table2 Request 1 Request 2 Single thread Asynchronous Handle multiple 
 non-blocking requests 
 on a single thread.
@wswebcreation Kitchen Table 1 Table2 Synchronous Handle one 
 blocking request
 on a single thread.
@wswebcreation Promises A promise is an object which can be returned synchronously from an asynchronous function. It will be in one of 3 possible states: •Pending •Fulfilled •Rejected @wswebcreation
@wswebcreation (A)synchronous •Synchronous (Java) code
@wswebcreation (A)synchronous •Synchronous (Java) code •Native promises
@wswebcreation (A)synchronous •Synchronous (Java) code •Native promises •Multiple promises
@wswebcreation (A)synchronous •Synchronous (Java) code •Native promises •Multiple promises •Async await
@wswebcreation Releases •Odd released in October • Short lived • Not production ready Source: https://developer.okta.com/blog/2019/12/04/whats-new-nodejs-2020
@wswebcreation Releases •Odd released in October • Short lived • Not production ready •Even released in April • Odd stop receiving updates • Developed for 6 months (RC) Source: https://developer.okta.com/blog/2019/12/04/whats-new-nodejs-2020
@wswebcreation Releases •Odd released in October • Short lived • Not production ready •Even released in April • Odd stop receiving updates • Developed for 6 months (RC) •LTS • Production ready • bug/security fixes Source: https://developer.okta.com/blog/2019/12/04/whats-new-nodejs-2020
@wswebcreation Releases •Odd released in October • Short lived • Not production ready •Even released in April • Odd stop receiving updates • Developed for 6 months (RC) •LTS • Production ready • bug/security fixes Source: https://developer.okta.com/blog/2019/12/04/whats-new-nodejs-2020
@wswebcreation 2020 Source: https://developer.okta.com/blog/2019/12/04/whats-new-nodejs-2020
@wswebcreation Features Bugfixes Security Updates! What’s in a release
@wswebcreation Features Bugfixes Security Updates! What’s in a release
@wswebcreation Features Bugfixes Security Updates! What’s in a release
@wswebcreation Features Bugfixes Security Updates! What’s in a release
@wswebcreation Features Bugfixes Security Updates! What’s in a release
@wswebcreation ECMA20##/ ES#(###) •ECMAScript is the standard •ES is short for ECMAScript •As of 2015 ES{year} is used @wswebcreation
@wswebcreation Babel is a JavaScript compiler. Use next generation JavaScript, today.
@wswebcreation Installing •Download it though https://nodejs.org •Through the command line: •For Mac use Homebrew •For Ubuntu use apt-get
@wswebcreation Up/Downgrading •Download it though https://nodejs.org •Through the command line: •With an NPM package called {n} •For Mac use Homebrew •For Ubuntu use apt-get
@wswebcreation Node Version Manager Command line tool to •Download •Upgrade •Downgrade With a single command @wswebcreation
@wswebcreation NPM Node Package Manager: •The website @wswebcreation
@wswebcreation NPM Node Package Manager: •The website •A Command Line Interface @wswebcreation
@wswebcreation NPM Node Package Manager: •The website •A Command Line Interface •A registry where all package are stored @wswebcreation
@wswebcreation Package A package is a project/ collection of 1 or multiple {node_modules} which have a specific task as described in the {package.json}-file.
@wswebcreation (Dis)Advantages Advantages •Share versioned code with the OS-community •Use locally and globally •Easy to download standalone tools Disadvantages •There are already 1.000.000+ packages •Projects can blow up in local space size •Versioning is not properly used by every maintainer
@wswebcreation There’s a package for that {is-odd} @wswebcreation
@wswebcreation There’s a package for that {is-odd} @wswebcreation
@wswebcreation Project size Starting an 
 Angular
 project 
 500+MB
 ¯_(ツ)_/¯ @wswebcreation
@wswebcreation npx A npm package runner
 to run a package 
 without installing
@wswebcreation SemVer Semantic Versioning (X.Y.Z) • MAJOR(X): incompatible API changes • MINOR(Y): add functionality in a backwards compatible manner (^) • PATCH(Z): backwards compatible bug fixes (~)
@wswebcreation SemVer Semantic Versioning (X.Y.Z) • MAJOR(X): incompatible API changes • MINOR(Y): add functionality in a backwards compatible manner (^) • PATCH(Z): backwards compatible bug fixes (~) @wswebcreationSource: http://www.wswebcreation.nl/share-your-it-mnemonic/
@wswebcreation package-lock.json •Automatically generated when npm modifies the {node_modules} tree, or {package.json} •Describes the exact tree, including versions of the latest working installation •Optimizes the installation process of the packages for a new project @wswebcreation
@wswebcreation Yarn Yarn build by Facebook in 2015 to address: • Consistency • Security • Speed @wswebcreation
@wswebcreation Node.JS & Testing •Node.JS based UI-automation frameworks
@wswebcreation Node.JS & Testing •Node.JS based UI-automation frameworks •Node.JS uses Chromes V8
@wswebcreation Node.JS & Testing •Node.JS based UI-automation frameworks •Node.JS uses Chromes V8
@wswebcreation Node.JS & Testing •Node.JS based UI-automation frameworks •Node.JS uses Chromes V8 •API-testing with SuperTest
@wswebcreation@wswebcreation Q&A
@wswebcreation Thank you •@wswebcreation •https://github.com/ wswebcreation •wim.selles@saucelabs.com

Node.JS: Do you know the dependency of your dependencies dependency