Gathering detailed insights and metrics for stubsy
Gathering detailed insights and metrics for stubsy
Gathering detailed insights and metrics for stubsy
Gathering detailed insights and metrics for stubsy
npm install stubsy
Typescript
Module System
Node Version
NPM Version
TypeScript (95.87%)
JavaScript (3.26%)
HTML (0.57%)
Shell (0.3%)
Total Downloads
18,615
Last Day
2
Last Week
3
Last Month
14
Last Year
365
4 Stars
88 Commits
1 Forks
3 Watching
6 Branches
3 Contributors
Latest Version
1.3.4
Package Id
stubsy@1.3.4
Unpacked Size
544.89 kB
Size
153.52 kB
File Count
13
NPM Version
10.8.2
Node Version
20.18.0
Publised On
19 Oct 2024
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
0%
3
Compared to previous week
Last month
-86.9%
14
Compared to previous month
Last year
-96.8%
365
Compared to previous year
2
43
Stubsy is a Node server built using Express. Its main goal is to allow
developers to easily set up the server but more importantly change its
behaviour after launch. This can be useful to test how the UI behaves
when an endpoint's response is 404
instead 200
for example.
Stubsy ships with a UI to show the set up of the server and allow changing endpoint's behaviour.
1npm install --save-dev stubsy
An Endpoint
is REST endpoint, that is set up with a default
behaviour. An endpoint's behaviour is defined as follows.
1type EndpointBehaviour = { 2 path: string; // the route at which the endpoint is accessed 3 responseBody: unknown; 4 status: number; 5 type: 'get' | 'post' | 'put' | 'delete' | 'patch'; 6 delay?: number; 7};
Note: the path
field can be any valid
Express path.
An Override
is an overriding behaviour for an Endpoint to alter its
response. The override behaviour is defined as follows. The path
and
type
of the endpoint cannot be changed in an Override
.
1type OverrideBehaviour = { 2 responseBody: unknown; 3 status: number; 4 delay?: number; 5};
new Stubsy(portNumber)
Creates an instance of Stubsy
.
portNumber
<Number>: the port for the server to run onstubsy.app
The underlying Express app. Use this instance variable to add more endpoints if needed and to start the server.
stubsy.registerEndpoint(endpointId, endpointBehaviour)
Registers endpoints to be accessed on the server.
endpointId
<String> required: a unique identifier for the endpointendpointBehaviour
<EndpointBehaviour> required: the endpoint's behaviourstubsy.registerOverride(endpointId, overrideId, overrideBehaviour)
Registers override behaviour for a previously defined endpoint.
endpointId
<String> required: the id of the endpoint to register
an override foroverrideId
<String> required: a unique identifier for the overrideoverrideBehaviour
<OverrideBehaviour> required: the override's behaviourstubsy.activateOverride(endpointId, overrideId)
Activates the specified override on the endpoint.
endpointId
<String> required: the id of the endpoint to activate
the override onoverrideId
<String>: the id of the override to activate. If omitted
restores the override to the default behaviour.stubsy.start()
Starts the server on the port number specified.
1// server.js 2import { Stubsy } from 'stubsy'; 3 4const stubsyPortNumber = 3000; 5const stubsy = new Stubsy(); 6 7stubsy.registerEndpoint('films', { 8 path: '/films', 9 status: 200, 10 type: 'get', 11 responseBody: [{ title: 'Inception' }, { title: 'Tenet' }], 12}); 13 14stubsy.registerOverride('films', 'error', { status: 404, responseBody: {} }); 15stubsy.registerOverride('films', 'outage', { status: 500, responseBody: {} }); 16 17stubsy.activateOverride('films', 'outage'); 18 19stubsy.app.listen(stubsyPortNumber);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
packaging workflow detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
24 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More