Extended test
applicationTest, renderingTest, and test set up your app and an @ember/test-helpers context before each test. They match setupApplicationTest, setupRenderingTest, and setupTest from QUnit.
Why choose it
Choose the extended test over render, visit, and setupRenderingContext for these reasons:
- All of
@ember/test-helpersworks, includingrender,visit, andcurrentURL. - Test helpers that libraries build on
@ember/test-helperswork as they do in QUnit.@ember/test-helpersdoes not depend on a test framework, so a library does not need a vitest version of its helpers. - Tests that you move from QUnit need the fewest changes.
WARNING
These functions are an experiment, and semver does not cover them. Tests that use them cannot run in parallel, because setApplication from @ember/test-helpers is global.
The functions
applicationTest, for routes and user flowsrenderingTest, for componentstest, for code that needs the owner but does not render
The test context
The test callback gets these values:
js
`renderingTest|applicationTest|test`(
"name of your test here",
({
// The element that the component or application renders into.
element,
// The test context. It has only the owner.
context: { owner },
// The internal test setup.
// env.owner is context.owner, and env.element is element.
env: { owner, element, pauseTest },
}) => {},
);