oven-sh / bun

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

Inconsistent `bun test` Result / Succes Locally (Linux), Error in GitHub Action (Linux) #9764

Open ImBIOS opened 5 months ago

ImBIOS commented 5 months ago

What version of Bun is running?

1.0.36+40f61ebb9

What platform is your computer?

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

  1. Fork i18n-num-in-words repository into your GitHub profile, so you can simulate the error in GitHub Action.
  2. Clone i18n-num-in-words repository into your local machine or fork. (e.g. gh repo clone USERNAME/i18n-num-in-words)
  3. Run package manager install (bun install)
  4. Run tests (bun test)
  5. It will run successfully, then check on you GitHub Action and allow to run the ci-cd workflow, it would be Error in the bun test, specifically, in num-in-words-factory.test.ts file even though we ran successfully in our local machine.

What is the expected behavior?

As a developer, I want the result of bun test to be consistent, so I can develop and debug easily.

What do you see instead?

Inconsistent result, succes locally, error in GitHub Action.

Additional information

GitHub Action Log:

Local Log:

󰀵  󱑍 09:21  ﱮ i18n-num-in-words/library    main  is 📦 v1.0.4 via 🦕 via  v20.12.0 
 ➜  bun test num-in-words-factory
bun test v1.0.36 (40f61ebb)

src/utils/num-in-words-factory.test.ts:
✓ numInWordsFactory > should return a function when called [0.19ms]
Experimental  (en), alpha feature enabled. This feature is not stable and may change in the future.
✓ numInWordsFactory > should warn when experimental is true [0.25ms]
The fn (en) feature is not stable yet. Please enable the experimental flag to use it.
✓ numInWordsFactory > should handle experimental false and non-stable status [0.09ms]
✓ numInWordsFactory > should handle experimental false and stable status [0.05ms]
The fn (en) feature is not stable yet. Please enable the experimental flag to use it.
✓ numInWordsFactory > should handle experimental false and default status [0.06ms]
The fn (en) feature is not stable yet. Please enable the experimental flag to use it.
✓ numInWordsFactory > should return an error when experimental false and non-stable status [0.05ms]
The number 9007199254740992 is too large to be converted.
✓ numInWordsFactory > should handle large numbers [0.07ms]
✓ numInWordsFactory > should handle memoization [0.05ms]
[i18n-num-in-words] Generating cache key for 7 in language en
✓ numInWordsFactory > should handle debug mode [0.08ms]
[i18n-num-in-words] Generating cache key for 8 in language en
[i18n-num-in-words] Generating cache key for 8 in language en
[i18n-num-in-words] Returning cached result for 8 in language en
✓ numInWordsFactory > should output debug message when debug is true, memoize is true, and cache is hit [0.11ms]

 10 pass
 0 fail
 16 expect() calls
Ran 10 tests across 1 files. [27.00ms]

Local Env:


  System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 4.83 GB / 7.65 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 20.12.0 - ~/.proto/shims/node
    Yarn: 4.1.1 - ~/.proto/shims/yarn
    npm: 10.2.4 - ~/.proto/shims/npm
    bun: 1.0.36 - ~/.bun/bin/bun
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
    Go: 1.22.0 - /home/imbios/.proto/shims/go
    Perl: 5.34.0 - /usr/bin/perl
    Python3: 3.10.12 - /usr/bin/python3
  npmPackages:
    @commitlint/cli: ^18.6.1 => 18.6.1 
    @commitlint/config-conventional: ^18.6.2 => 18.6.2 
    bun-types: ^1.0.36 => 1.0.36 
    husky: ^9.0.11 => 9.0.11 
    prettier: ^3.2.5 => 3.2.5 
    semver: ^7.6.0 => 7.6.0 
    turbo: ^1.12.4 => 1.12.4 
    typescript: ^5.3.3 => 5.3.3 
karl-run commented 4 months ago

I'm seing something similar. Same version of bun, same everything.

 57 pass
 0 fail
 99 expect() calls
Ran 57 tests across 3 files. [625.00ms]

But in Github Actions 1 out of 3 suites fail.

https://github.com/navikt/helsesjekk-bot/actions/runs/8832904188/job/24251103585

cjkoepke commented 1 month ago

Same for me, though I'm on MacOS (however GitHub Actions env is the same).

cjkoepke commented 1 month ago

@ImBIOS looks like your CI is working now, what did you change?

ImBIOS commented 1 month ago

@cjkoepke Nothing, the error moved from the Charset problem to the toHaveBeenCalledTimes problem, it still has errors. But, I'm not focusing on this problem in my library now, I'm focusing on looking for new opportunities.