From abb30eaa3eab632971e5909c8f0464ed85290421 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 30 Aug 2019 09:58:40 +0200 Subject: [PATCH] windows test fix --- e2e/__tests__/transform.test.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/e2e/__tests__/transform.test.ts b/e2e/__tests__/transform.test.ts index d297ef3960ab..d00f6189af49 100644 --- a/e2e/__tests__/transform.test.ts +++ b/e2e/__tests__/transform.test.ts @@ -187,23 +187,21 @@ describe('transformer-config', () => { }); describe('transformer caching', () => { - const dir = path.resolve(__dirname, '..', 'transform/cache'); - const dirRegexp = new RegExp('^' + dir); + const dir = path.resolve(__dirname, '../transform/cache'); + const transformedFile = path.resolve(dir, './common-file.js'); it('does not rerun transform within worker', () => { // --no-cache because babel can cache stuff and result in false green const {stdout} = runJest(dir, ['--no-cache', '-w=2']); - const loggedFiles = stdout.split('\n').map(line => { - expect(line).toMatch(dirRegexp); + const loggedFiles = stdout.split('\n'); - return line.replace(dirRegexp, ''); + // Verify any lines logged are _just_ the file we care about + loggedFiles.forEach(line => { + expect(line).toBe(transformedFile); }); // We run with 2 workers, so the file should be transformed twice - expect(loggedFiles).toEqual([ - '/common-file.js', - '/common-file.js', - ]); + expect(loggedFiles).toHaveLength(2); }); });