Skip to content

Commit

Permalink
fix: allow testing browser code in node
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Oct 29, 2024
1 parent 4441952 commit 47ae3ab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"acorn-typescript": "^1.4.13",
"aria-query": "^5.3.1",
"axobject-query": "^4.1.0",
"esm-env": "^1.0.0",
"esm-env": "^1.1.1",
"esrap": "^1.2.2",
"is-reference": "^3.0.2",
"locate-character": "^3.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/svelte/src/internal/client/timing.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/** @import { Raf } from '#client' */
import { noop } from '../shared/utils.js';

import { BROWSER } from 'esm-env';
import { BROWSER, NODE } from 'esm-env';

const request_animation_frame = BROWSER ? requestAnimationFrame : noop;
// we check both conditions here to allow running browser code in Node for testing
const request_animation_frame = BROWSER && !NODE ? requestAnimationFrame : noop;

const now = BROWSER ? () => performance.now() : () => Date.now();

Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47ae3ab

Please sign in to comment.