'use babel';

/* @flow */
import type { TextEditor } from 'atom';
import * as jestRunner from './spawn-runner';

export function activate() {
  require('atom-package-deps').install();
}

export function deactivate() {
  // Fill something here, optional
}

export function provideTester() {
  return {
    name: 'tester-jest',
    options: {},
    scopes: atom.config.get('tester-jest.scopes'),
    test(textEditor :TextEditor) {
      if (!textEditor) {
        return Promise.resolve({ messages: [], output: '' });
      }
      const text = textEditor.getText();
      if (text.length === 0) {
        return Promise.resolve({ messages: [], output: '' });
      }
      // Note, a Promise may be returned as well!
      return jestRunner.run(textEditor);
    },
    stop() {
      jestRunner.stop();
    },
  };
}

@@ -426,245 +426,8 @@
 ) %7B%0A
-      if (!textEditor) %7B%0A        return Promise.resolve(%7B messages: %5B%5D, output: '' %7D);%0A      %7D%0A      const text = textEditor.getText();%0A      if (text.length === 0) %7B%0A        return Promise.resolve(%7B messages: %5B%5D, output: '' %7D);%0A      %7D%0A
     

allow empty param in run method