kaliber5 / ember-fastboot-addon-tests

Addon testing support for Fastboot compatibility
MIT License
25 stars 9 forks source link

Local changes not being picked up when running tests #21

Open mansona opened 6 years ago

mansona commented 6 years ago

This is a bit of a strange issue that is hard to explain what is going on but I will try my best.

I was working on a reported issue in one of my addons, the issue was a strange behaviour in the FastBoot render hence the need for a FastBoot testing harness. I set up a test using ember-fastboot-addon-tests to attempt a "red/green" test, making sure that I could capture a failing test before getting it working again.

I managed to capture the failing scenario with a test but when I implemented the fix and tried to run ember fastboot:test it didn't actually pick up any of my changes. I then ran the dummy app with ember-cli-fastboot and it seemed to have fixed my issue when doing manual testing.

At this point I thought it was a cache issue so I cleared my dist and tmp folders and ran ember fastboot:test again and it still didn't work. Even a fresh build on Travis wasn't working correctly.

I then published the addon as a patch version because I was relatively sure the fix was valid because of my manual testing and then when running the local ember fastboot:test again it started working.

My best guess for a mental model of what is going on here is that the ember fastboot:test is somehow installing my addon from npm instead of using the local files, which would mean that it would need an npm publish before it would pick up changes that would fix any tests that are broken.

I could probably recreate this issue if you would like a demo, but I'm wondering if this is a known behaviour already before I spend the time on attempting a re-creation.

Let me know if you have any questions 👍

simonihmig commented 6 years ago

@mansona thanks for reporting! This is strange, and certainly not an expected behavior! 🤔

Your addon should have been symlinked to the temporary app's folder, so it should pick up any changes without requiring you to publish it. This lib uses ember-cli-addon-tests under the hood, which symlinks the addon here: https://github.com/tomdale/ember-cli-addon-tests/blob/master/lib/utilities/pristine.js#L237-L267

Not sure what's happening in your case. Maybe you could run it with debugging output enabled:

DEBUG=ember-cli-addon-tests ember fastboot:test

This should output some symlink messages (see the source code).

Btw, you are using this under OSX/Linux or Win? I don't know for sure how the latter behaves, regarding symlinks...

simonihmig commented 6 years ago

Oh wait a sec, just recalled this one: https://github.com/tomdale/ember-cli-addon-tests/issues/176

Maybe this is what is happening to you?

mansona commented 6 years ago

@simonihmig as you can see by all the linked issues/PRs I have done a bit of investigation into this 😂 and yes I think that's the issue that I'm facing.

It's a long-standing issue with npm that they are in the process of fixing but we could potentially fix this if we could get the link part of the process to happen after all npm install commands are executed.

I had my best crack at it with the little amount of context I could follow in the time that I had, maybe you can see a way to navigate this? If you wanted to pair on this for a bit this week I'm free too