From 5b267091ed126ef7fc67ff2dd3749fa3ea5f14ac Mon Sep 17 00:00:00 2001 From: "Andrew Coates (REDMOND)" Date: Wed, 1 Apr 2020 15:07:36 -0700 Subject: [PATCH] More consistent snapshots on windows (#28482) Summary: Get jest tests to be runnable on windows, and match current snapshots ## Changelog [Internal] [Fixed] - More consistent snapshots on windows Pull Request resolved: https://github.com/facebook/react-native/pull/28482 Test Plan: run `yarn test` on a windows machine, and hit the test_windows circleci tests Reviewed By: hramos Differential Revision: D20799002 Pulled By: cpojer fbshipit-source-id: da3db0171c34a43199c7d3dc17b622b37bc91701 --- .../__tests__/index-test.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/babel-plugin-inline-view-configs/__tests__/index-test.js b/packages/babel-plugin-inline-view-configs/__tests__/index-test.js index 48bedbfd700..a62d5eb0dfa 100644 --- a/packages/babel-plugin-inline-view-configs/__tests__/index-test.js +++ b/packages/babel-plugin-inline-view-configs/__tests__/index-test.js @@ -21,7 +21,7 @@ const transform = (fixture, filename) => filename: filename, highlightCode: false, plugins: [require('@babel/plugin-syntax-flow'), require('../index')], - }).code.replace(/^[A-Z]:\\/g, '/'); // Ensure platform consistent snapshots. + }).code; describe('Babel plugin inline view configs', () => { Object.keys(fixtures) @@ -37,7 +37,12 @@ describe('Babel plugin inline view configs', () => { .forEach(fixtureName => { it(`fails on inline config for ${fixtureName}`, () => { expect(() => { - transform(failures[fixtureName], fixtureName); + try { + transform(failures[fixtureName], fixtureName); + } catch (err) { + err.message = err.message.replace(/^[A-z]:\\/g, '/'); // Ensure platform consistent snapshots. + throw err; + } }).toThrowErrorMatchingSnapshot(); }); });