Installations
npm install mock-component-generator
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=8.0.0
Node Version
16.14.1
NPM Version
8.5.0
Score
31
Supply Chain
52.2
Quality
64.2
Maintenance
50
Vulnerability
93.4
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (98.2%)
JavaScript (1.64%)
Batchfile (0.17%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
0akl3y
Download Statistics
Total Downloads
1,813
Last Day
1
Last Week
4
Last Month
36
Last Year
255
GitHub Statistics
69 Commits
1 Watchers
2 Branches
1 Contributors
Updated on Dec 06, 2021
Bundle Size
1.40 MB
Minified
368.29 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.1
Package Id
mock-component-generator@1.0.1
Unpacked Size
16.90 kB
Size
4.52 kB
File Count
10
NPM Version
8.5.0
Node Version
16.14.1
Total Downloads
Cumulative downloads
Total Downloads
1,813
Last Day
-66.7%
1
Compared to previous day
Last Week
-69.2%
4
Compared to previous week
Last Month
620%
36
Compared to previous month
Last Year
-5.9%
255
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
14
mock-component-generator
Generate a __mock__
folder with mocks for all jsx and tsx files that match the glob.
Per default existing __mocks__
will not be overwritten.
Currently all components (class and functional) will be mocked as function.
Usage
1$ npm install -g mock-component-generator 2$ cd my-folder 3$ generateMockComponents **/foo/bar.* 4...generating mocks
Options
--keepImports (-i)
: Keep the imports. Default is false
--keepTSTypes (-t)
: Keep the TS-Types. Default is false
Example.
Running
generateMockComponents **/foo.*
in
|- foo.tsx
|- ComponentA.tsx
|- ComponentB.jsx
|- OtherStuff.ts
|- subfolder
|- foo.js
will result in
|- __mocks__
|- foo.tsx
|- ComponentA.tsx
|- ComponentB.jsx
|- OtherStuff.ts
|- subfolder
|- __mocks__
|- foo.js
|- foo.js
where
1import React from 'react' 2import { foo } from 'bar' 3 4export const HelloComponent = (props: { name: string }) => ( 5 <div> 6 <p>`${name}`</p> 7 </div> 8)
will be mocked like
1import React from 'react' 2export const HelloComponent = (props) => 3 React.createElement('HelloComponent', props)

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
11 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
1.3
/10
Last Scanned on 2025-02-10
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