Get help with testing, discuss unit testing strategies etc.


Post by AaronTovo »

I have a question about running jslint/hint on the siesta test code. StartTest() shows the "Missing new" error because it has a capitalized name but is not a ctor.

This is minor, after all it's only test code, but it's still annoying to have that red mark in my IDE (IntelliJ).

I can tell jslint to ignore the capitalized ctor convention but I'd like to enforce that convention in general. Do you have a good way for getting rid of this warning without disabling the capitalization rule?

Post by mats »

I think you'll just need to instruct JSLint about StartTest being a known global.

https://www.jslint.com/lint.html

Post by gjslick »

I'm having the same issue, except with JSHint. All of our test files show an error in our IDE (Eclipse with the jshint-eclipse plugin), which is very annoying when trying to find actual errors.

The error is the same by the way, "Missing 'new' prefix when invoking a constructor", and we don't want to turn that option off because it's most definitely useful for the rest of our code.

Why is the function named StartTest() instead of startTest()? Why go against the standard (and very useful) JavaScript convention of only capitalizing the names of constructor functions? Can you guys please add a lowercase startTest() alias of the function for us to use instead, so that we don't get this JSLint/JSHint error?

Thanks,
Greg

Post by nickolay »

The original idea of StartTest() was to make it look more like a syntax construct, not a function. It does make sense to add an alias, created a ticket for this: https://www.assembla.com/spaces/bryntum ... nt--jshint

Post by gjslick »

I gotcha. And I understand you wanting to make it look like something of a construct. But even so, the first time I saw that, it seemed like one of those things you "had to already know" - that this function was part of the framework (and not some newb developer's code!). So honestly, it's still a little confusing. Maybe something like Siesta.startTest() would be better? (instead of a global function?)

Post by nickolay »

This was fixed in 1.1.4 btw.

Post Reply