mirror of
https://github.com/honojs/hono.git
synced 2024-11-25 05:07:03 +01:00
6cf01e5523
* fix(build): remove private fields * chore: format scripts * test: add test code * reduce package.json diff * feat(build): add progress for removing private fields * feat: rename `scripts` to `build`
22 lines
702 B
TypeScript
22 lines
702 B
TypeScript
/// <reference types="vitest/globals" />
|
|
|
|
import { removePrivateFields } from './remove-private-fields'
|
|
import fs from 'node:fs/promises'
|
|
import path from 'node:path'
|
|
import os from 'node:os'
|
|
|
|
describe('removePrivateFields', () => {
|
|
it('Works', async () => {
|
|
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'removePrivateFields'))
|
|
const tsPath = path.join(tmpDir, 'class.ts')
|
|
await fs.writeFile(tsPath, 'class X { #private: number = 0; a: number = 0 }')
|
|
expect(removePrivateFields(tsPath)).toBe(`class X {
|
|
a: number = 0;
|
|
}
|
|
`)
|
|
})
|
|
it('Should throw error when path does not exist', () => {
|
|
expect(() => removePrivateFields('./unknown.ts')).toThrowError(Error)
|
|
})
|
|
})
|