Code Monkey home page Code Monkey logo

Comments (6)

archfz avatar archfz commented on May 31, 2024

Are you sure this is not coming from your app or custom cypress code ? This plugin does not use any .split on anything. I would need more details on this. Maybe the error object format would be a starting point. Don't forget the it might seem that the error is coming from this plugin as it will show up in the stack since we are intercepting (overriding) the original console.error function in the browser.

from cypress-terminal-report.

JFRabbit avatar JFRabbit commented on May 31, 2024

This message should be a catched error from app, maybe like this code:

var a = 1;
try {
  a.split(",");
} catch (e) {
  // cypress-terminal-report print error line in terminal, but show "cons:error ✘  {}"
  // in browser console, I can get "TypeError: a.split is not a function
  console.error(e); 
}
a.split(","); // make cypress run failed when "uncaught:exception" return true

截屏2020-08-19 下午3 11 26

截屏2020-08-19 下午3 12 12

from cypress-terminal-report.

JFRabbit avatar JFRabbit commented on May 31, 2024

looks like console.error(error) will print {}, use string is ok.

from cypress-terminal-report.

archfz avatar archfz commented on May 31, 2024

I tried to reproduce the issue you have with the same code but I couldnt. The issue is that for some reason on your code the error that is thrown is not instance of window.Error. Another possibility is that the error doesnt have the stack property but I doubt that. I have an idea for a possible fix, I will release next week in a patch so we can try if it resolves it for you.

In the meantime:

  • what browser do you use?
  • do you have any polyfills that might change the error object?
  • can you check in the catch whether error instanceof window.Error ?

from cypress-terminal-report.

JFRabbit avatar JFRabbit commented on May 31, 2024
  • what browser do you use?

Browser: Electron 80

  • can you check in the catch whether error instanceof window.Error ?

Yes

You create a react app to reproduce this issue:

import React, { Component } from "react";
import { Button } from "antd";
import "antd/dist/antd.css";

class App extends Component {
  makeTypeError = () => {
    var a = 1;
    try {
      a.split(",");
    } catch (e) {
      console.error(e);
      console.info(e instanceof window.Error);
    }
    a.split(",");
  };

  render() {
    return (
      <div>
        <Button id="error" onClick={this.makeTypeError}>
          Make Type Error
        </Button>
      </div>
    );
  }
}

export default App;

test code:

describe("foobar", () => {
  it("foobar", () => {
    cy.visit("http://localhost:3000/");

    cy.get("#error").click();
  });
});

Terminal:

      cy:command ✔  visit       http://localhost:3000/
      cy:command ✔  get #error
      cy:command ✘  click
          cy:xhr ⓘ  GET http://localhost:3000/sockjs-node/info?t=1598261034294
      cons:error ✘  {}

from cypress-terminal-report.

archfz avatar archfz commented on May 31, 2024

Released in 2.0.0.

from cypress-terminal-report.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.