actions-on-google / actions-on-google-testing-nodejs

Apache License 2.0
75 stars 18 forks source link

Removed call to t.plan() to improve tap and JUnit report output #40

Closed adamcohenrose closed 5 years ago

adamcohenrose commented 5 years ago

If t.plan(1) is called, then the only text in the report is that the test expected one assertion and got a different number.

Compare:

            name: AssertionError
            message: Planned for 1 assertion, but got 0.
            assertion: plan
            operator: ===
            at: ActionsOnGoogleAva.<anonymous> (node_modules/actions-on-google-testing/src/actions-on-google-ava.ts:58:21)

and

          ---
            name: AssertionError
            message: Rejected promise returned by test
            values: {"Rejected promise returned by test. Reason:":"AssertionError [ERR_ASSERTION] (AssertionError) {\n  actual: '&lt;speak&gt;Your basket is now empty.&lt;/speak&gt;',\n  code: 'ERR_ASSERTION',\n  expected: '&lt;speak&gt;Your basket is now full.&lt;/speak&gt;',\n  generatedMessage: true,\n  operator: '==',\n  message: '\\'&lt;speak&gt;Your basket is now empty.&lt;/speak&gt;\\' == \\'Your basket is now empty.X\\'',\n}"}
            at: equal (functional-test/add-remove-over-min-spend-test.js:14:14)
          ...

See https://github.com/avajs/ava/blob/master/docs/recipes/when-to-use-plan.md

Fleker commented 5 years ago

Thanks!

Fleker commented 5 years ago

Do you have any preference for the order in which the three PRs get merged?

adamcohenrose commented 5 years ago

No preference -- they should all be independent

Fleker commented 5 years ago

LGTM, thanks