From 2df9ae80ac1a590f66e169f697bdc52541ebefb3 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Sat, 23 Sep 2023 21:45:10 +0900 Subject: [PATCH] test: tweak lib helpers inject to test "use strict" --- playground/lib/__tests__/lib.spec.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/playground/lib/__tests__/lib.spec.ts b/playground/lib/__tests__/lib.spec.ts index 8232a2fd100649..682fd5aeba6c85 100644 --- a/playground/lib/__tests__/lib.spec.ts +++ b/playground/lib/__tests__/lib.spec.ts @@ -33,11 +33,9 @@ describe.runIf(isBuild)('build', () => { 'dist/nominify/my-lib-custom-filename.iife.js', ) // esbuild helpers are injected inside of the IIFE wrapper - // esbuild has a bug that injects some statements before `"use strict"`: https://github.com/evanw/esbuild/issues/3322 - // remove the `.*?` part once it's fixed - expect(code).toMatch(/^var MyLib=function\(\)\{.*?"use strict";/) + expect(code).toMatch(/^var MyLib=function\(\)\{\s*"use strict";/) expect(noMinifyCode).toMatch( - /^var MyLib\s*=\s*function\(\)\s*\{.*?"use strict";/s, + /^var MyLib\s*=\s*function\(\)\s*\{\s*"use strict";/, ) })