Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Directories #575

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions text/0000-test-directories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
- Start Date: 2020-01=09
- Relevant Team(s): Ember.js
- RFC PR: https://github.com/emberjs/rfcs/pull/575
- Tracking:

# Test Directories

## Summary

This RFC proposes that we change the names of an Ember app's test directories to reflect the names
in the guides. For example, instead of `tests/acceptance/*-test.js`, we should have
`tests/application/*-test.js`.

## Motivation

Renaming test directories to match the Guides will make it easier to have a shared language
between tests, and to reduce confusion for newer users when using Ember CLI.

## Detailed design

These are the directory transformations that need to happen:

- tests/acceptance -> tests/application
- tests/integration > tests/rendering
- tests/unit/utils -> tests/unit
- tests/unit/controllers -> tests/container/controllers

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a reason these are called container now? I think unit is generally a good way to look at testing this at the interface level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where that comes from. I scanned #268 and #119 but they don't seem to be the place where the terminology is introduced. Maybe @rwjblue knows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From his comments above, it does seem like #268 is where they came up:

However, I strongly dislike "container" as a name here

I regret a bit the names we landed on in #268, and perhaps this is good time to discuss those names.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through #268 I can't seem to find the introduction of it in the doc or comments.

- tests/unit/routes -> tests/container/routes
- tests/unit/services -> tests/container/services
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These list does not include all directories, in which tests are created by existing blueprints. All folders used by Ember Data to place tests in are missing:

  • tests/unit/adapters
  • tests/unit/models
  • tests/unit/serializers
  • tests/unit/transforms

Also the tests created for components and helpers if --unit flag is parsed are missing:

  • tests/unit/components
  • tests/unit/helpers

Same it true for not that popular features like mixins and (instance) initializers.

The RFC should also say what should happen to these. Not sure how the RFC should handle folders in tests that are used by addons not being part of the default blueprint. I guess they should not be touched but this should be stated explicitly in my opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't attempting to solve for Ember Data unit tests! Those generators can keep doing whatever they want IMO. @runspired or someone else from ED, do you want to expand this RFC to address those as well?


The changes required are:

- Updating the default blueprint for Ember apps
- Updating the generators for these types of tests to create files in the right directories with the right module names.
- Providing a codemod or script to move these files around.

## How we teach this

This new lexicon is already in the Ember guides, but it's possibly that a blog post noting the old
verbiage would be useful as a point of reference.

## Drawbacks

Almost no code will change (except the string names of test modules), so it's possible that this
will be seen as unnecessary churn.

## Alternatives

An alternative would be do document that when the guides talk about Application tests, they are
referring the `tests/acceptance` directory, and so on.

## Unresolved questions

- There's a possibility that there are Ember apps out there that are not using the default directory
structure provided by Ember CLI. If a custom directory structure is used, what is the way to solve this?
- Apps using `pods`. I'm not sure of the directory structure for tests created by pods. It's not
clear if this RFC should include trying to codemod those.