Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG]: plotly.js DevTools crashes if malformed JSON file exists in mocks folder #7637

@camdecoster

Description

@camdecoster

Description

Running npm start starts up plotly.js DevTools. If a malformed JSON exists in the mocks folder (test/image/mocks), this process will crash and the dev server won't start. The script should be updated to handle this situation.

Steps to reproduce

  • Add an empty JSON file to the mocks folder:
    touch test/image/mocks/empty_file.json
  • Run npm start
  • Note that the process crashes
    $ npm start
    
    > [email protected] start
    > node devtools/test_dashboard/server.mjs
    
    undefined:1
    
    
    SyntaxError: Unexpected end of JSON input
        at JSON.parse (<anonymous>)
        at file:///home/cam/Development/plotly/plotly.js/devtools/dashboard_utilities.mjs:43:31
        at Array.map (<anonymous>)
        at createMocksList (file:///home/cam/Development/plotly/plotly.js/devtools/dashboard_utilities.mjs:42:33)
        at async file:///home/cam/Development/plotly/plotly.js/devtools/test_dashboard/server.mjs:19:1
    
    Node.js v18.20.8

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions