mmanela / chutzpah

Chutzpah is an open source JavaScript test runner which enables you to run unit tests using QUnit, Jasmine, Mocha and TypeScript.
http://mmanela.github.io/chutzpah/
Apache License 2.0
550 stars 142 forks source link

Setup before running each test-file takes 2-3 seconds #162

Closed mmanela closed 10 years ago

mmanela commented 10 years ago

Mrcalzone[CodePlex]
'm running version 2.5.0, and have around 15-20 test-files using Qunit and Typescript.

running all the tests takes more than 60 seconds. It seems that running the tests in each file itselfs is quick (typically 0.02 seconds), but that it takes around 3 seconds to prepare for each .ts file.

In the trace-file, you can see it takes almost 3 seconds from sinon-1.7.3 is added, to the next log-message is displayed.

In conclution, it seems most of the time is spent setting up the environment for each test-file.

See this discussion

mmanela commented 10 years ago

mmanela[CodePlex]
In version 3.2 I added the new batch compile setting mode that fixes this problem

mmanela commented 10 years ago

mmanela[CodePlex]
The merging will help, also the next version of Chutzpah will include a newer version of the TypeScript compiler which should help.

My plan will be if after 1.0 of TypeScript is release and Chutzpah updates to use it the performance is still bad I can investigate doing more caching to make it faster.

mmanela commented 10 years ago

nshah55[CodePlex]
We have a similar issue, but with running Chutzpah tests on our build server. The workaround we use is to merge all the test TS files into one, and then run tests on just this one file. The custom MSBuild task we use for merge is below

ItemGroup TestFiles Include=jsreferences.ts;js*_.test.ts;js*\.spec.ts/ /ItemGroup

Target Name=MergeTypeScriptTestFiles ReadLinesFromFile File=%(TestFiles.Identity) Output TaskParameter=Lines ItemName=lines/ /ReadLinesFromFile WriteLinesToFile File=js\TypeScriptTests.ts Lines=@(Lines) Overwrite=false / /Target

mmanela commented 10 years ago

Mrcalzone[CodePlex]
Yes, I'll see what I can do. I'll get back to you as soon as I have a minimum setup that reproduces it.

mmanela commented 10 years ago

mmanela[CodePlex]
Could you give a repro that distills the essence of your setup with out giving up any non-shareable code?

mmanela commented 10 years ago

Mrcalzone[CodePlex]
sorry for the late reply: Unfortunately, I cannot upload the tests and typescript-files right now, as this is internal code in my corporation.

mmanela commented 10 years ago

mmanela[CodePlex]
Can you attach a zip with your setup so I can test against.