-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extern functions behave differently in Wing simulator #4131
Comments
Another example of an extern function that runs fine in Node.js, but throws an error in Wing: exports.dostuff = function() {
const assert = require("assert");
const string = "{\"key1\":1,\"key2\":2}";
const obj = ({"key1": 1,"key2": 2});
assert.deepStrictEqual(JSON.parse(string), obj);
} Due to this bug, we see different equality behavior between preflight and inflight: let s = "{\"key1\":1,\"key2\":2}";
let obj = Json { "key1": 1, "key2": 2 };
assert(Json.parse(s) == obj); // OK
test "deepCopy()" {
let s = "{\"key1\":1,\"key2\":2}";
let obj = Json { "key1": 1, "key2": 2 };
assert(Json.parse(s) == obj); // error
} |
Maybe adding wing/libs/wingcompiler/src/compile.ts Line 245 in a572271
|
Changed priority p3 -> p1 |
In the Json equality example above, Wing is swallowing the error message (it just reports let code = `
const j = { key1: 1, key2: 2 };
const k = "{\\"key1\\":1,\\"key2\\":2}";
require('assert').deepStrictEqual(j, JSON.parse(k));
console.log("done");
`
eval(code);
let vm = require("vm").runInNewContext(code, {
require,
console,
JSON,
});
console.log(vm); When
|
Related to #4118 |
Hi, This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
Keep. |
Congrats! 🚀 This was released in Wing 0.59.43. |
I tried this:
I made a Wing project with these two files, and ran
wing test
:This happened:
This is printed by the test:
I expected this:
I expected the output to match the output when I run
superjson
in a Node REPL:Notice that the "meta" value contains an annotation saying that args.0 needs to be parsed as "undefined" instead of null. This annotation is not added when running in Wing simulator.
Is there a workaround?
No response
Component
SDK
Wing Version
0.29.11
Node.js Version
18.14.1
Platform(s)
MacOS
Anything else?
No response
Community Notes
The text was updated successfully, but these errors were encountered: