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

Unreliable unit tests #1908

Open
friederbluemle opened this issue Jul 1, 2024 · 1 comment
Open

Unreliable unit tests #1908

friederbluemle opened this issue Jul 1, 2024 · 1 comment

Comments

@friederbluemle
Copy link
Member

Some unit test randomly appear to fail in certain conditions (for example when using Node.js 20 or later).

Example 1 (unit tests related to code push):

https://github.com/friederbluemle/electrode-native/actions/runs/9495253376/job/26167127192#step:6:520

https://dev.azure.com/ElectrodeNative/Electrode%20Native/_build/results?buildId=7222&view=logs&j=195f2670-0934-542b-f708-55083700808e&t=aee57a02-7e04-5dc7-01bc-f6a4fd498e68&l=2012

  340 passing (621ms)
  1 pending
  3 failing

  1) getCodePushInitConfig
       should return the access key from code push config if keys are present in both config files:
     AssertionError: expected undefined to equal '1e2509c78c4f94c25e69131a0a5e5be3b7d2927b'
      at Context.<anonymous> (test/getCodePushInitConfig-test.ts:40:53)
      at processImmediate (node:internal/timers:478:21)

  2) getCodePushInitConfig
       should return the access key from code push config if key is not present in .ernrc:
     AssertionError: expected undefined to equal '1e2509c78c4f94c25e69131a0a5e5be3b7d2927b'
      at Context.<anonymous> (test/getCodePushInitConfig-test.ts:55:53)
      at processImmediate (node:internal/timers:478:21)

  3) getCodePushSdk
       should not throw if an access key exists:
     AssertionError: expected [Function: getCodePushSdk] to not throw an error but 'Error: Unable to get the CodePush config to use' was thrown
      at Context.<anonymous> (test/getCodePushSdk-test.ts:43:40)
      at processImmediate (node:internal/timers:478:21)

Example 2 (two different unit tests related to CauldronHelper):

  460 passing (6s)
  2 failing

  1) CauldronHelper.js
       getYarnLock
         should return the yarn lock if found for key:
     Error: ENOENT: no such file or directory, open '/var/folders/xb/4lt2zppd3cnc6qhcc09wxb8r0000gn/T/tmp-32217-3fMBmodIH4Ix/yarnlocks/f0bf18dc-98ce-4548-bb2b-3ec35616091a'
      at Object.open (node:internal/fs/sync:78:18)
      at Object.openSync (node:fs:565:17)
      at Object.readFileSync (node:fs:445:35)
      at EphemeralFileStore.getFile (src/EphemeralFileStore.ts:57:17)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at Context.<anonymous> (test/CauldronHelper-test.ts:785:24)

  2) CauldronHelper.js
       updateYarnLock
         should update the yarn lock:
     Error: ENOENT: no such file or directory, open '/var/folders/xb/4lt2zppd3cnc6qhcc09wxb8r0000gn/T/tmp-32217-Lp4GZ8AHiQVY/yarnlocks/f2886fd3-3824-4e2b-ac07-2f116b691674'
      at Object.open (node:internal/fs/sync:78:18)
      at Object.openSync (node:fs:565:17)
      at Object.readFileSync (node:fs:445:35)
      at EphemeralFileStore.getFile (src/EphemeralFileStore.ts:57:17)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at Context.<anonymous> (test/CauldronHelper-test.ts:920:24)
@friederbluemle
Copy link
Member Author

And another one:

https://github.com/electrode-io/electrode-native/actions/runs/9748129912/job/26902753096?pr=1907

  342 passing (371ms)
  1 pending
  1 failing

  1) ModuleFactory
       getModuleInstance
         should create the cache directory if it does not exist [remote registry package]:
     Error: ENOENT: no such file or directory, open '/Users/runner/work/electrode-native/electrode-native/ern-core/test/ModuleFactoryCache/package.json'

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

1 participant