balderdashy / waterline-adapter-tests

API integration tests for Waterline adapters
MIT License
16 stars 41 forks source link

Features #62

Closed particlebanana closed 9 years ago

particlebanana commented 9 years ago

This expands on @dmarcelino's awesome cross adapter joins test feature. I wanted to be able to have more control over what ran using something like .only on the test.

It copies all the files from the associations tests which might suck so I'm down for edits.

dmarcelino commented 9 years ago

Hey @particlebanana, I can't say I love this approach as it's not very DRY which is what I was trying to avoid... This has the very nasty effect of duplicating the tests and if one wants to add or modify an associations test it will have to do it in 2 different places. In other words it will become difficult to be sure that both sets of tests are in sync :confused:

I agree with moving crossAdapter tests outside interfaces folder, I made a similar suggestion in https://github.com/balderdashy/waterline-adapter-tests/pull/57#issuecomment-97547385:

I was just thinking... maybe instead of having these tests in interfaces/crossAdapter we should move them to a new folder like features/crossAdapter. That would give us a place to put other non-interface / optional tests like, for example, features/schemaless (issues like balderdashy/waterline#366 could use it). These would also be enabled through the package.json like interfaces is currently.

I see what you mean by using .only for debug. If we consider my original proposal plus making the cross-adapter tests enabled/disabled through package.json you could also achieve the same by deactivating the associations interface and using .only on the test you'd like to debug. Not as elegant but workable.

particlebanana commented 9 years ago

I wish symlinks worked for everyone because then you could just symlink the association tests and have the ability to create additional cross_adapter only tests :confused:

dmarcelino commented 9 years ago

Agreed, symlinks would be a perfect fit for this.

BTW, with my original proposal we can still add crossAdapter specific tests to the crossAdapter folder and they will run. Check lib/crossAdapter.js:

  var files = [];

  var bootstrapPath = Path.resolve(__dirname,'../interfaces/crossAdapter');
  files = files.concat(utils.fileLookup(bootstrapPath, filter, true));

  this.associationTypes.forEach(function(type) {
    var interfacePath = Path.resolve(__dirname,'../interfaces/associations/' + type);
    files = files.concat(utils.fileLookup(interfacePath, filter, true));
  });

All tests in crossAdapter folder will be added to the mocha runner in addition to the association interface ones :wink:

dmarcelino commented 9 years ago

@particlebanana, please take a look at PR #64 which is my original proposal plus the concept of features where "cross-adapter" is a feature. This allows us to only run the tests in adapters that are configured to run them and it will be easy to add other feature tests such as, for example, schemaless tests.

Please note that any other tests placed in /features/crossAdapter will also run.

particlebanana commented 9 years ago

@dmarcelino yours is great!