Search in sources :

Example 1 with JsErrorMessage

use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.

the class JsErrorMessageTest method testUncaughtError.

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);
    assertNotNull(errorMessage);
    assertEquals(new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"), errorMessage.getFileWithError());
    assertEquals(301, errorMessage.getLineNumber());
    assertEquals(null, errorMessage.getColumnNumber());
    assertEquals("Uncaught Error", errorMessage.getErrorName());
}
Also used : JsErrorMessage(com.google.jstestdriver.idea.common.JsErrorMessage) File(java.io.File)

Example 2 with JsErrorMessage

use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.

the class JsErrorMessageTest method testReferenceErrorParsing.

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);
    assertNotNull(errorMessage);
    assertEquals(new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"), errorMessage.getFileWithError());
    assertEquals(2, errorMessage.getLineNumber());
    assertEquals(null, errorMessage.getColumnNumber());
    assertEquals("Uncaught ReferenceError", errorMessage.getErrorName());
}
Also used : JsErrorMessage(com.google.jstestdriver.idea.common.JsErrorMessage) File(java.io.File)

Example 3 with JsErrorMessage

use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.

the class BrowserErrorNode method newBrowserErrorNode.

@NotNull
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);
}
Also used : JsErrorMessage(com.google.jstestdriver.idea.common.JsErrorMessage) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with JsErrorMessage

use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.

the class JsErrorMessageTest method testOperaError.

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);
    assertNotNull(errorMessage);
    assertEquals(new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"), errorMessage.getFileWithError());
    assertEquals(1, errorMessage.getLineNumber());
    assertEquals(null, errorMessage.getColumnNumber());
    assertEquals("Uncaught ReferenceError", errorMessage.getErrorName());
}
Also used : JsErrorMessage(com.google.jstestdriver.idea.common.JsErrorMessage) File(java.io.File)

Example 5 with JsErrorMessage

use of com.google.jstestdriver.idea.common.JsErrorMessage in project intellij-plugins by JetBrains.

the class JsErrorMessageTest method testColumnNumber.

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);
    assertNotNull(errorMessage);
    assertEquals(new File(myBasePath, "assertFramework/jstd/structure/emptyTestCase.js"), errorMessage.getFileWithError());
    assertEquals(1, errorMessage.getLineNumber());
    assertEquals(new Integer(10), errorMessage.getColumnNumber());
    assertEquals("Uncaught ReferenceError", errorMessage.getErrorName());
}
Also used : JsErrorMessage(com.google.jstestdriver.idea.common.JsErrorMessage) File(java.io.File)

Aggregations

JsErrorMessage (com.google.jstestdriver.idea.common.JsErrorMessage)8 File (java.io.File)7 HyperlinkInfo (com.intellij.execution.filters.HyperlinkInfo)1 OpenFileHyperlinkInfo (com.intellij.execution.filters.OpenFileHyperlinkInfo)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1