From 0321716b3fd7d993f3a574aa68e77954de857097 Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Wed, 9 Feb 2022 04:01:35 +0000 Subject: [PATCH] add failing tests from https://github.com/evanw/esbuild/pull/2001 --- README.md | 40 +++++++++++++++++++++++++++++++++++----- tests.js | 13 +++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 417ed7b..a6d89a1 100644 --- a/README.md +++ b/README.md @@ -364,12 +364,42 @@ node_modules/pkg/lib/fail.js: ✅ 🚫 +
/entry.js:
+  require('pkg/sub')
+/node_modules/pkg/package.json:
+  { "browser": { "./sub": "./sub/index.js" } }
+/node_modules/pkg/sub/index.js:
+  require('sub')
+/node_modules/sub/index.js:
+  input.works = true
+
+🚫 +✅ +✅ +✅ +✅ + +
/entry.js:
+  require('pkg/sub')
+/node_modules/pkg/package.json:
+  { "browser": { "./sub": "./sub/index.js" } }
+/node_modules/pkg/sub/index.js:
+  require('sub2')
+/node_modules/sub2/index.js:
+  input.works = true
+
+✅ +✅ +✅ +✅ +✅ + Percent handled: -100.0% -79.2% -66.7% -62.5% -25.0% +96.2% +80.8% +69.2% +65.4% +30.8% diff --git a/tests.js b/tests.js index 4583c42..36681d3 100644 --- a/tests.js +++ b/tests.js @@ -138,6 +138,19 @@ const positiveTests = [ 'node_modules/pkg/lib/index.js': `input.works = true`, 'node_modules/pkg/lib/fail.js': `throw 'fail'`, }, + { + "/entry.js": `require('pkg/sub')`, + "/node_modules/pkg/package.json": `{ "browser": { "./sub": "./sub/index.js" } }`, + "/node_modules/pkg/sub/index.js": `require('sub')`, + "/node_modules/sub/index.js": `input.works = true`, + }, + { + + "/entry.js": `require('pkg/sub')`, + "/node_modules/pkg/package.json": `{ "browser": { "./sub": "./sub/index.js" } }`, + "/node_modules/pkg/sub/index.js": `require('sub2')`, + "/node_modules/sub2/index.js": `input.works = true`, + }, ] const negativeTests = [