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
A mock server that ships with a UI to allow configuration during runtime.
npm install stubsy
Typescript
Module System
Node Version
NPM Version
58.1
Supply Chain
94.1
Quality
78.1
Maintenance
50
Vulnerability
100
License
Updated on 19 Oct 2024
TypeScript (95.87%)
JavaScript (3.26%)
HTML (0.57%)
Shell (0.3%)
Cumulative downloads
Total Downloads
Last day
-33.3%
Compared to previous day
Last week
-40%
Compared to previous week
Last month
-87.6%
Compared to previous month
Last year
-96.9%
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
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
22 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-02
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