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

Some tests are failing on latest Node v22.2.0 #116

Closed
mdjermanovic opened this issue May 17, 2024 · 1 comment · Fixed by #117
Closed

Some tests are failing on latest Node v22.2.0 #116

mdjermanovic opened this issue May 17, 2024 · 1 comment · Fixed by #117

Comments

@mdjermanovic
Copy link
Member

mdjermanovic commented May 17, 2024

On #115, I got several unrelated tests failing on Node v22.2.0.

Last time we ran tests on Node 22, they were passing, but that was with Node v22.1.0.

I re-ran Node 22 test on the main branch to check again with the latest Node v22.2.0, and it's failing.

https://github.com/eslint/create-config/actions/runs/9064687625/job/25110939311

  ❯ tests/utils/npm-utils.spec.js  (23 tests | 4 failed) 64ms
    ❯ tests/utils/npm-utils.spec.js > npmUtils > checkDevDeps() > should throw with message when parsing invalid package.json
      → expected [Function] to throw an error
    ❯ tests/utils/npm-utils.spec.js > npmUtils > checkDeps() > should throw with message when parsing invalid package.json
      → expected [Function] to throw an error
    ❯ tests/utils/npm-utils.spec.js > npmUtils > checkPackageJson() > should return false if package.json does not exist
      → expected true to equal false
    ❯ tests/utils/npm-utils.spec.js > npmUtils > installSyncSaveDev() > should log an error message if npm throws ENOENT error
      → Unspecified AssertionError
 stderr | tests/utils/npm-utils.spec.js > npmUtils > installSyncSaveDev() > should log an error message if npm throws ENOENT error
 Could not execute npm. Please install the following package with a package manager of your choice: some-package

 (node:1814) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
 --import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("esmock", pathToFileURL("./"));'
 (Use `node --trace-warnings ...` to show where the warning was created)
  ✓ tests/config-snapshots.spec.js  (39 tests) 2420ms

 ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯

  FAIL  tests/utils/npm-utils.spec.js > npmUtils > checkDevDeps() > should throw with message when parsing invalid package.json
 AssertionError: expected [Function] to throw an error

 - Expected:
 null

 + Received:
 undefined

  ❯ tests/utils/npm-utils.spec.js:84:20
      82|             });
      83|
      84|             assert.throws(() => {
        |                    ^
      85|                 stubcheckDevDeps(["some-package"]);
      86|             }, /JSON/u);


 ##[error]AssertionError: expected [Function] to throw an error

    - Expected:
    null

    + Received:
    undefined

     ❯ tests/utils/npm-utils.spec.js:84:20


 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯

  FAIL  tests/utils/npm-utils.spec.js > npmUtils > checkDeps() > should throw with message when parsing invalid package.json
 AssertionError: expected [Function] to throw an error

 - Expected:
 null

 + Received:
 undefined

  ❯ tests/utils/npm-utils.spec.js:134:20

 ##[error]AssertionError: expected [Function] to throw an error

    - Expected:
    null

    + Received:
    undefined

     ❯ tests/utils/npm-utils.spec.js:134:20


     132|             });
     133|
     134|             assert.throws(() => {
        |                    ^
     135|                 stubbedcheckDeps(["some-package"]);
     136|             }, /JSON/u);

 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯

  FAIL  tests/utils/npm-utils.spec.js > npmUtils > checkPackageJson() > should return false if package.json does not exist
 AssertionError: expected true to equal false

 - Expected
 + Received

 - false
 + true

  ❯ tests/utils/npm-utils.spec.js:152:20

 ##[error]AssertionError: expected true to equal false

    - Expected
    + Received

    - false
    + true

     ❯ tests/utils/npm-utils.spec.js:152:20


     150|             const { checkPackageJson: stubbedcheckPackageJson } = awai…

 ##[error]AssertionError: Unspecified AssertionError
     ❯ tests/utils/npm-utils.spec.js:200:13


     151|
     152|             assert.strictEqual(stubbedcheckPackageJson(), false);
        |                    ^
     153|         });
     154|     });

 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/4]⎯

  FAIL  tests/utils/npm-utils.spec.js > npmUtils > installSyncSaveDev() > should log an error message if npm throws ENOENT error
 AssertionError: Unspecified AssertionError
  ❯ tests/utils/npm-utils.spec.js:200:13
     198|             stubinstallSyncSaveDev("some-package");
     199|
     200|             assert(logErrorStub.calledOnce);
        |             ^
     201|
     202|             npmUtilsStub.restore();

 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/4]⎯

  Test Files  1 failed | 1 passed (2)
       Tests  4 failed | 58 passed (62)
    Start at  16:45:59
    Duration  2.85s (transform 89ms, setup 0ms, collect 239ms, tests 2.48s, environment 1ms, prepare 281ms)

@fasttime
Copy link
Member

fasttime commented May 17, 2024

It looks like this problem is caused by esmock not working as expected on Node.js 22.2.0 in the current setup. I haven't looked any deeper into this, but replacing esmock with sinon, which is already used in other unit tests, fixes the build. See #117.

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

Successfully merging a pull request may close this issue.

2 participants