Skip to content

Commit 236351d

Browse files
committed
Add unit test
1 parent 29f5291 commit 236351d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/cases/unittests/reuseProgramStructure.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,22 @@ namespace ts {
259259
assert.isTrue(!program_1.structureIsReused);
260260
});
261261

262+
it("fails if change affects type references", () => {
263+
const program_1 = newProgram(files, ["a.ts"], { types: ["a"] });
264+
updateProgram(program_1, ["a.ts"], { types: ["b"] }, files => {
265+
266+
});
267+
assert.isTrue(!program_1.structureIsReused);
268+
});
269+
270+
it("succeeds if change doesn't affect type references", () => {
271+
const program_1 = newProgram(files, ["a.ts"], { types: ["a"] });
272+
updateProgram(program_1, ["a.ts"], { types: ["a"] },afiles => {
273+
274+
});
275+
assert.isTrue(program_1.structureIsReused);
276+
});
277+
262278
it("fails if change affects imports", () => {
263279
const program_1 = newProgram(files, ["a.ts"], { target });
264280
updateProgram(program_1, ["a.ts"], { target }, files => {

0 commit comments

Comments
 (0)