Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all assets to test-support.js instead of vendor.js #399

Closed
wants to merge 3 commits into from

Conversation

simonihmig
Copy link
Contributor

This fixes #397 and also implements the other changes suggested there: All (own and imported) JS is moved from vendor.js to test-support.js. The repo's code is now in the addon-test-support tree, and the trickery in treeForAddonTestSupport() (shamelessly stolen from ember-native-dom-helpers) makes sure the imports have not changed (i.e. no test-support/ path added to imports).

I tried this fork with a large app, and was working fine. Didn't have to update anything (except package.json), and all still working. I hope I am not missing something though, so please double check if these changes make sense for you! :)

@coveralls
Copy link

coveralls commented Apr 7, 2018

Coverage Status

Coverage decreased (-3.2%) to 95.522% when pulling b84e504 on simonihmig:fix-fastboot-jquery into e53564e on san650:master.

index.js Outdated
// TODO: In order to make the addon work in EmberTwiddle, we cannot use // the `tests` prop til
// https://github.com/joostdevries/twiddle-backend/pull/28 is merged.
// return !!this.app.tests;

if(process.env && process.env.EMBER_CLI_FASTBOOT) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, this was used in pre-stable versions of FastBoot, but isn't a thing anymore for a while, so removed it.


describe('#treeFor app', function() {
treeForTests('app');
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed these tests (which were failing before), because I think they don't really apply anymore. app and addon are always empty now, and for addon-test-support there's no need for conditional logic anymore as it is only used in tests anyway.

@san650
Copy link
Owner

san650 commented Apr 7, 2018

Thanks @simonihmig for working on this!

As you said we have to test this change to validate there are not regressions.

I'll test it on some small projects I have but it would be great if @magistrula and others that have big test suites can test it as well.

Copy link
Collaborator

@ro0gr ro0gr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. This change allows ember-cli-page-object to be more similar to the rest of existing testing addons.

I believe we still have to change API paths for the docs generator as well:

globs: ['addon/-private/{create.js,properties/*.js}' ]

index.js Outdated
});
},

_shouldIncludeFiles() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think _shouldIncludeFiles was previously needed to exclude ember-cli-page-object assets from the prod builds. Now it should be handled by ember-cli since test-support stuff is not included to the prod builds. So I'd say we can remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good catch. Makes sense!

@ro0gr
Copy link
Collaborator

ro0gr commented Apr 7, 2018

@simonihmig I've just merged docs updates which produced conflicts in your PR 😫 Sorry for not merging it earlier. Can you please resolve conflicts?

@ro0gr
Copy link
Collaborator

ro0gr commented Apr 7, 2018

Hm.. Seems like addon-test-support/ is not included in the code coverage reports.

@simonihmig simonihmig force-pushed the fix-fastboot-jquery branch from 81b9a80 to 801d0f9 Compare April 7, 2018 17:54
@simonihmig simonihmig force-pushed the fix-fastboot-jquery branch from 801d0f9 to b84e504 Compare April 7, 2018 18:37
@simonihmig
Copy link
Contributor Author

Thanks for the quick feedback!

I rebased this, and cleaned this up a bit further.
Removed _shouldIncludeFiles, and changed the node-assets config a bit, as it does not need to be dynamic anymore. This revealed that ceibo was still imported to vendor.js, which should be fixed now as well.

I believe we still have to change API paths for the docs generator as well

I updated this line, but as I am not aware how that works, please double check...

I'll test it on some small projects I have but it would be great if @magistrula and others that have big test suites can test it as well.

Absolutely! I reran the latest changes on one of our apps, and its 1700+ tests (all included) are still all passing.

Hm.. Seems like addon-test-support/ is not included in the code coverage reports.

Sorry, I have no idea how that works! 😝 Also wondered how coverage could have changed significantly. Anything I can do on my side to fix this?

@ro0gr
Copy link
Collaborator

ro0gr commented Apr 7, 2018

Also wondered how coverage could have changed significantly. Anything I can do on my side to fix this?

Looks like it should be fixed in the latest of ember-cli-code-coverage. I think we just have to upgrade it.

@ro0gr
Copy link
Collaborator

ro0gr commented Apr 8, 2018

I think we just have to upgrade it.

I've just tried ember-cli-code-coverage@1.0.0-beta.3 locally. Unfortunatelly it reports zero coverage for each of file in the addon-test-support/ folder. Probably it's related to the import path tricks borrowed from ember-native-dom-helpers.

@ro0gr
Copy link
Collaborator

ro0gr commented Apr 17, 2018

@simonihmig FYI I'm currently working on the code coverage issue on top of your branch. The issue is caused by the fact that ember-cli-code-coverage expects generated code to have a fixed module path (addon-name/test-support). So the possible solution is to change only entries module names(index, extend, macros) and leave the rest of the files under ember-cli-page-object/test-support namespaced.

wip branch: https://github.com/ro0gr/ember-cli-page-object/commits/addon-test-support-coverage

@simonihmig
Copy link
Contributor Author

@ro0gr Hm, I see. Thanks for working on this, and for giving feedback! Hope it works out somehow!

@ro0gr
Copy link
Collaborator

ro0gr commented May 14, 2018

@simonihmig just merged #400. Thanks for the great idea!

@ro0gr ro0gr closed this May 14, 2018
@simonihmig
Copy link
Contributor Author

@ro0gr Sure, thanks for picking this up and getting it across the finish line! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FastBoot broken without jQuery
4 participants