Skip to content
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

Tests failing on second attempt of running them #37

Open
jake-beardo opened this issue Mar 15, 2024 · 1 comment
Open

Tests failing on second attempt of running them #37

jake-beardo opened this issue Mar 15, 2024 · 1 comment

Comments

@jake-beardo
Copy link

I managed to run 1 test sucessfully using bun test but since then pocketjs is failing

bun test                                                                                                                                          08:42:18 PM
bun test v1.0.30 (1424a196)

src/orderbook/test/integration/main.test.ts:
✓ OrderBook > should start at [8.09ms]

 1 pass
 0 fail
Ran 1 tests across 1 files. [2.84s]
add-pocket-ic = > bun test                                                                                                                                          08:42:23 PM
bun test v1.0.30 (1424a196)

src/orderbook/test/integration/main.test.ts:
thread 'tokio-runtime-worker' panicked at library/std/src/io/stdio.rs:1021:9:
failed printing to stdout: Broken pipe (os error 32)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at rs/pocket_ic_server/src/state_api/state.rs:495:45:
join failed!: JoinError::Panic(Id(25), ...)
ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
 path: "http://127.0.0.1:56209/instances/1/update/execute_ingress_message"
✗ OrderBook > should start at [46.10ms]
✗ OrderBook > should start at

 0 pass
 2 fail
Ran 2 tests across 1 files. [120.00ms]

this is my test file

import { resolve } from 'node:path';
import { Principal } from '@dfinity/principal';
import {  PocketIc } from '@hadronous/pic';
import type { Actor } from '@hadronous/pic';
import { IDL } from '@dfinity/candid';
import { idlFactory, init } from '../../../declarations/orderbook/orderbook.did.js';
import type { _SERVICE } from '../../../declarations/orderbook/orderbook.did';

const WASM_PATH = resolve(
  __dirname,
  '..',
  '..',
  '..',
  '..',
  '.dfx',
  'local',
  'canisters',
  'orderbook',
  'orderbook.wasm',
);

describe('OrderBook', () => {
  let pic: PocketIc;
  let actor: Actor<_SERVICE>;
  let canisterId: Principal;

  beforeEach(async () => {
    pic = await PocketIc.create();
    const fixture = await pic.setupCanister<_SERVICE>({
      idlFactory,
      wasm: WASM_PATH,
      arg: IDL.encode(init({ IDL }), [Principal.fromText('aaaaa-aa')]),
    });
    actor = fixture.actor;
    canisterId = fixture.canisterId;
  });

  afterEach(async () => {
    await pic.tearDown();
  });

  it(`should start at`, async () => {
    const result = await actor.getEventDetails();
  });
});
@jake-beardo jake-beardo changed the title Tests failing Tests failing on second attempt of running them Mar 15, 2024
@nathanosdev
Copy link
Contributor

I've been having some issues with bun test since v1.0.27 and I opened a ticket for that: oven-sh/bun#8958. So far there's been no luck with that and I'm now considering dropping Bun from the repo and the docs until they stabilize it better.

Could you try rolling back to v1.0.26 to see if it helps?

curl -fsSL https://bun.sh/install | bash -s "bun-v1.0.26"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants