gdsestimating / dxf-parser

A javascript parser for DXF files. It reads DXF file strings into one large javascript object with more readable properties and a more logical structure.
MIT License
462 stars 143 forks source link

`TypeError: Cannot call a class as a function` in tests #79

Closed gpbmike closed 2 years ago

gpbmike commented 2 years ago

After pulling down the repo, building, and running tests, I get the following errors.

  Scanner
    .hasNext()
      ✓ should return false when the array is empty
      ✓ should return false when the array has length 1
      ✓ should return true when the array has length 2
      ✓ should return false when the array has length 4 and pointer is on the last element
      ✓ should return true when the array has length 4 and pointer is on the second-to-last element
    .next()
      ✓ should throw an error when the array is empty
      ✓ should throw an error when the array has only 1 element
      ✓ should throw an error when next is called and eof has already been read
      ✓ should return the 1st and 2nd index as the code and value respectively
      ✓ should set _eof to true when EOF code-value pair is read
      ✓ should increment the pointer by 2
    .isEOF()
      ✓ should be true when _eof is true

  Parser
    ✓ should parse the dxf header variables into an object
    ✓ should parse the tables section without error
    ✓ should parse the dxf layers
    ✓ should parse the dxf ltype table
    ✓ should parse the dxf viewPort table
    1) should parse a complex BLOCKS section
    ✓ should parse a simple BLOCKS section
    2) should parse POLYLINES
    ✓ should parse ELLIPSE entities
    ✓ should parse SPLINE entities
    ✓ should parse EXTENDED DATA
    3) should parse SPLINE entities that are like arcs and circles
    4) should parse ARC entities (1)
    5) should parse MTEXT entities

  21 passing (97ms)
  5 failing

  1) Parser
       should parse a complex BLOCKS section:
     TypeError: Cannot call a class as a function
      at _classCallCheck (dist/DxfParser.js:48:99)
      at DxfParser (dist/DxfParser.js:46:19)
      at verifyDxf (test/DxfParser.test.js:184:12)
      at Context.<anonymous> (test/DxfParser.test.js:88:3)
      at processImmediate (internal/timers.js:464:21)

  2) Parser
       should parse POLYLINES:
     TypeError: Cannot call a class as a function
      at _classCallCheck (dist/DxfParser.js:48:99)
      at DxfParser (dist/DxfParser.js:46:19)
      at verifyDxf (test/DxfParser.test.js:184:12)
      at Context.<anonymous> (test/DxfParser.test.js:110:3)
      at processImmediate (internal/timers.js:464:21)

  3) Parser
       should parse SPLINE entities that are like arcs and circles:
     TypeError: Cannot call a class as a function
      at _classCallCheck (dist/DxfParser.js:48:99)
      at DxfParser (dist/DxfParser.js:46:19)
      at verifyDxf (test/DxfParser.test.js:184:12)
      at Context.<anonymous> (test/DxfParser.test.js:166:3)
      at processImmediate (internal/timers.js:464:21)

  4) Parser
       should parse ARC entities (1):
     TypeError: Cannot call a class as a function
      at _classCallCheck (dist/DxfParser.js:48:99)
      at DxfParser (dist/DxfParser.js:46:19)
      at verifyDxf (test/DxfParser.test.js:184:12)
      at Context.<anonymous> (test/DxfParser.test.js:170:3)
      at processImmediate (internal/timers.js:464:21)

  5) Parser
       should parse MTEXT entities:
     TypeError: Cannot call a class as a function
      at _classCallCheck (dist/DxfParser.js:48:99)
      at DxfParser (dist/DxfParser.js:46:19)
      at verifyDxf (test/DxfParser.test.js:184:12)
      at Context.<anonymous> (test/DxfParser.test.js:174:3)
      at processImmediate (internal/timers.js:464:21)

npm ERR! Test failed.  See above for more details.

Seems related to https://github.com/gdsestimating/dxf-parser/issues/78.

I think the following change needs to be reverted: https://github.com/gdsestimating/dxf-parser/commit/8762566dcc0a59a6ae5e9709d9a35f548a973b95#diff-9bb7bb43870d7fb6b2a037138c18ce7df3c9030dc207e6c16e9ea2ab16f364fd