Skip to content

(CLI 3.0 BETA) Allow option to place test files alongside source files instead of separate "tests/unit" folder #1245

Closed
@calebjacob

Description

@calebjacob

What problem does this feature solve?

There are many advantages to having test files live alongside your source files instead of placing all test files in a separate folder. When creating a new Vue project via the CLI, it would be fantastic to be able to choose placing all unit tests inside of a separate "tests/unit" folder OR place unit test files alongside source in "src/**/*.spec.js".

The "test" command in the package.json that is generated can be easily tweaked to make this work:

"test": "vue-cli-service test 'src/**/*.spec.js'"

This allows for a project structure like so:

./src
./src/components
./src/components/my-component.vue
./src/components/my-component.spec.js

What does the proposed API look like?

When running vue create, I'd imagine a question asking where you'd like your unit tests to live. Either a separate test folder, or alongside source.

Thanks for all the amazing work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions