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

starter #1

Closed
LiTiang opened this issue Jul 25, 2016 · 5 comments
Closed

starter #1

LiTiang opened this issue Jul 25, 2016 · 5 comments

Comments

@LiTiang
Copy link

LiTiang commented Jul 25, 2016

like angular2-webpack-starter

could u please give a example how to use AVA with Webpack?

@thrandre
Copy link
Owner

thrandre commented Aug 8, 2016

Sorry, but I have been extremely busy lately. I have added a minimal usage example, but the implementation and readme both need a bit of polishing. I am available for questions, but I hope this is enough to get you started.

Thank you!

@LiTiang
Copy link
Author

LiTiang commented Aug 9, 2016

@thrandre, i very very appreciate u reply me

& i also appreciate u present an example,

now i just have one more question about the functions of ava-webpack.


In github project naming "angular2-webpack-starter",

i find out Karma do a magic thing,

when we run unit testing on typescript file,

Karma will use webpack to transpile typescript,

then Karma will test the result which webpack given !!!

( javascript file in memory, because we actually dont see any javascript file after transpiling by webapck)

but i dont want to use Karma for some reason,

"angular2-webpack-starter" use karma-webpack,

so it can do the magic i stated above.

so ... does ava-webpack also have the function i want ?

@thrandre
Copy link
Owner

thrandre commented Aug 9, 2016

No worries!

Firstly - You need to be aware that the inner workings of AVA and Karma are quite different. AVA runs your tests in Node while Karma require a browser (PhantomJS is often used for headless testing). Transpiling works pretty much the same in both cases, but keep in mind that webpack was initially created as a module bundler for the browser. Karma - being a more mature test runner - has better support for preprocessing than AVA currently has.

As for how ava-webpack work:

  • Tests matching the glob you provide will be added as entries for webpack.
  • Webpack transpiles your tests with the loaders provided in your config.
  • Transpiled tests are emitted to a folder named .ava-webpack.
  • The transpiled tests are fed to ava

Keep in mind that there is absolutely no sophistication behind this. This project is intended as a hackish solution to get AVA working with TypeScript (AllowSyntheticImports enabled). It is also worth mentioning that this project is temporary - waiting for AVA to implement planned support for webpack and browserify (avajs/ava#24).

If you are determined to run your tests in Node, but not necessarily with the use of AVA, you should consider Mocha and mocha-webpack (https://github.com/zinserjan/mocha-webpack) instead.

To answer your question: Yes, ava-webpack will perform the magic you describe, but maybe not in the way you want.

@LiTiang
Copy link
Author

LiTiang commented Aug 9, 2016

@thrandre
thanks a lot, i will try it
then i will let u know if i success or not
thanks again

@LiTiang
Copy link
Author

LiTiang commented Aug 23, 2016

Hi, @thrandre

i still fail to integrate ava-webpack with "angular2-webpack-starter",
may be such thing is too difficult for me ...
anyway, thanks u contribution.

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

No branches or pull requests

2 participants