Skip to content

With cached results, changes to type definitions are not detected #1390

@drrnkin

Description

@drrnkin

Issue :

Given a type declaration in core code, and a reference to that type definition in jest code, type-safety is not always enforced.

Expected behavior :

Changes to type definitions should be detected (failing to compile where appropriate).

Minimal repo :

  1. Unzip the attached zip file and run yarn and then yarn test (should succeed).
  2. Change the type definition in thing.ts to contain b: number
  3. Run yarn test again. Due to the cache, it succeeds and should not. It will (correctly) fail if you remove the cache folder "jestCache"

thing.ts contains:

export type Thing = {
	a: number;
	// b: number;
};

thing.test.ts contains:

export const thing: Thing = { a: 1 };

jestCache.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions