Skip to content

Commit

Permalink
test using memdisk
Browse files Browse the repository at this point in the history
  • Loading branch information
nonzzz committed Nov 13, 2024
1 parent 075ba70 commit d4f4fdd
Show file tree
Hide file tree
Showing 3 changed files with 1,746 additions and 2,655 deletions.
9 changes: 5 additions & 4 deletions __tests__/shared/kit.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path'
import url from 'url'
import { build } from 'vite'
import type { InlineConfig } from 'vite'
import { destroy as _destory, create } from 'memdisk'

export const __filename = url.fileURLToPath(import.meta.url)

Expand All @@ -16,16 +17,16 @@ export function sleep(delay: number) {
return new Promise((resolve) => setTimeout(resolve, delay))
}

const namespace = '.tmpl_suite'
const namespace = 'compression-suite-'

export function createDisk(p: string) {
const dir = path.join(path.dirname(__dirname), namespace)
const root = path.join(dir, p)
const dir = create.sync(namespace + p, 64 * 1024 * 1024, { quiet: false })
const root = dir

fs.mkdirSync(root, { recursive: true })

const destroy = () => {
fs.rmSync(root, { recursive: true, force: true })
_destory.sync(dir, { quiet: false })
}

return { destroy, root, dir }
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,15 @@
"url": "https://github.com/nonzzz/vite-plugin-compression/issues"
},
"homepage": "https://github.com/nonzzz/vite-plugin-compression#readme",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"exports": "./src/index.ts",
"devDependencies": {
"@swc/core": "^1.7.26",
"@types/node": "^20.14.9",
"@vitest/coverage-v8": "^2.0.3",
"dprint": "^0.46.3",
"eslint": "^8.57.0",
"eslint-config-kagura": "^2.1.1",
"memdisk": "^1.2.1",
"playwright": "^1.32.3",
"rollup": "^4.18.0",
"rollup-plugin-dts": "^6.1.1",
Expand All @@ -53,6 +48,9 @@
"@rollup/pluginutils": "^5.1.0",
"tar-mini": "^0.2.0"
},
"optionalDependencies": {
"vite": "^5.3.4"
},
"resolutions": {
"is-core-module": "npm:@nolyfill/is-core-module@^1",
"sirv": "2.0.3"
Expand Down
Loading

0 comments on commit d4f4fdd

Please sign in to comment.