Emulative - Visual Studio Marketplace
source link: https://marketplace.visualstudio.com/items?itemName=EasyAgile.emulative&ssr=false
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Emulative
Emulative is a VSCode extension which helps developers speed up testing by creating mock objects representing TypeScript types straight from Visual Studio Code.
Features
You can use Emulative to produce Typescript objects, Json objects or builder functions from Typescript types:
Copy Typescript objects
Copy Json objects
Create a scratch file with Typescript objects
Create a builder function
Usage
To use Emulative:
- Select the identifier of the Typescript type you would like to build a mock for then use shortcut
Ctrl/Cmd + Shift + P
to open the Command Palette - Type
Emulative
and the various options for copying the mock type will be presented, select the option you prefer - No matter the option selected, the mock type will be copied to the clipboard
Extension Settings
You can overwrite certain properties by updating the Prop Overrides setting under Settings > Extensions > Emulative > Prop Overrides
- Enter key value pairs where different key value pairs are delimited by commas “,”
- The key and value are delimited by a colon “:”
- Emulative will override any properties matching the key with the value provided
Known Issues
Type support
Emulative is hugely dependent on the wonderful work from the team who created intermock. Therefore, the types supported by Emulative match those supported by intermock. If Emulative encounters a type it isn't able to handle it will try and create a stub where possible or ignore the type completely. We are hoping to improve the types handled by Emulative in future releases.
Multiple files
Emulative is able to produce a mock type from a type which is defined in another file at one level. However, it does not currently support types with references to other types which are spread across multiple files. We are hoping to address this limitation in the next release.
Release Notes
1.0.0
v1 release of Emulative, includes:
- Better handling of unsupported types to produce a mock object with stubs instead of throwing an error
- Document builder functions with TSDoc describing their default values
- Remove user toast notifications for a successful user action
- Security updates
0.1.0
Initial release of Emulative, includes ability to:
- Run Emulative via the Command Palette to produce TS objects, Json objects and builder functions to mock out a TS type
- Override specific property values
Acknowledgements
Like most software these days, this wouldn't be posssible without all the amazing open source work out there. In particular, this extension relies heavily on the amazing work of the team at intermock
Also, thanks to Easy Agile for giving us the time, space, encouragement and tools to work on this extension. Come work for us!
Created by John Folder and Conor Gould at Easy Agile
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK