node-red / node-red-node-test-helper

A test framework for Node-RED nodes
Apache License 2.0
57 stars 41 forks source link

Using cache for load function #51

Open yuto-yuto opened 3 years ago

yuto-yuto commented 3 years ago

I use this module to write flow test as well. However, It takes long time to complete redNodes.startFlows in helper.load function when a flow file is big. I created a big flow.json in this PR and it takes about 300 ms for load function for each test. If there are 100 test cases for the flow it takes 30 seconds. However, most test cases can use exactly the same setting and they don't have to call load function again. Therefore, I introduced cache. I applied this changes to my project that has about 10 flow files and existing tests works without any change. I want to merge this change if it still follow the concept of this module.