Node.js

Node.js

2022/07/30 (增加連結)

Node.JS

API

Authentication

EJS

Google APIs

Pug / Jade

Fastify

REST

Swagger

Typescript

Deno

Frameworks / libraries

Express

NestJS

Databases

mysql

firebase / firestore

airtable

React

MERN

Sock.io

React Native

Test

  • Node.js & JavaScript Testing Best Practices (2019)

    • The Golden Rule: Testing must stay dead -simple and clear as day

    • The Test Anatomy

      • Include 3 parts in each test name

        • What is being tested?

        • Under what circumstances and scenario?

        • What is the expected result?

      • Describe expectations in a product language: use BDD-style assertions

      • Lint with testing-dedicated plugins

      • Stick to black-box testing: Test only public methods

      • Choose the right test doubles: Avoid mocks in favor of stubs and spies

      • Don’t “foo”, use realistic input data

      • Test many input combinations using Property-based testing

      • Stay within the test: Minimize external helpers and abstractions

      • Avoid global test fixtures and seeds, add data per-test

      • Don’t catch errors, expect them

      • Tag your tests

      • Other generic good testing hygiene

    • Test Types

      • Enrich your testing portfolio: Look beyond unit tests and the pyramid

      • Component testing might be your best affair

      • Ensure new releases don’t break the API using consumer-driven contracts

      • Test your middlewares in isolation

      • Measure and refactor using static analysis tools

      • Check your readiness for Node-related chaos

    • Measuring Test Effectiveness

      • Get enough coverage for being confident, ~80% seems to be the lucky number

      • Inspect coverage reports to detect untested areas and other oddities

      • Measure logical coverage using mutation testing

    • CI & Other Quality Measures

      • Enrich your linters and abort builds that have linting issues

      • Shorten the feedback loop with local developer-CI

      • Perform e2e testing over a true production-mirror

      • Parallelize test execution

      • Stay away from legal issues using license and plagiarism check

      • Constantly inspect for vulnerable dependencies

      • Automate dependency updates

      • Other, non-Node related, CI tips

      • Build matrix: Run the same CI steps using multiple Node versions

  • Black-box Testing a Node.js Web API

  • Customising CodeceptJS E2E tests

  • How To Create a Web App for Coding Tests: How to build your very own coding test platform with Node.js

  • Increase Your Productivity With Automated Browser Tests Using Node and Playwright

  • Using Parasite to Debug NodeJS applications

  • Passing variables between tests in Cypress : Testing business workflows end2end with cy.task()

  • Playing with Puppeteer

Tips & Experiences