oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.37k stars 2.78k forks source link

Some errors in my project XPLPC when test #5052

Open paulocoutinhox opened 1 year ago

paulocoutinhox commented 1 year ago

What version of Bun is running?

1.0.0

What platform is your computer?

macos m1

What steps can reproduce the bug?

requirements:

https://github.com/xplpc/xplpc/blob/main/docs/wasm.md

steps:

git clone https://github.com/xplpc/xplpc.git
cd xplpc
python3 xplpc.py wasm-build 
cd wasm/sample
bun install
bun test

What is the expected behavior?

Run without problems, like npm/node do: https://github.com/xplpc/xplpc/actions/runs/6033606514/job/16370552981#step:12:1

What do you see instead?

Errors:

bun test    
bun test v1.0.0 (822a00c4)

tests/unit/pages.spec.ts:
1302 | // same stub, so we're safe and do not need to pass these stubs
1303 | // for each mount operation
1304 | var stubs = new WeakMap();
1305 | function registerStub(_a) {
1306 |     var source = _a.source, stub = _a.stub;
1307 |     stubs.set(stub, source);
        ^
TypeError: WeakMap keys must be objects or non-registered symbols
      at registerStub (/Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/node_modules/@vue/test-utils/dist/vue-test-utils.esm-bundler.mjs:1307:4)
      at createInstance (/Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/node_modules/@vue/test-utils/dist/vue-test-utils.esm-bundler.mjs:8055:4)
      at mount (/Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/node_modules/@vue/test-utils/dist/vue-test-utils.esm-bundler.mjs:8289:13)
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/pages.spec.ts:12:24
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/pages.spec.ts:10:40
✗ MainPage > check if show loading message [1.27ms]

tests/unit/client.spec.ts:
✓ Client > check if is initialized [0.52ms]
✓ Client > battery level [0.23ms]
43 | 
44 |     test("battery level", () => {
45 |         const request = new XRequest("platform.battery.level", new XParam("suffix", "%"))
46 | 
47 |         XClient.call<string>(request).then((response: string | undefined) => {
48 |             expect(response).toBe("100%");
                ^
TestNotRunningError: expect() must be called in a test
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/client.spec.ts:48:12
✓ Client > battery level from string [0.04ms]
51 | 
52 |     test("battery level from string", () => {
53 |         const request = new XRequest("platform.battery.level", new XParam("suffix", "%"))
54 | 
55 |         XClient.call(request.data()).then((response: string) => {
56 |             expect(response).toBe("{\"r\":\"100%\"}");
                ^
TestNotRunningError: expect() must be called in a test
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/client.spec.ts:56:12
✓ Client > battery level from string with await [0.20ms]
✓ Client > get logged value [0.02ms]
69 |             new XParam("password", "123456"),
70 |             new XParam("remember", true),
71 |         );
72 | 
73 |         XClient.call<string>(request).then((response: string | undefined) => {
74 |             expect(response).toBe("LOGGED-WITH-REMEMBER");
                ^
TestNotRunningError: expect() must be called in a test
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/client.spec.ts:74:12
✓ Client > get logged value with await [0.49ms]
✓ Client > get reverse value [0.06ms]
88 | 
89 |     it("get reverse value", () => {
90 |         const request = new XRequest("sample.reverse");
91 | 
92 |         XClient.call<string>(request).then((response: string | undefined) => {
93 |             expect(response).toBe("response-is-ok");
                ^
TestNotRunningError: expect() must be called in a test
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/client.spec.ts:93:12
✓ Client > get reverse value with await [0.28ms]
✓ Client > transfer data view [0.11ms]
114 |         );
115 | 
116 |         XClient.call<string>(request).then((response: string | undefined) => {
117 |             const processedData = XDataView.createUint8ClampedArrayFromPtr(dataView.ptr, dataView.size);
118 | 
119 |             expect("OK").toBe(response);
                ^
TestNotRunningError: expect() must be called in a test
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/client.spec.ts:119:12
✓ Client > transfer data view with await [0.23ms]
✓ Client > receive data view [0.02ms]
160 | 
161 |         XClient.call<XDataView>(request).then((response: XDataView | undefined) => {
162 |             // check response
163 |             const dataView = response;
164 | 
165 |             expect(dataView).toBeDefined();
                ^
TestNotRunningError: expect() must be called in a test
      at /Users/paulo/Developer/workspaces/cpp/xplpc/wasm/sample/tests/unit/client.spec.ts:165:12
✓ Client > receive data view with await [0.41ms]

 12 pass
 1 fail
 27 expect() calls
Ran 13 tests across 2 files. [144.00ms]

Additional information

Source code of tests:

https://github.com/xplpc/xplpc/blob/main/wasm/sample/tests/unit/pages.spec.ts and https://github.com/xplpc/xplpc/blob/main/wasm/sample/tests/unit/client.spec.ts

coryzibell commented 1 year ago

This appears to be an upstream issue with the latest version of https://developer.apple.com/documentation/javascriptcore, as our company's web app is seeing this specific error now on Safari/iOS 17

benmartin88 commented 1 year ago

This appears to be an upstream issue with the latest version of https://developer.apple.com/documentation/javascriptcore, as our company's web app is seeing this specific error now on Safari/iOS 17

We are also experiencing this issue. Is there any update on the cause?

chubetho commented 7 months ago

This appears to be an upstream issue with the latest version of developer.apple.com/documentation/javascriptcore, as our company's web app is seeing this specific error now on Safari/iOS 17

We are also experiencing this issue. Is there any update on the cause?

Me too. Any updates?

Vagner-Filho commented 6 months ago

same here with:

bun 1.0.33 and vue test utils 2.4.4

in my case the tests in the file dont even run as it stops on on stubs.set(stub, source); when calling either mount or shallowMount