2. Can do that !!
Pour réaliser une tâche un peu complexe,
voire parfois simple, on ajoute une nouvelle
dépendance au projet ...
3. Can do that !!
Cons related to adding dependencies
Increase in Project Size
Risk of Vulnerabilities
Lack of Control Over Code
Compatibility Issues
Risk of Obsolescence
Performance
Etc.
4. Can do that !!
Cons related to adding dependencies
How to mitigate these risks
Increase in Project Size
Risk of Vulnerabilities
Lack of Control Over Code
Compatibility Issues
Risk of Obsolescence
Performance
Etc.
Dependency Audit (npm audit, Snyk, or Dependabot, etc.)
Limit Dependencies (add deps only if absolutely necessary).
🤔
5. Can do that !!
Before :
WATCH MODE
v19.2.0, v18.13.0 Test runner supports
v22.0.0 Stable
Added in: v18.11.0, v16.19.0
With Node.Js
Nodemon feature
NPM Module
How to do it natively with Node.JS
Since which version ?
State today (Node v23)
History
7. Can do that !!
Before :
WATCH MODE
v19.2.0, v18.13.0 Test runner supports
v22.0.0 Stable
Added in: v18.11.0, v16.19.0
With Node.Js
Nodemon
History
8. Can do that !!
Before :
HTTP CLIENT
v21.0.0 Stable
Added in: 17.5.0
With Node.Js
Axios
History
9. Can do that !!
Before :
WEBSOCKET CLIENT
v22.4.0 Stable
Added in: v21.0.0
With Node.Js
Socket.io / WS
History
10. Can do that !!
Before :
TEST
v19.2.0, v18.13.0 Supports watch mode
v20.0.0 Stable
Added in: v18.1.0, v16.17.0
With Node.Js
Mocha (test runner) + Chai (assertion library) + Sinon (test doubles library)
History
13. Can do that !!
Features :
Resources :
TEST
Filter test by name ( --test-name-pattern="test 1 some test" , --test-skip-pattern)
Async test
Watch mode
Test report (tap, spec, dot, junit, lcov)
Test coverage
Test Double (Mocking)
https://glebbahmutov.com/blog/trying-node-test-runner/
https://youtu.be/M57m8t7rsVg?si=RmjDfYm08h52juY6
https://youtu.be/M57m8t7rsVg?si=jM42cTtjF17Q7MX9
https://nodejs.org/api/test.html
Official Documentation
Trying Node.js Test Runner-Learning all about the new built-in Node.js test runner
Videos on writing test using the native test runner (French)
14. Can do that !!
Before :
.ENV FILE
v21.7.0, v20.12.0 Support to multi-line values
Active development
Added in: v20.6.0
With Node.Js
Dotenv
OR
History
CLI or NPM Script
Script : eg. index.js
16. Can do that !!
TERMINAL TEXT FORMATING/STYLING
Before :
v22.8.0 Respect isTTY and NO_COLORS,NODE_DISABLE_COLORS,FORCE_COLOR
v23.5.0 Stable
Added in: v21.7.0, v20.12.0
With Node.Js
Chalk
History
17. Can do that !!
Before :
SQLITE
Added in: v22.5.0
Active development
With Node.Js
Sqlite3
History
19. Can do that !!
TYPE STRIPPING (RUN TYPESCRIPT FILES)
Before :
Added in: v22.6.0
Active development
With Node.Js
TypeScript Compiler
History
20. Can do that !!
TYPE STRIPPING (RUN TYPESCRIPT FILES)
user.model.ts
utils.ts
index.ts
21. Can do that !!
SYNCHRONOUS ESM GRAPHS (REQUIRE ESM)
Before :
Active Development
With Node.Js
History
ERR_REQUIRE_ESM
Added in: v22.0.0
22. Can do that !!
SYNCHRONOUS ESM GRAPHS (REQUIRE ESM)
utils.mjs
index.ts
23. Can do that !!
Before :
RUNNING PACKAGE.JSON SCRIPTS
Added in: v22
v23 Stable
With Node.Js
History
24. Can do that !!
package.json
RUNNING PACKAGE.JSON SCRIPTS
With Node.Js
With NPM
Intentional limitations
node --run is not meant to match the behaviors of npm run or of the run commands of other
package managers.
25. Can do that !!
Resources to check :
https://glebbahmutov.com/blog/trying-node-test-runner/
https://joyeecheung.github.io/blog/2024/03/18/require-esm-in-node-js/
https://nodejs.org/api/test.html
Test (official doc.)
Trying Node.js Test Runner-Learning all about the new built-in Node.js test runner
require(esm) in Node.js
https://nodejs.org/docs/latest/api/modules.html#loading-ecmascript-
modules-using-require
Loading ESM (official doc.)