Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Locales are now using .js extension, which breaks unit tests that are run with jest #61801

Open
@chabb

Description

@chabb

Which @angular/* package(s) are the source of the bug?

common

Is this a regression?

Yes, in the sense this was working in the 19.X line before 19.2.14

Description

We're using jest for unit testing, and the latest angular update break our test
We're transform files with the .mjs extension. Locales were using this extension and were correctly transformed by jest. Now, locales are using the .js extension, so our unit tests break.
We could fix our jest config to specifically transform this particular package, but IHMO it would be better to keep the mjs extension, so it can be transformed by jest in a general way, not in an ad-hoc way

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-cm13ifyv?file=package.json,jest.config.ts

This works, as it's on 19.2.13. Just bump the angular/common to 19.2.14 package and run npm test

Please provide the exception or error you saw

● Test suite failed to run
  Jest encountered an unexpected token
    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
<anonymized_path>/@angular/common/locales/de-CH.js:16

Please provide the environment you discovered this bug in (run ng version)

Was working with angular/[email protected]
Breaks on angular/[email protected]

Anything else?

Probably introduced by d4d4be8

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: commonIssues related to APIs in the @angular/common package

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions