From 0b07cf9321e466fec991463b028d205f2bb7a558 Mon Sep 17 00:00:00 2001 From: Ahn Date: Fri, 3 Apr 2020 10:00:51 +0200 Subject: [PATCH 1/2] chore: fix program unit tests fail for local machine --- src/compiler/program.spec.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/compiler/program.spec.ts b/src/compiler/program.spec.ts index 8761bbbd47..7703ede6f1 100644 --- a/src/compiler/program.spec.ts +++ b/src/compiler/program.spec.ts @@ -14,19 +14,12 @@ const baseTsJestConfig = { } describe('cache', () => { - const fileName = 'test-cache.ts' const source = 'console.log("hello")' - beforeAll(() => { - writeFileSync(fileName, source, 'utf8') - }) - - afterAll(() => { - removeSync(fileName) - }) - it('should use the cache with normal program', () => { + const fileName = 'test-cache-program.ts' const tmp = tempDir('program-compiler') + writeFileSync(fileName, source, 'utf8') const compiler = makeCompiler({ jestConfig: { cache: true, cacheDirectory: tmp }, tsJestConfig: { @@ -47,7 +40,7 @@ describe('cache', () => { ", "[level:20] visitSourceFileNode(): hoisting ", - "[level:20] diagnoseFn(): computing diagnostics for test-cache.ts using program + "[level:20] diagnoseFn(): computing diagnostics for test-cache-program.ts using program ", "[level:20] readThrough(): writing caches ", @@ -64,10 +57,14 @@ describe('cache', () => { `) expect(compiled2).toBe(compiled1) + + removeSync(fileName) }) it('should use the cache with incremental program', () => { + const fileName = 'test-cache-incremental-program.ts' const tmp = tempDir('incremental-program-compiler') + writeFileSync(fileName, source, 'utf8') const compiler = makeCompiler({ jestConfig: { cache: true, cacheDirectory: tmp }, tsJestConfig: { @@ -88,7 +85,7 @@ describe('cache', () => { ", "[level:20] visitSourceFileNode(): hoisting ", - "[level:20] diagnoseFn(): computing diagnostics for test-cache.ts using incremental program + "[level:20] diagnoseFn(): computing diagnostics for test-cache-incremental-program.ts using incremental program ", "[level:20] readThrough(): writing caches ", @@ -105,6 +102,8 @@ describe('cache', () => { `) expect(compiled2).toBe(compiled1) + + removeSync(fileName) }) }) From 5a2f8a4135e1aa0fa313a5edf5d7c8575bafbea4 Mon Sep 17 00:00:00 2001 From: Ahn Date: Fri, 3 Apr 2020 10:40:12 +0200 Subject: [PATCH 2/2] chore: run diagnostics e2e tests for warning without cache --- e2e/__tests__/diagnostics.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/__tests__/diagnostics.test.ts b/e2e/__tests__/diagnostics.test.ts index c9057efe6f..73a67b4ba0 100644 --- a/e2e/__tests__/diagnostics.test.ts +++ b/e2e/__tests__/diagnostics.test.ts @@ -145,6 +145,7 @@ describe('With diagnostics warn only', () => { const testCase = configureTestCase('diagnostics', { tsJestConfig: { diagnostics: { warnOnly: true }, + noCache: true, // warnings shown only on first compilation }, })