Skip to content
This repository was archived by the owner on Mar 21, 2018. It is now read-only.

Configuring IDEA WebStorm

Nick Alexander edited this page Apr 28, 2016 · 2 revisions

Run configuration

This is the equivalent of npm run dev. Select Run > Edit Configurations, tap +, then choose npm. Set command to run-script and scripts to dev.

Single-file test configuration

This is the equivalent of npm test path/to/test-file. Navigate to your test file in WebStorm. Right click the test file's title in the tab bar at the top. After Run ... and Debug ..., you should see a Create test-file... with a brown Mocha "M" icon. Choose that. Everything should be configured automatically, but set Extra Mocha options to --compilers js:babel-register. (By default, Mocha inside WebStorm ignores test/mocha.opts; this enables Babel in test files.)

Add a File Watcher to re-Babel app sources

It's nice to run tests in the IDE, but frustrating to modify the app source and re-run tests, since you need to remember to manually run the build process. We can do better.

In the settings, select Tools > File Watchers, tap +, then choose Babel. Set Program to be Node.js (for me, that is /usr/local/bin/node), set Arguments to build/main.js --build $FilePathRelativeToProjectRoot$, set Working directory to $ProjectFileDir$, and set Output paths to refresh to $ProjectFileDir$/lib. Test by editing a file in app/, saving, and then verifying that the corresponding file in lib/ is automatically re-generated.

Clone this wiki locally