Several basic examples and experiments with JavaScript.
src/fetch-ibans
: fetch many sample IBANs from several websites, in parallel with node-fetch package and Promisessrc/headless-browser
: use a headless browser (e.g. Chrome) to surf the websrc/node-events
: NodeJS custom event managementsrc/openapi-path-detector
: find OpenAPI path definition of a web requestsrc/react
: React JS usage with event-driven component communicationsrc/streams
: examples with Node's streamssrc/browser-events.html
: web browser custom event managementsrc/error-within-async.js
: examples of error raised within async functionsrc/property-existence-check.js
: how to check for existence of an object propertysrc/read-text-file-lines.js
: read specific lines from text file with OS toolssrc/tree.html
: tree rendering example with Treant.js packagesrc/utils.html
: few utility functionssrc/validation-with-json-schema.js
: data validation via JSON schema with Ajv package.eslintrc.json
: configuration for ESLint package
tests/error-within-async.test.js
: ensure unexpected errors raised within asynchronous code do not jeopardize tests performed by Jest frameworktests/fastify.test.js
: test Fastify-based web applicationtests/fs-mock.test.js
: mock external module functions with Jest frameworktests/http-server-mock.test.js
: test client functionalities by mocking an HTTP server with nock packagetests/node-fetch.test.js
: HTTP request/response test with node-fetch packagetests/openapi-validator.test.js
: validate API response against OpenAPI schema with jest-openapi package
docker run -v ${PWD}:/code -w /code --rm node:alpine yarn install
docker run -v ${PWD}:/code -w /code --rm node:alpine yarn test
docker run -v ${PWD}:/code -w /code --rm node:alpine yarn lint
- test files are suffixed with
.test.js
, in order to comply with Jest default: this makes no further configuration required - in order to avoid warning
Unresolved function/method/variable
within IDE,@types/jest
package has been added, as suggested here - (this could seem advertising, I know) a LOT of examples can be found on book JavaScript: The Definitive Guide (7th ed.), by David Flanagan