[Bug] Integration tests visit application and index routes
- Dominant language
- TypeScript
- Stars
- 22.6k
- Forks
- 4.2k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 15
Description
I'm opening this here although it may more properly belong in either @ember/test-helpers, ember-cli, or ember-qunit. It's unclear which holds responsibility. As this is an "out of the box" behavior I've opened the issue here. Feel free to transfer it if another repository makes more sense.
### 🐞 Describe the Bug
When creating an integration test using `module` and `setupRenderingTest`, the application's `application` and `index` route will be visited, for instance with the very basic test below:
```js
import { module, test } from "qunit";
import { setupRenderingTest } from "ember-qunit";
import { render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
module("Integration | Component | expand-btn", function (hooks) {
setupRenderingTest(hooks);
test("it renders", async function (assert) {
await render(hbs``);
assert.equal(this.element.textContent.trim(), "");
});
});
```
### 🔬 Minimal Reproduction
Generate a new app, add logging to the application beforeModel and index beforeModel route hooks. Generate a component and run tests, observe the logging.
### 😕 Actual Behavior
Routes are visited even though the `visit` API has not been used.
### 🤔 Expected Behavior
No routes to be visited.
### 🌍 Environment
ember-source 3.24.2
ember-cli: 3.28.2
@ember/test-helpers: 2.5.0
ember-qunit: 5.1.5
node: 14
Contributor guide
Assessment
This issue has not been assessed yet.