You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the name of tests is hardcoded to a default value in AVAVerify#testBody. Once arbs have been generated, pass them to opts.title() (if opts.title is provided).
AVAVerify#opts can already contain a title function (@param opts.title), so no changes to options are expected.
In testBody after genArbs is called (71), vals is an array of values that should be passed to the test.
If a title option is provided (and is a function), then the suite name (opts.suite) and the values (vals) should be passed to title, and the result should be stored in the suite title.
t._test is a backdoor into AVA's Test class.
Setting t._test.title should change the title of the test suite.
Write a helper function for setting the test title if it's cleaner.
If opts.title is a function, call opts.title(opts.suite, ...vals) after getting values from genArbs
Pass generated title to t._test.title to change the test name.
Example and Testing
It would be good to write a new example for the different naming options. Write examples/test-naming.js with suites that test:
Default naming (no suite, no title)
Custom suite and title
Custom suite, default title
Default suite, custom title
Make sure that each test suite will output a unique name - e.g. make sure the custom title is very distinct from the default title, so the output from the suites can be tested against.
Write a test suite for this example. See test/examples/usage/passes.js for an example.
Modify test/examples/helpers/run-example.js to take opts.args, a string containing additional command line arguments to the exec() command
Write test test/examples/test-naming/passes.js
Ensure that the tests pass (check the exit code)
Write test test/examples/test-naming/suite-names.js
Pass the -v flag to AVA to output the name of each test run.
Test that some of the suite names are output string to make sure two or three runs of each suite are properly named.
The text was updated successfully, but these errors were encountered:
Currently the name of tests is hardcoded to a default value in
AVAVerify#testBody
. Once arbs have been generated, pass them toopts.title()
(ifopts.title
is provided).Expected usage is already in the README:
Possible Implementation
AVAVerify#opts
can already contain atitle
function (@param opts.title
), so no changes to options are expected.In
testBody
aftergenArbs
is called (71),vals
is an array of values that should be passed to the test.If a
title
option is provided (and is a function), then the suite name (opts.suite
) and the values (vals
) should be passed totitle
, and the result should be stored in the suite title.t._test
is a backdoor into AVA'sTest
class.Setting
t._test.title
should change the title of the test suite.Write a helper function for setting the test title if it's cleaner.
opts.title
is a function, callopts.title(opts.suite, ...vals)
after getting values fromgenArbs
t._test.title
to change the test name.Example and Testing
It would be good to write a new example for the different naming options. Write
examples/test-naming.js
with suites that test:suite
, notitle
)suite
andtitle
suite
, defaulttitle
suite
, customtitle
Make sure that each test suite will output a unique name - e.g. make sure the custom
title
is very distinct from the defaulttitle
, so the output from the suites can be tested against.Write a test suite for this example. See
test/examples/usage/passes.js
for an example.test/examples/helpers/run-example.js
to takeopts.args
, a string containing additional command line arguments to theexec()
commandtest/examples/test-naming/passes.js
test/examples/test-naming/suite-names.js
-v
flag to AVA to output the name of each test run.output
string to make sure two or three runs of each suite are properly named.The text was updated successfully, but these errors were encountered: