Javascript syntax errors show no context

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Critical - P2
    • None
    • Affects Version/s: 3.1.8
    • Component/s: JavaScript
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Taking the following test file "test.js":

      var barf = syntax error;
      

      With Spidermonkey:

      /data/1/mongo: ./mongo --nodb jstests/replsets/test.js 
      MongoDB shell version: 3.1.9-pre-
      2015-09-23T09:23:14.379-0400 E QUERY    [thread1] SyntaxError: missing ; before statement :
      
      failed to load: jstests/replsets/test.js
      

      With V8 in 3.0:

      /data/m/30/mongo: ./mongo --nodb /data/1/mongo/jstests/replsets/test.js 
      MongoDB shell version: 3.0.4-pre-
      2015-09-23T09:23:33.112-0400 E QUERY    SyntaxError: Unexpected identifier at /data/1/mongo/jstests/replsets/test.js:2
      failed to load: /data/1/mongo/jstests/replsets/test.js
      

      This makes it really hard to edit large js test files, for obvious reasons.

            Assignee:
            Mira Carey
            Reporter:
            Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: