Skip to content

Instantly share code, notes, and snippets.

@mizchi
Created October 19, 2023 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mizchi/13996e3f7ad979c67f1682deb2271a3f to your computer and use it in GitHub Desktop.
Save mizchi/13996e3f7ad979c67f1682deb2271a3f to your computer and use it in GitHub Desktop.
import {test, expect} from 'vitest';
test("nested", async () => {
const a = 'export default Math.random()';
const b = `export default () => import('data:text/javascript;base64,${btoa(a)}')`;
const bmod = await import(`data:text/javascript;base64,${btoa(b)}`);
const amod = await import(`data:text/javascript;base64,${btoa(a)}`);
expect(await bmod.default()).not.toBe(await amod.default);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment