Browser recipe doesn't work with default AVA install
See original GitHub issue@sindresorhus You asked me (https://github.com/avajs/ava/pull/1054#discussion_r81580347) to change from require to import in the browser recipe. Foolishly I didn’t check after I changed it but it doesn’t actually work on a default install because modules that are required by AVA aren’t transpiled.
To fix it we would need to also require the babel bits:
npm install --save-dev babel-register babel-plugin-transform-es2015-modules-commonjs
and require the following settings in package.json:
"ava": {
"require": [
"babel-register",
"./test/helpers/setup-browser-env.js"
]
},
"babel": {
"plugins": ["transform-es2015-modules-commonjs"]
},
Which seems like quite a lot for one little helper.
Do you want me to update the recipe with these requirements?
Or should I revert
import browserEnv from 'browser-env';
browserEnv();
to
require('browser-env')()
so they aren’t necessary?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How do I enable Java in my web browser?
Java is not enabled in the web browser. If Java is already installed but applets do not work, you need to enable Java...
Read more >Troubleshooting tips for running Java
Download and Install Java · Try the offline installer package (Windows only) · Uninstall any non-working Java installations · Temporarily turn off firewall...
Read more >Java is not working in Internet Explorer after I just installed Java
Workaround · Open IE browser · Click on Tools tab. Note: If the Tools tab is not visible in Tools bar, right click...
Read more >How do I enable Java through the Control Panel?
In the Java Control Panel, click the Security tab. · Select the option Enable Java content in the browser. · Click Apply and...
Read more >How to activate Java in the browser
It is recommended you update Java before allowing the app to run. Click Update and download the latest Java version. If you don't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Right. It will work in the next release though, as AVA now transpiles helper files too. So I think we can just keep this issue open until the next release and not do anything.
@sindresorhus this example still doesn’t work as it throws an error about importing.
test/helpers/setup-browser-env.js
test/index.js