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

Add babel-plugin-webpack-loaders #3

Closed
wants to merge 1 commit into from
Closed

Add babel-plugin-webpack-loaders #3

wants to merge 1 commit into from

Conversation

istarkov
Copy link

babel-plugin-webpack-loaders allows you to run code with non js imports, without webpack preprocessing step or require mocks.
Compatible with AVA https://github.com/istarkov/babel-plugin-webpack-loaders#dynamic-config-path

Allows you to run code with non js imports, without webpack preprocessing step or require mocks.
@sindresorhus
Copy link
Member

Can you add a short description on how it's relevant to AVA?

@istarkov
Copy link
Author

A lot of developers use webpack as a bundler.
A lot of them use webpack loaders feature,
this feature allows you to preprocess different types of files like css, sass, txt etc.

The problem with test tools like mocha, ava, etc... that you can't test js files with code like

import myCssModuleClasses from 'myStyle.css';
...
<Blabla className={myCssModuleClasses.blabla} />

js can't imports css, and will fail if you try to test code above.

To run test on such file, you need to preprocess it with webpack or to use require mocks.
Both variant is not good.

babel-plugin-webpack-loaders allows you to use webpack loaders without webpack preprocessing step.

With this plugin, example above can be tested as usual.

So this plugin is not directly relevant to ava,
but allows to test without pain a big part of modern js components with ava, mocha and others.

One of the issue when I released this plugin,
that it doesn't work with ava istarkov/babel-plugin-webpack-loaders#41

Now it supports ava.

@istarkov
Copy link
Author

@danielkcz
Copy link

What about including that plugin internally same way as power-assert and similar? This would most probably require to be enabled in configuration as not everyone would want it. However in my opinion it's good way to go at least until full webpack support is finished.

@sindresorhus
Copy link
Member

Sorry, totally forgot about this PR.

@@ -42,6 +42,7 @@
## Miscellaneous

- [Stickers](https://www.stickermule.com/user/1070705604/stickers)
- [babel-plugin-webpack-loaders](https://github.com/istarkov/babel-plugin-webpack-loaders)
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a succinct description?

@sindresorhus
Copy link
Member

ping @istarkov

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.

None yet

3 participants