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

exclude test folder from webpack compilation #15

Closed
BugsBunnyBR opened this Issue Feb 24, 2016 · 17 comments

Comments

Projects
None yet
2 participants
@BugsBunnyBR
Contributor

BugsBunnyBR commented Feb 24, 2016

If you decompile the current generated apk, the test folder is being included in the build and shipped with the apk.
I tried to add
exclude: [ /\.(e2e|spec)\.ts$/, /node_modules/, /test/ ]
to webpack.config.js, while it seems to be something right, it is not enough to avoid the packing of the www/build/test folder generated when the tests are executed. If it is too hard to make webpack ignore the folder, can we delete the www/build/test after the tests are executed?

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 24, 2016

Owner

Very interesting, nice catch. We should be able to hack something in gulp at least for cleanup. Would be nicer in webpack tho.

Will have a look at some point.

Owner

lathonez commented Feb 24, 2016

Very interesting, nice catch. We should be able to hack something in gulp at least for cleanup. Would be nicer in webpack tho.

Will have a look at some point.

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 24, 2016

Owner

Will address this with gulp instead of webpack because

  • you've already tried webpack
  • looks like ionic are coming back to gulp
Owner

lathonez commented Feb 24, 2016

Will address this with gulp instead of webpack because

  • you've already tried webpack
  • looks like ionic are coming back to gulp
@BugsBunnyBR

This comment has been minimized.

Show comment
Hide comment
@BugsBunnyBR

BugsBunnyBR Feb 24, 2016

Contributor

ok

Contributor

BugsBunnyBR commented Feb 24, 2016

ok

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

Was thinking to just cleanup the build after test, however this would mean that the local coverage data is lost, which I am not prepared to accept.

Options instead are:

  • wrapping ionic build in a gulp task to delete
  • address the problem in webpack
Owner

lathonez commented Feb 29, 2016

Was thinking to just cleanup the build after test, however this would mean that the local coverage data is lost, which I am not prepared to accept.

Options instead are:

  • wrapping ionic build in a gulp task to delete
  • address the problem in webpack
@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

Digging a bit deeper, all it does is cordova build android. running this gives you spec files inside the APK, as long as they are present in www/build/test. Meaning it's nothing to do with webpack. Webpack is just bundling for ionic.

Owner

lathonez commented Feb 29, 2016

Digging a bit deeper, all it does is cordova build android. running this gives you spec files inside the APK, as long as they are present in www/build/test. Meaning it's nothing to do with webpack. Webpack is just bundling for ionic.

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

cordova prepare anrdoid is copying it into platforms/android/assets/www/build/test/, and it's getting compiled as part of the build thereafter

Owner

lathonez commented Feb 29, 2016

cordova prepare anrdoid is copying it into platforms/android/assets/www/build/test/, and it's getting compiled as part of the build thereafter

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

turns out we're using gradle instead of ant, so ant.properties aint gna do much

Owner

lathonez commented Feb 29, 2016

turns out we're using gradle instead of ant, so ant.properties aint gna do much

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

Have a solution using cordova's beforeBuild hook. It isn't ideal though. I'd rather gradle ignored the test files rather than us deleting them in a beforeHook.

https://cordova.apache.org/docs/en/dev/guide/appdev/hooks/index.html

Owner

lathonez commented Feb 29, 2016

Have a solution using cordova's beforeBuild hook. It isn't ideal though. I'd rather gradle ignored the test files rather than us deleting them in a beforeHook.

https://cordova.apache.org/docs/en/dev/guide/appdev/hooks/index.html

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

I'm happy enough from that last answer that there's no clean way of doing it in gradle at the moment.

Owner

lathonez commented Feb 29, 2016

I'm happy enough from that last answer that there's no clean way of doing it in gradle at the moment.

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

debating whether:

  • delete after npm test
  • delete with the beforeHook
  • move with the beforeHook

I think I will go with delete with the beforeHook because you can't guarantee npm test will do the cleanup for you. Moving instead of deleting is probably cleaner but can't be bothered with that faff.

Owner

lathonez commented Feb 29, 2016

debating whether:

  • delete after npm test
  • delete with the beforeHook
  • move with the beforeHook

I think I will go with delete with the beforeHook because you can't guarantee npm test will do the cleanup for you. Moving instead of deleting is probably cleaner but can't be bothered with that faff.

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

Maybe beforeCompile is perfect, nuke it from the assets folder

Owner

lathonez commented Feb 29, 2016

Maybe beforeCompile is perfect, nuke it from the assets folder

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez
Owner

lathonez commented Feb 29, 2016

@lathonez lathonez closed this Feb 29, 2016

@BugsBunnyBR

This comment has been minimized.

Show comment
Hide comment
@BugsBunnyBR

BugsBunnyBR Feb 29, 2016

Contributor

Great! Using grdle would help only android builds, so using cordova hooks should solve the issue for android and ios!
Just one question.. don't you have the "hooks" folder in your project? It seems to be the default folder name...

Contributor

BugsBunnyBR commented Feb 29, 2016

Great! Using grdle would help only android builds, so using cordova hooks should solve the issue for android and ios!
Just one question.. don't you have the "hooks" folder in your project? It seems to be the default folder name...

@BugsBunnyBR

This comment has been minimized.

Show comment
Hide comment
@BugsBunnyBR

BugsBunnyBR Feb 29, 2016

Contributor

One more thing, "ionic run android" does not trigger the "before_compile" script. Would it be desirable to clean the test build folder when just running? If this is the case, changing from "before_compile" to " after_prepare" seems to solve the issue.

changing color of console.log output would be nice too. :-D

Contributor

BugsBunnyBR commented Feb 29, 2016

One more thing, "ionic run android" does not trigger the "before_compile" script. Would it be desirable to clean the test build folder when just running? If this is the case, changing from "before_compile" to " after_prepare" seems to solve the issue.

changing color of console.log output would be nice too. :-D

@lathonez

This comment has been minimized.

Show comment
Hide comment
@lathonez

lathonez Feb 29, 2016

Owner

Wow, all great advice - thanks. It's much better now 82be26a

Owner

lathonez commented Feb 29, 2016

Wow, all great advice - thanks. It's much better now 82be26a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment