From 7cca5d74509582613b2007d5d75d727a1e3b2f92 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Sat, 4 May 2024 13:34:21 -0700 Subject: [PATCH] add test for root level --- test/lib/file-scope.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/lib/file-scope.js b/test/lib/file-scope.js index b8fc123..4474911 100644 --- a/test/lib/file-scope.js +++ b/test/lib/file-scope.js @@ -276,6 +276,17 @@ describe('File Scope', function () { assert.strictEqual(result, 'deep:method'); }); + it('handles package root file', function () { + filepath = '/path/to/package/server.js'; + fs.statSync.restore(); + sinon.stub(fs, 'statSync') + .throws(noentError) + .onCall(0).returns() // packageBase found + ; + const result = fileScope(filepath)(method); + assert.strictEqual(result, 'server:method'); + }); + }); // fileScope -- 2.45.2