Files
discordeno/scripts/fixBunTestExtension.js
Skillz4Killz 914dc30396 test: bun test (#2798)
* test: bun test

* Update package.json

* ci: update bun version

* Update package.json

* Update package.json

* test

* ci: update bun

* chore(ci): update bun version

---------

Co-authored-by: H01001000 <heiheiho000@gmail.com>
2023-10-28 12:52:58 +00:00

22 lines
613 B
JavaScript

import fs from 'node:fs'
const dirs = ['']
try {
fs.rmSync('bunTestsDist', { recursive: true, force: true })
} catch {
//
}
for await (const dir of dirs) {
await Promise.all(
fs.readdirSync(`tests${dir}`).map(async (file) => {
if (!file.endsWith('.ts') && !file.includes('.')) {
dirs.push(`${dir}/${file}`)
return
}
const content = await fs.promises.readFile(`tests${dir}/${file}`, 'utf-8')
fs.mkdirSync(`bunTestsDist${dir}`, { recursive: true })
fs.promises.writeFile(`bunTestsDist${dir}/${file}`, content.replace(/'mocha'/g, "'bun:test'"))
}),
)
}