A developer wants Copilot to generate a thorough unit test suite for an existing pure pricing function, and wants the suggestion to follow the project's own testing library and assertion style rather than a generic guess. Before prompting Copilot Chat, which preparation steps most improve the quality of the generated tests? Select TWO.
export function totalWithTax(net, taxRate) {
return net + net * taxRate;
}- AOpen the function under test and an existing test file from the same project so Copilot sees the testing library, fixtures, and assertion style already in use as context. Correct
- BAdd a content exclusion over the existing test directory so Copilot cannot read the old tests and is forced to invent a fresh, cleaner test structure of its own.
- CSwitch the organisation to Copilot Enterprise first, because a higher plan is required before Copilot Chat is allowed to generate unit tests from a selected function at all.
- DWrite a specific prompt that states the function's intended behaviour, the cases to cover such as zero and negative inputs, and the test framework the suite must target. Correct
- EDelete the function's type annotations before prompting, since untyped code lets Copilot consider more possible behaviours and therefore produces a broader set of test cases.
Why A is correct: Open relevant files give Copilot real context about the function and the project's testing conventions, so the generated suite mirrors the library and assertion style in use.
Why B is wrong: Content exclusions only remove files from context and never improve test quality, so hiding the existing tests strips away the very conventions the developer wants matched.
Why C is wrong: Test generation in Chat is available on paid Copilot tiers generally, so an Enterprise upgrade is not a prerequisite and does not change the quality of the prompt context.
Why D is correct: A specific prompt naming behaviour, target cases, and the framework narrows Copilot's output towards a focused, correct suite instead of a vague generic draft.
Why E is wrong: Removing type information takes away useful signal, so Copilot has less to reason about and tends to produce vaguer tests, not a broader or stronger suite.