Skip to content

Jest unit testing path transforming #673

Closed
Closed
@deyan-r

Description

@deyan-r

Description

jest testing framework has 9 functions that get module name as a parameter:

• jest.createMockFromModule
• jest.mock
• jest.unmock
• jest.deepUnmock
• jest.doMock
• jest.dontmock
• jest.setMock
• jest.requireActual
• jest.requireMock
The parameter contains a relative path to the source file to be mocked. The path is valid for files in src directory, but is not valid when the transpiled files are stored under target for testing.

The paths should be automatically transformed according to test location

Alternatives

As a workaround, the path can be set to the estimated location during testing, but it's not user friendly and prevents test to be run outside of vrbt context

Additional Context

This issue is only relevant for jest

Metadata

Metadata

Assignees

Labels

area/vrotscRelates to `vrotsc` modulekind/enhancementEnhancement or improvement of existing featureslang/typescriptRelated to typescript codetriage/acceptedThe issue was accepted and will be done

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions