yugui/jsonnetunit

Don't require `test` prefix or throw error

mariusgrigoriu opened this issue · 2 comments

I'm finding that a common mistake is to forget to add the test prefix like this:

test.suite({
    fooShouldHaveLengthThree: {
        actual: std.length('foo'),
        expect: 3,
    },
})

The result is that the test gets skipped without any warning. This means that you can have failing test cases that look green. It might improve usability to either interpret everything as a test or to throw an error if fields exist that don't start with test.

I'm happy to contribute a PR. What are your thoughts on this?

yugui commented

The current design follows the one in JUnit3 so that you can define helper fields in the same object.
The design also makes it possible for tests coexist with test targets within an object.

So I don't have any plan to change the design for now.

That makes sense. Will close for now and look for other ways to prevent this type of error.