
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Use tesugen to setup API-testing framework in Typescript whenever you need it.
Make sure that you are running latest stable NodeJS (>= 14.6.0 LTS) and npm (>=7.6.1) version.
Navigate to desired directory and run:
npx tesugen
You will be asked to choose your package manager, test runner, name your project and you will be ready to go.
Create desired npm scripts to run specific tests:
"scripts": {
"test": "jest ./test/functional/example",
"test:basic": "jest ./test/basic/example"
},
If you run jest in project root, Jest will by default look for all files with *.test.ts and run them if possible.
To have everything running smoothly, testEnvironment and preset in jest.config.jest should be set by default:
preset: 'ts-jest',
testEnvironment: 'node',
Test reports will be generated in ./html-report in HTML format via Jest-html-reporters. Reporter can be configured in jest.config.js file. Jest supports multiple reporters. You can even create own custom reporter.
Create desired npm scripts to run specific tests:
"scripts": {
"test": "testyts",
"test:basic": "testyts ./test/basic/example"
},
Test client can be configured and reused with no limitations. For testing multiple services, feel free to configure TestController to have multiple TestClient properties for every desired service.
Test client has four basic example methods for four HTTP methods: GET, POST, PUT and DELETE.
Function located in ./validation/responseValidation.ts can be used for extended contract/integration testing. Make sure to create proper models according to desired response from your project documentation. To speed this process up, use any JSON to TS generator online to quickly convert JSON to TS interfaces/classes. Example: json2ts. Follow Class-validator documentation. Your tests will look like this:
expect(validateResponse(ProfileExampleResponse).toBeTruthy();
is stored in your local .env file. This is also highly conigurable, you can adjust this to your project needs. Test credentials can also be stored in local .env file and be used for authorized endpoints. Supertest Agent supports setting headers:
supertest.agent(String(process.env.BASE_URL)).set({'Authorization':`${bearerToken}`});
BASE_URL=https://www.aaa.ccc
FAQs
Setup extendable API-testing framework
We found that tesugen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.