From 5b2f1b720a6861c05db72e46018b5a59520c7acc Mon Sep 17 00:00:00 2001 From: mattcompiles Date: Mon, 23 Oct 2023 12:43:59 +1100 Subject: [PATCH] Fix bundler tests assertions on windows (#9333) --- packages/core/integration-tests/test/bundler.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/core/integration-tests/test/bundler.js b/packages/core/integration-tests/test/bundler.js index a98dd5f5b03..33c1eed0421 100644 --- a/packages/core/integration-tests/test/bundler.js +++ b/packages/core/integration-tests/test/bundler.js @@ -10,6 +10,7 @@ import { run, } from '@parcel/test-utils'; import {hashString} from '@parcel/rust'; +import {normalizePath} from '@parcel/utils'; describe('bundler', function () { it('should not create shared bundles when a bundle is being reused and disableSharedBundles is enabled', async function () { @@ -1522,9 +1523,12 @@ describe('bundler', function () { }, ]); - let targetDistDir = __dirname.replace('/test', '/dist'); + let targetDistDir = normalizePath(path.join(__dirname, '../dist')); let hashedIdWithMSB = hashString('bundle:' + 'vendorjs' + targetDistDir); - assert(b.getBundles().find(b => b.id == hashedIdWithMSB)); + assert( + b.getBundles().find(b => b.id == hashedIdWithMSB), + 'MSB id does not match expected', + ); }); it('should support manual shared bundles with constants module', async function () { @@ -1660,9 +1664,12 @@ describe('bundler', function () { }, ]); - let targetDistDir = __dirname.replace('/test', '/dist'); + let targetDistDir = normalizePath(path.join(__dirname, '../dist')); let hashedIdWithMSB = hashString('bundle:' + 'vendorjs' + targetDistDir); - assert(b.getBundles().find(b => b.id == hashedIdWithMSB)); + assert( + b.getBundles().find(b => b.id == hashedIdWithMSB), + 'MSB id does not match expected', + ); await run(b); });