Does anyone have a good strategy for adding TypeScript to a continuous integration system?
I'm planning on piling it in my build and then running unit tests against it's generated JavaScript.
However, I'd like to add code standards checking for the TypeScript. Any ideas?
Thanks.
Does anyone have a good strategy for adding TypeScript to a continuous integration system?
I'm planning on piling it in my build and then running unit tests against it's generated JavaScript.
However, I'd like to add code standards checking for the TypeScript. Any ideas?
Thanks.
Share Improve this question asked Jan 23, 2013 at 17:51 samanimesamanime 26.6k17 gold badges97 silver badges150 bronze badges3 Answers
Reset to default 2The TypeScript team are deliberately reserving judgement on the official coding standards because they want to see how people use the language in real life. Anecdotally, people seem to be following the JavaScript naming conventions, i.e. ModuleName
, ClassName
, functionName
.
You can write your unit tests in TypeScript (tsUnit) or JavaScript (Jasmine, QUnit et al).
How you integrate it with CI depends a little on the framework and on the CI platform. I have integrated tsUnit tests with Visual Studio and TFS using the MS Script Engine to execute the tests. If you want more details on this particular set up I am happy to share.
One option is to set up TSLint and integrate it into your build process.
In my case (an Angular 2+ app), I added an npm task to run TSLint. Then the CI system (VSTS for me) executes that npm task. The CI system fails the build if TSLint detects any errors. The TSLint task I'm using es from Angular's quickstart project. Here: https://github./angular/quickstart/blob/master/package.json [Notice the "lint" script]
Also note that TSLint's rules are configurable, so you can customize the coding standard to whatever you want to use.
Your question is vague; it's difficult to give a precise answer.
For integrating TS pilation into your build system, you'll want to simply invoke the TypeScript mand line piler (tsc.exe) on your .ts files. This will output the JS and you can run your unit tests against those.
Regarding TS code standards, I don't think there's any tooling available now that look at TS coding standards, seeing as how the language went public just a few months ago.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745109658a4611769.html
评论列表(0条)