[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: add unit test for json module export detection (#1452)

authored by

eryue0220 and committed by
GitHub
c6952cec 3ce6ad91

+21
+21
test/unit/shared/utils/package-analysis.spec.ts
··· 91 91 // npm treats packages without type field as CommonJS 92 92 expect(detectModuleFormat({})).toBe('cjs') 93 93 }) 94 + 95 + it('detect dual from JSON exports', () => { 96 + expect( 97 + detectModuleFormat({ 98 + main: 'test.json', 99 + exports: { 100 + '.': './test.json', 101 + }, 102 + }), 103 + ).toBe('dual') 104 + }) 105 + 106 + it('detect esm from JSON exports', () => { 107 + expect( 108 + detectModuleFormat({ 109 + exports: { 110 + '.': './test.json', 111 + }, 112 + }), 113 + ).toBe('esm') 114 + }) 94 115 }) 95 116 96 117 describe('detectTypesStatus', () => {