Last active
April 5, 2018 13:10
-
-
Save joakimk/5e5fb68bb33ac93f378440ea91ae5b22 to your computer and use it in GitHub Desktop.
Running tests in tmux from Atom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Atom -> Init Script... | |
child = require "child_process" | |
runTestInTmux = (focus) -> | |
editor = atom.workspace.getActiveTextEditor() | |
editor.save() | |
fullPath = editor.getPath() | |
projectPath = atom.project.getDirectories()[0].getPath() + "/" | |
relativePath = fullPath.split(projectPath)[1] | |
if focus | |
line = editor.getLastCursor().getBufferPosition().row | |
relativePath = relativePath + ":" + line | |
child.spawnSync("tmux", ["send-keys", "-l", "script/test " + relativePath + "\n"]) | |
atom.commands.add "atom-text-editor", "custom:save-and-run-test-at-current-line", -> | |
runTestInTmux(true) | |
atom.commands.add "atom-text-editor", "custom:save-and-run-test", -> | |
runTestInTmux(false) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Atom -> Keymap... | |
'atom-text-editor.vim-mode-plus:not(.insert-mode)': | |
'm': 'custom:save-and-run-test-at-current-line' | |
'M': 'custom:save-and-run-test' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment