mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
* WIP * WIP * Add yaml plugin * Publish v0.0.1 * Updates * Start RSC plugin - not finished * Add readme * Updates * Add shell dirs for a few other plugins
22 lines
534 B
TypeScript
22 lines
534 B
TypeScript
import { test, expect } from "bun:test";
|
|
import YamlPlugin from ".";
|
|
import data from "./data.yml";
|
|
|
|
test("yaml loader - no plugin", async () => {
|
|
expect(async () => {
|
|
await import("./data.yml");
|
|
}).toThrow();
|
|
});
|
|
|
|
test("yaml loader", async () => {
|
|
const plugin = YamlPlugin();
|
|
Bun.plugin(plugin);
|
|
const { default: mod } = await import("./data.yml");
|
|
|
|
expect(mod.doe).toEqual("a deer, a female deer");
|
|
expect(mod.ray).toEqual("a drop of golden sun");
|
|
expect(mod.pi).toEqual(3.14159);
|
|
|
|
Bun.plugin.clearAll();
|
|
});
|