sinonjs/sinon

Sinon fails in comparing call order when running tests in parallel

クローズ

#2,472 opened on 2022/09/17

 (11 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (764 件のフォーク)batch import
BugDifficulty: EasyHelp wantedImprovementgood first issue

Repository metrics

Stars
 (9,548 個のスター)
PR merge metrics
 (平均マージ 6d 16h) (30d で 15 merged PRs)

説明

Describe the bug

spy1.calledImmediatelyBefore(spy2) fails when used in a node-tap test suite that is being executed in parallel. In serial mode it works without issue. calledBefore continues to work as normal.

I've even tried using sandboxes for each test but it did not fix the issue.

To Reproduce

Repo: https://github.com/Ethan-Arrowood/sinon-spy-parallel-bug-reproduction

git clone https://github.com/Ethan-Arrowood/sinon-spy-parallel-bug-reproduction
cd sinon-spy-parallel-bug-reproduction
pnpm install
pnpm run test

To see tests passing comment out line 27 in test/index.ts:

+ // tap.jobs = 2;
- tap.jobs = 2;

Expected behavior

I'd expect my spy assertions to pass in both serial and parallel mode

Context (please complete the following information):

  • Library version: 14.0.0
  • Environment: Node.js 18
  • Example URL:
  • Other libraries you are using: node-tap, typescript

コントリビューターガイド