question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does folder containing tests have to be called "tests"?

See original GitHub issue

If the folder containing tests isn’t named tests, the code in IntelliJ goes red. Is there a setting I need to set somewhere?

This is shown in the screenshot below, where the folder is called test rather than tests:

elm test folder

If I rename the folder from test to tests, the red code goes black as normal.

The screenshot above is just a cut down example, where renaming the folder to “tests” would obviously be an easy answer. However the reason I don’t want a folder called “tests” is because in a real solution the structure is a bit more complicated (it’s a Spring Boot app):

- src
  - main
    - kotlin
    - elm
  - test
    - kotlin
    - elm
      - <tests go here>

Note that I can run elm-test on a command-line and the tests run fine, regardless of the name of the folder.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
klazukacommented, Dec 26, 2019

@yonigibbs I just merged the PR

0reactions
klazukacommented, Dec 28, 2019

Source-direcctory hack

Let’s make it the user’s responsibility to add it to source-directories. Presumably they will have got things working from the command line already. And I would hope that as elm-test becomes more deeply integrated with Elm itself, they will make changes to the elm.json format to include a setting for test source dir.

However, there may be another way to handle this which has additional advantages. Right now the plugin shows a yellow banner at the top of the editor when it cannot find an associated ElmProject (elm.json) for the current .elm source file. And it gives the user the option to attach another elm.json file to the workspace to solve the problem. But in this case, the solution is not to attach but to add the containing directory as a source-directory to an existing ElmProject in the current workspace.

By taking this approach, we can solve this case as well as other cases (i.e. the user creates a vendor directory and moves some third-party Elm code into it but forgets to update source-directories). The downside might be that by suggesting it to the user, we might lead them down the wrong path in some cases. Wording would be important.

Duplicate test configs

Re-running the tests via the context menu (or ctrl-shift-r) should not re-create the run config. Maybe that’s a regression when the code was ported from Java to Kotlin. I just created an issue for it (#574).

Restricting tests to specific file(s)

Restricting the scope of tests based on context would be nice. I suspect that this would be a bit of work, so I would leave it out-of-scope for now. It looks like 0.18 elm-test only accepts a single file as a parameter, whereas 0.19 accepts multiple.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Running unittest with typical test directory structure
python -m unittest discover will find and run tests in the test directory if they are named test*.py . If you named the...
Read more >
Testing with files and directories - Testfixtures - Read the Docs
Working with files and directories in tests can often require excessive amounts of boilerplate code to make sure that the tests happen in...
Read more >
Writing and Organizing Tests - Cypress Documentation
Configuring Folder Structure. While Cypress allows you to configure where your tests, fixtures, and support files are located, if you're starting your first ......
Read more >
Creating a test folder - TestArchitect Docs
It is generally recommended that, for projects of any significant size, you always use test folders to organize your test modules. To create...
Read more >
Good Integration Practices — pytest documentation
foo.test_view and tests.bar.test_view , allowing you to have modules with the same name. But now this introduces a subtle ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found