Skip to content

Inconsistent result of bun test in Local MacOS and GitHub Actions Ubuntu #7386

Open

Description

@ImBIOS

What version of Bun is running?

1.0.14+d8be3e51b

What platform is your computer?

Darwin 23.1.0 arm64 arm

What steps can reproduce the bug?

  1. clone https://github.com/ImBIOS/i18n-num-in-words
  2. Run bun i then bun test, it would success
  3. But, check it here, the bun test has some errors in the GH Actions

What is the expected behavior?

If success, then success in both platforms. If error, then error in both platforms.

What do you see instead?

Error in GitHub Actions, but success in Local MacOS

Additional information

First problem encounter:

Activity

  1. Jarred-Sumner commented on Dec 1, 2023

    @Jarred-Sumner
    Collaborator

    i have a feeling this is going to be an Intl library thing but i haven't read the code

  2. simylein commented on Dec 1, 2023

    @simylein
    Contributor

    If your library happens to do any kind of file reading the sorting will be different on Linux to macOS

  3. ImBIOS commented on Dec 1, 2023

    @ImBIOS
    ContributorAuthor
    library/src/utils/num-in-words-factory.test.ts:
      (pass) numInWordsFactory > should return a function when called [0.04ms]
      
      Error: Expected []
      
            at /home/runner/work/i18n-num-in-words/i18n-num-in-words/library/src/utils/num-in-words-factory.test.ts:49:4
      44 |     const fn = (num: number) => `one`;
      45 |     const factory = numInWordsFactory(fn, { lang });
      46 | 
      47 |     factory(1, { experimental: true });
      48 | 
      49 |     expect(warnSpy).toHaveBeenCalled();
              ^
      error: expect(received).toHaveBeenCalled()
      
      Expected []
      
            at /home/runner/work/i18n-num-in-words/i18n-num-in-words/library/src/utils/num-in-words-factory.test.ts:49:4
      (fail) numInWordsFactory > should warn when experimental is true [0.21ms]
      The fn (en) feature is not stable yet. Please enable the experimental flag to use it.
      (pass) numInWordsFactory > should handle experimental false and non-stable status [0.11ms]
      (pass) numInWordsFactory > should handle experimental false and stable status [0.06ms]
      The fn (en) feature is not stable yet. Please enable the experimental flag to use it.
      (pass) 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.
      (pass) numInWordsFactory > should return an error when experimental false and non-stable status [0.06ms]
      The number 9007199254740992 is too large to be converted.
      (pass) numInWordsFactory > should handle large numbers [0.05ms]
      
      Error: Expected []
      
            at /home/runner/work/i18n-num-in-words/i18n-num-in-words/library/src/utils/num-in-words-factory.test.ts:135:4
      130 | 
      131 |     // Call the factory again with the same number
      132 |     res = factory(staticNum);
      133 | 
      134 |     expect(res).toBe(staticWord);
      135 |     expect(fn).toHaveBeenCalledTimes(1);
              ^
      error: expect(received).toHaveBeenCalledTimes(expected)
      
      Expected []
      
            at /home/runner/work/i18n-num-in-words/i18n-num-in-words/library/src/utils/num-in-words-factory.test.ts:135:4
      (fail) numInWordsFactory > should handle memoization [0.13ms]
      (pass) numInWordsFactory > should handle debug mode [0.13ms]
      
      Error: Expected []
      
            at /home/runner/work/i18n-num-in-words/i18n-num-in-words/library/src/utils/num-in-words-factory.test.ts:158:4
      153 | 
      154 |     // Call the factory twice with the same number
      155 |     factory(staticNum, { debug: true });
      156 |     factory(staticNum, { debug: true });
      157 | 
      158 |     expect(fn).toHaveBeenCalledTimes(1);
              ^
      error: expect(received).toHaveBeenCalledTimes(expected)
      
      Expected []
      
            at /home/runner/work/i18n-num-in-words/i18n-num-in-words/library/src/utils/num-in-words-factory.test.ts:158:4

    @simylein I'm not doing anything near that, it's just a library to change integer numbers into internationalized strings.

    Previous version of bun having consistent result as Node.js and Jest result tho.

    Kudos to @oven-sh, the test is always blazingly fast.

  4. added
    bun:testSomething related to the `bun test` runner
    on Dec 1, 2023
  5. josh- commented on Mar 19, 2025

    @josh-

    Also running into this - could it be related to differences in the ICU library between macOS and Ubuntu?

    For example, consider this code:

    new Date(1712880000000).toLocaleTimeString("en-US", {
      year: "numeric",
      month: "short",
      hour: "2-digit",
      minute: "2-digit",
      hour12: false,
    });

    on macOS this is Apr 2024 at 10:00 however on Ubuntu (GitHub Actions) this is Apr 2024, 00:00 (note , instead of at)

    in both places Intl.DateTimeFormat().resolvedOptions().locale resolves to en-US.

    when testing the browsers I have installed on my macOS machine, Safari returns Apr 2024 at 10:00 and Chrome returns Apr 2024, 10:00.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbun:testSomething related to the `bun test` runner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions