4

I want to try to place tests in pods, so instead of

tests
  unit
    routes
      resource-test.js
app
  pods
    resource
      route.js

I want to have

app
  pods
    resource
      route.js
      route-test.js

This seems to be taking pods to their logical conclusion--namely, to include all pod-related "things" in the pod, instead of scattered somewhere else in the directory structure.

I am able to get the tests picked up by setting the src_files property in testem.json to include app/pods/**/*-test.js.

However, I am running into a problem with jshint. The .jshintrc in tests has predefs for things like moduleFor. So tests located inside tests pass jshint fine. However, app has its own .jshintrc, which doesn't define the test-related globals. So jshint fails on the test files under app/pods. I would prefer to keep a separate .jshintrc for testing-related files, but how can I have one .jshintrc applied to the test files and another one applied to non-test files?

More generally, are there any best practices or tricks for putting test files into the pod structure?

  • 1
    This seems to be taking the pods structure to the extreme, I will be interested to see what responses you get. – IanVS Mar 19 '15 at 15:06
  • 1
    in later versions of ember-cli-qunit the `moduleFor` and `test` helpers are imported via es6 modules. this should make it easier to use a single `.jshintrc` and have your tests pass linting. If you had some other test helpers that were in the global scope, you could make an AMD shim for them and import as as6 modules too. – tstirrat Mar 22 '15 at 15:18

1 Answers1

2

Unfortunately this is not yet supported, although I (one of the ember-cli maintainers) hope this to be a reality sometime soon!

Stefan Penner
  • 1,087
  • 8
  • 10