- Notifications
You must be signed in to change notification settings - Fork0
Typescript transform plugin removes spec definition from source file
License
NotificationsYou must be signed in to change notification settings
unlight/typescript-transform-unspec
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Typescript transform plugin removes spec definition from source file.
Inspired byunassert.
Imagine we havefunction.ts
with single function. Usually we createfunction.spec.ts
with tests.But what if we can keep tests in same file, and remove spec defenition for production.
exportfunctionhello(greet='world'){return`hello${greet}`;}it('hello world test',()=>{expect(hello()).toBe('hello world');});
functionhello(greet){if(greet===void0){greet='world';}return"hello "+greet;}
+ All in one file
- Collecting coverage can be tricky
npm install --save-dev typescript-transform-unspec
// webpack.config.jsconstunspecTransformer=require('typescript-transform-unspec');rules:[{test:/\.tsx?$/,loader:'ts-loader',// or 'awesome-typescript-loader'options:{getCustomTransformers:program=>({before:[unspecTransformer(program),]})}},]
// tsconfig.json{"compilerOptions": {"plugins": [ {"transform":"typescript-transform-unspec" }, ] },}
// rollup.config.jsimporttypescriptfrom'rollup-plugin-typescript2';importunspecTransformerfrom'typescript-transform-unspec';plugins:[typescript({transformers:[service=>({before:[unspecTransformer(service.getProgram())],after:[],}),],}),]
- https://dev.doctorevidence.com/how-to-write-a-typescript-transform-plugin-fc5308fdd943
- https://github.com/Saviio/ts-sfc-plugin
- https://github.com/LeDDGroup/typescript-transform-jsx
- https://github.com/Saviio/ts-react-pure-class-plugin
- https://github.com/uittorio/ts-auto-mock
- https://github.com/geocine/typescript-transform
- https://github.com/cevek/ttypescript
- https://github.com/rimeto/ts-optchain
- https://github.com/woutervh-/typescript-is
- https://github.com/kimamula/ts-transformer-keys
- https://github.com/kimamula/ts-transformer-enumerat
- https://github.com/firede/ts-transform-graphql-tag
- https://github.com/longlho/ts-transform-img
- https://github.com/longlho/ts-transform-css-modules
- https://github.com/longlho/ts-transform-react-intl
- https://github.com/dsherret/ts-nameof
- https://github.com/LeDDGroup/typescript-transform-jsx
- https://github.com/LeDDGroup/typescript-transform-paths
- https://github.com/LeDDGroup/typescript-transform-macros
- https://github.com/timocov/ts-transformer-minify-privates
- https://github.com/cevek/ttypescript/tree/master/packages/ttypescript-examples/src
About
Typescript transform plugin removes spec definition from source file
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.