jacobmendoza / rspec-tree-runner

RSpec runner and files analyzer for Atom editor
https://atom.io/packages/rspec-tree-runner
MIT License
9 stars 2 forks source link

Uncaught SyntaxError: Unexpected token s #17

Closed liam-ngy closed 8 years ago

liam-ngy commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.5.3 System: Mac OS X 10.11.4 Thrown From: rspec-tree-runner package, v0.2.0

Stack Trace

Uncaught SyntaxError: Unexpected token s

At file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.html#%7B%22locationsToOpen%22%3A%5B%7B%22pathToOpen%22%3A%22%2FUsers%2Fhoang-duc.nguyen%2FProjects%2FXing%2Ffeedy%22%2C%22initialLine%22%3Anull%2C%22initialColumn%22%3Anull%7D%5D%2C%22windowInitializationScript%22%3A%22%2FApplications%2FAtom.app%2FContents%2FResources%2Fapp.asar%2Fsrc%2Finitialize-application-window.js%22%2C%22resourcePath%22%3A%22%2FApplications%2FAtom.app%2FContents%2FResources%2Fapp.asar%22%2C%22devMode%22%3Afalse%2C%22safeMode%22%3Afalse%2C%22profileStartup%22%3Afalse%2C%22appVersion%22%3A%221.5.3%22%2C%22atomHome%22%3A%22%2FUsers%2Fhoang-duc.nguyen%2F.atom%22%2C%22initialPaths%22%3A%5B%22%2FUsers%2Fhoang-duc.nguyen%2FProjects%2FXing%2Ffeedy%22%5D%7D:1

SyntaxError: Unexpected token s
    at Object.parse (native)
    at RSpecLauncherCommand.module.exports.RSpecLauncherCommand.parseRSpecResult (/Users/hoang-duc.nguyen/.atom/packages/rspec-tree-runner/lib/rspec-launcher-command.coffee:32:23)
    at /Users/hoang-duc.nguyen/.atom/packages/rspec-tree-runner/lib/rspec-launcher-command.coffee:22:54
    at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
    at TerminalCommandRunner.module.exports.TerminalCommandRunner.onClose (/Users/hoang-duc.nguyen/.atom/packages/rspec-tree-runner/lib/terminal-command-runner.coffee:47:14)
    at ChildProcess.<anonymous> (/Users/hoang-duc.nguyen/.atom/packages/rspec-tree-runner/lib/terminal-command-runner.coffee:1:1)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:817:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

Commands

     -1:40.8.0 vim-mode-plus:move-up (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
  2x -1:40.3.0 vim-mode-plus:move-down (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -1:37.6.0 ruby-test:test-file (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -1:36 vim-mode-plus:move-up (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -1:21.2.0 ruby-test:test-all (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:48.3.0 key-binding-resolver:toggle (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
  4x -0:45.5.0 ruby-test:toggle (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:36.4.0 vim-mode-plus:reset-normal-mode (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:35.2.0 vim-mode-plus:decrease (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:33.9.0 git-diff-details:copy (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:33.2.0 vim-mode-plus:reset-normal-mode (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
 38x -0:31.8.0 vim-mode-plus:move-up (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:30.2.0 vim-mode-plus:move-down (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:28.9.0 rspec-tree-runner:toggle (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)
     -0:26.4.0 rspec-tree-runner:run-single-test (atom-text-editor.editor.is-focused.vim-mode-plus.normal-mode)

Config

{
  "core": {
    "disabledPackages": [
      "markdown-preview",
      "metrics",
      "jquery-snippets",
      "linter-eslint",
      "html2haml",
      "jshint",
      "autocomplete",
      "react",
      "background-tips",
      "welcome",
      "color-picker",
      "tree-view-git-status",
      "execute-as-ruby",
      "rspec"
    ],
    "packagesWithKeymapsDisabled": [
      "atom-beautify",
      "atom-terminal",
      "easy-motion-redux",
      "emmet",
      "git-projects",
      "preview-plus",
      "atom-material-ui",
      "ruby-block",
      "terminal-status",
      "recent-files-fuzzy-finder",
      "auto-indent",
      "split-diff",
      "rails-latest-migration",
      "rails-partials",
      "valign",
      "execute-as-ruby",
      "color-picker",
      "tree-view-filter",
      "keybinding-cheatsheet",
      "terminal-plus",
      "git-blame",
      "rspec-tree-runner",
      "rspec"
    ],
    "projectHome": "/Users/hoang-duc.nguyen/Projects",
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ]
  },
  "rspec-tree-runner": {}
}

Installed Packages

# User
aligner, v0.19.0
aligner-ruby, v1.4.0
aligner-scss, v1.1.0
atom-material-syntax, v0.3.3
atom-material-ui, v0.8.1
atom-ternjs, v0.13.2
autocomplete-paths, v1.0.2
clipboard-plus, v0.5.1
custom-title, v1.0.1
docblockr, v0.7.3
emmet, v2.4.1
file-icons, v1.6.14
git-diff-details, v0.21.0
highlight-selected, v0.11.2
language-babel, v2.15.4
language-gitignore, v0.2.0
language-haml, v0.23.15
language-rspec, v0.5.0
linter, v1.11.3
linter-js-yaml, v1.2.5
linter-rubocop, v0.4.7
linter-scss-lint, v2.5.1
markdown-preview-plus, v2.2.2
minimap, v4.19.0
minimap-find-and-replace, v4.4.0
minimap-git-diff, v4.1.8
minimap-highlight-selected, v4.3.1
minimap-selection, v4.3.1
minimap-split-diff, v0.3.0
nerd-treeview, v0.3.1
pigments, v0.24.0
project-manager, v2.7.6
rails-model-schema, v0.7.3
recent-files-fuzzy-finder, v0.2.4
relative-numbers, v0.4.1
remember-file-positions, v0.2.1
rspec-tree-runner, v0.2.0
ruby-block, v0.3.5
ruby-block-converter, v3.5.0
ruby-test, v0.9.17
symbol-gen, v1.0.0
terminal-plus, v0.14.5
vim-mode-plus, v0.20.0
vim-mode-plus-subword-movement, v0.2.2
wordcount, v2.6.0
zentabs, v0.8.7

# Dev
No dev packages
jacobmendoza commented 8 years ago

Hey @hnguyen94,

Thanks for reporting!.

This error has been usually happening when something not expected is being returned in the output for the RSpec test runner, which should be in json. One of the cases that we have seen, is using simplecov, that also returns the output when the formatter is json making the output invalid.

If you have time and it's possible, I would love to see the output of rspec, to see if there is anything strange that is causing this behaviour. Should be similar to:

Open a terminal cd project_directoy rspec --format=json spec/file_that_failed_spec.rb

That way, I could inspect the output and see if there is something strange there. Anyway, I'm really expecting to release very soon a new version with a sanitization of the RSpec output.

Thank you!

jacobmendoza commented 8 years ago

Hey @hnguyen94,

I have released an update for the package that is supposed to fix this issue. Please, give it a go whenever you have time and let me know how it goes. I close this issue, but do not hesitate to reopen if it is still failing.

Thanks for reporting again!.