@alik6/bun-copy-plugin
Version:
The Copy Plugin for Bun is a utility plugin designed to copy files and directories during the build process using [Bun](https://github.com/oven-sh/bun). This plugin facilitates the copying of assets from one location to another, offering flexibility and c
24 lines (22 loc) • 755 B
text/typescript
import { expect, afterEach, describe, test } from "bun:test";
import { handleFile } from "..";
import * as fs from "node:fs/promises";
import { $ } from "bun";
afterEach(async () => {
await $`rm -rf test/`;
});
describe("file-test", () => {
test("same-directory-file-copy-test", async () => {
await $`mkdir test`;
await $`touch test/out.ts`;
await handleFile({ to: "test/app.ts", from: "test/out.ts" });
expect(await fs.exists("test/out.ts")).toBeTrue();
});
test("different-directory-file-copy-test", async () => {
await $`mkdir test`;
await $`mkdir test/2/`;
await $`touch test/out.ts`;
await handleFile({ to: "test/2/", from: "test/out.ts" });
expect(await fs.exists("test/2/out.ts")).toBeTrue();
});
});