Examples of JsErrorMessage


Examples of com.google.jstestdriver.idea.util.JsErrorMessage

    myBasePath = JstdTestRoot.getTestDataDir();
  }

  public void testReferenceErrorParsing() throws Exception {
    String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:2: Uncaught ReferenceError: gg is not defined";
    JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
    Assert.assertNotNull(errorMessage);
    Assert.assertEquals(errorMessage.getFileWithError(), new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"));
    Assert.assertEquals(errorMessage.getLineNumber(), 2);
    Assert.assertEquals(errorMessage.getColumnNumber(), null);
    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught ReferenceError");
  }
View Full Code Here

Examples of com.google.jstestdriver.idea.util.JsErrorMessage

    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught ReferenceError");
  }

  public void testStrangeErrorName() throws Exception {
    String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:1: Uncaught #<Object>";
    JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
    Assert.assertNotNull(errorMessage);
    Assert.assertEquals(errorMessage.getFileWithError(), new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"));
    Assert.assertEquals(errorMessage.getLineNumber(), 1);
    Assert.assertEquals(errorMessage.getColumnNumber(), null);
    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught Error");
  }
View Full Code Here

Examples of com.google.jstestdriver.idea.util.JsErrorMessage

    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught Error");
  }

  public void testColumnNumber() throws Exception {
    String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:1:10: Uncaught ReferenceError";
    JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
    Assert.assertNotNull(errorMessage);
    Assert.assertEquals(errorMessage.getFileWithError(), new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"));
    Assert.assertEquals(errorMessage.getLineNumber(), 1);
    Assert.assertEquals(errorMessage.getColumnNumber(), new Integer(10));
    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught ReferenceError");
  }
View Full Code Here

Examples of com.google.jstestdriver.idea.util.JsErrorMessage

    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught ReferenceError");
  }

  public void testOperaError() throws Exception {
    String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:1: Uncaught exception: ReferenceError: Undefined variable: gg";
    JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
    Assert.assertNotNull(errorMessage);
    Assert.assertEquals(errorMessage.getFileWithError(), new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"));
    Assert.assertEquals(errorMessage.getLineNumber(), 1);
    Assert.assertEquals(errorMessage.getColumnNumber(), null);
    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught ReferenceError");
  }
View Full Code Here

Examples of com.google.jstestdriver.idea.util.JsErrorMessage

    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught ReferenceError");
  }

  public void testName() throws Exception {
    String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:1: ReferenceError: s is not defined";
    JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
    Assert.assertNotNull(errorMessage);
    Assert.assertEquals(errorMessage.getFileWithError(), new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"));
    Assert.assertEquals(errorMessage.getLineNumber(), 1);
    Assert.assertEquals(errorMessage.getColumnNumber(), null);
    Assert.assertEquals(errorMessage.getErrorName(), "ReferenceError");
  }
View Full Code Here

Examples of com.google.jstestdriver.idea.util.JsErrorMessage

    Assert.assertEquals(errorMessage.getErrorName(), "ReferenceError");
  }

  public void testUncaughtError() throws Exception {
    String text = "error loading file: /test/assertFramework/jstd/structure/emptyTestCase.js:301: Uncaught Error: xhrFailed";
    JsErrorMessage errorMessage = JsErrorMessage.parseFromText(text, myBasePath);
    Assert.assertNotNull(errorMessage);
    Assert.assertEquals(errorMessage.getFileWithError(), new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"));
    Assert.assertEquals(errorMessage.getLineNumber(), 301);
    Assert.assertEquals(errorMessage.getColumnNumber(), null);
    Assert.assertEquals(errorMessage.getErrorName(), "Uncaught Error");
  }
View Full Code Here

Examples of com.google.jstestdriver.idea.util.JsErrorMessage

  }

  @Nullable
  @Override
  public Result applyFilter(String line, int entireLength) {
    JsErrorMessage message;
    try {
      message = JsErrorMessage.parseFromText(line, myBasePath);
    } catch (Exception e) {
      LOG.error("Can't parse error message from '" + line + "'", e);
      return null;
    }
    if (message == null) {
      return null;
    }
    VirtualFile virtualFile = VfsUtil.findFileByIoFile(message.getFileWithError(), false);
    if (virtualFile == null || !virtualFile.isValid()) {
      return null;
    }
    int column = ObjectUtils.notNull(message.getColumnNumber(), 0);
    HyperlinkInfo hyperlinkInfo = new OpenFileHyperlinkInfo(myProject,
                                                            virtualFile,
                                                            message.getLineNumber() - 1,
                                                            column);
    return new Filter.Result(message.getHyperlinkStartInclusiveInd(), message.getHyperlinkEndExclusiveInd(), hyperlinkInfo);
  }
View Full Code Here

Examples of com.google.jstestdriver.idea.util.JsErrorMessage

  public static BrowserErrorNode newBrowserErrorNode(@NotNull BrowserNode parent,
                                                     @Nullable String pathToJsFileWithError,
                                                     @Nullable String errorMessage) {
    ConfigNode configNode = parent.getParent();
    String basePath = configNode.getAbsoluteBasePath();
    final JsErrorMessage parsedErrorMessage;
    if (basePath != null && errorMessage != null) {
      parsedErrorMessage = JsErrorMessage.parseFromText(errorMessage, new File(basePath));
    } else {
      parsedErrorMessage = null;
    }
    JsErrorMessage result = null;
    if (pathToJsFileWithError == null) {
      result = parsedErrorMessage;
    } else {
      File file = new File(pathToJsFileWithError);
      if (file.isAbsolute() && file.isFile()) {
        if (parsedErrorMessage != null && parsedErrorMessage.getFileWithError().equals(file)) {
          result = parsedErrorMessage;
        } else {
          result = new JsErrorMessage(file, 1, null, false, null, -1, -1);
        }
      }
    }
    return new BrowserErrorNode(parent, result);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.