0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-22 02:27:49 +01:00
hono/build/validate-exports.test.ts
EdamAmex a6ccfa29ca
chore(build): validate if exporting is correct in package.json and jsr.json (#3638)
* feat(build): for both exports to be the same

* some fix

* fix exclude of coverage

* update

* stylish error message and add comment

* revert auto lint

* chore: format
2024-11-07 17:37:53 +09:00

32 lines
756 B
TypeScript

/// <reference types="vitest/globals" />
import { validateExports } from './validate-exports'
const mockExports1 = {
'./a': './a.ts',
'./b': './b.ts',
'./c/a': './c.ts',
'./d/*': './d/*.ts',
}
const mockExports2 = {
'./a': './a.ts',
'./b': './b.ts',
'./c/a': './c.ts',
'./d/a': './d/a.ts',
}
const mockExports3 = {
'./a': './a.ts',
'./c/a': './c.ts',
'./d/*': './d/*.ts',
}
describe('validateExports', () => {
it('Works', async () => {
expect(() => validateExports(mockExports1, mockExports1, 'package.json')).not.toThrowError()
expect(() => validateExports(mockExports1, mockExports2, 'jsr.json')).not.toThrowError()
expect(() => validateExports(mockExports1, mockExports3, 'package.json')).toThrowError()
})
})