From 4b587b01e2d0004b71b91f1982b12bd5a17f57e4 Mon Sep 17 00:00:00 2001 From: sun0day Date: Fri, 17 Mar 2023 01:21:09 +0800 Subject: [PATCH] test(resolve): cover the codes that parse the fs path contained postfix (#12436) --- playground/resolve/__tests__/resolve.spec.ts | 2 +- playground/resolve/index.html | 6 +++++- playground/resolve/package.json | 3 ++- playground/resolve/sharp-dir/index.cjs | 3 +++ playground/resolve/sharp-dir/package.json | 9 +++++++++ playground/resolve/vite.config.js | 5 ++++- pnpm-lock.yaml | 8 ++++++++ 7 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 playground/resolve/sharp-dir/index.cjs create mode 100644 playground/resolve/sharp-dir/package.json diff --git a/playground/resolve/__tests__/resolve.spec.ts b/playground/resolve/__tests__/resolve.spec.ts index 65f973e4c85dd3..cf61423388abb5 100644 --- a/playground/resolve/__tests__/resolve.spec.ts +++ b/playground/resolve/__tests__/resolve.spec.ts @@ -155,7 +155,7 @@ test('resolve.conditions', async () => { test('resolve package that contains # in path', async () => { expect(await page.textContent('.path-contains-sharp-symbol')).toMatch( - '[success] true', + '[success] true #', ) }) diff --git a/playground/resolve/index.html b/playground/resolve/index.html index a562e96847548f..158af31b3f413c 100644 --- a/playground/resolve/index.html +++ b/playground/resolve/index.html @@ -341,8 +341,12 @@

resolve package that contains # in path

import es5Ext from 'es5-ext' import contains from 'es5-ext/string/#/contains' + import { last } from '@vitejs/test-resolve-sharp-dir' - text('.path-contains-sharp-symbol', `[success] ${contains.call('#', '#')}`) + text( + '.path-contains-sharp-symbol', + `[success] ${contains.call('#', '#')} ${last.call('#')}`, + )