Just tried to use this package, but ran into a problem.
I tried
const Swift = require("swift-mock");
const swift = new Swift();
But it fails with something like
SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at new Swift (/whatever/node_modules/swift-mock/lib/swift.js:19:33)
I had a look in the code. At
|
this.fieldPatterns = JSON.parse(patterns); |
JSON.parse is done on patterns. But patterns already is an object and it fails.
Same thing at
|
this.fieldPatterns = fieldPatterns ? JSON.parse(fieldPatterns) : patterns; |
After I changed that I could parse my Swift file. I am sitting on
npx node --version
v10.15.1
Just tried to use this package, but ran into a problem.
I tried
But it fails with something like
I had a look in the code. At
swift-mock/lib/swift.js
Line 19 in 9cc7326
JSON.parse is done on patterns. But patterns already is an object and it fails.
Same thing at
swift-mock/lib/swiftParser.js
Line 9 in 9cc7326
After I changed that I could parse my Swift file. I am sitting on