-
Notifications
You must be signed in to change notification settings - Fork 64
Configuring IDEA WebStorm
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.
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.)
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.