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

dtos.spec.ts test passes in Node v18.x, fails in Node v20.x #364

Open
sentientforest opened this issue Sep 12, 2024 · 0 comments
Open

dtos.spec.ts test passes in Node v18.x, fails in Node v20.x #364

sentientforest opened this issue Sep 12, 2024 · 0 comments

Comments

@sentientforest
Copy link
Contributor

When running npm run test with Node.js version 20.17.0, one of the tests in chain-api/src/types/dtos.spec.ts fails due to a slightly different wording of an error message.

To replicate, use nvm to manage multiple Node.js versions and attempt to build and test in v18 versus v20.

Failure when using Node.js 20.x:

       FAIL   chain-api  chain-api/src/types/dtos.spec.ts
        ● should parse TestDtoWithArray
      
          expect(received).toEqual(expected) // deep equality
      
          Expected: "Unexpected end of JSON input"
          Received: "Unterminated string in JSON at position 16"
      
            71 |   expect(await getPlainOrError(TestDtoWithArray, invalid1)).toEqual(failedArrayMatcher);
            72 |   expect(await getPlainOrError(TestDtoWithArray, invalid2)).toEqual(failedArrayMatcher);
          > 73 |   expect(await getPlainOrError(TestDtoWithArray, invalid3)).toEqual("Unexpected end of JSON input");

The test code expects an exact match on the error message string, and it appears that the wording is slightly different across Node.js major versions.

https://github.com/GalaChain/sdk/blob/main/chain-api/src/types/dtos.spec.ts#L73

  expect(await getPlainOrError(TestDtoWithArray, invalid3)).toEqual("Unexpected end of JSON input");
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