Skip to content

Commit e4431e0

Browse files
committed
fix: allow testing browser code in node
1 parent 4441952 commit e4431e0

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

packages/svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"acorn-typescript": "^1.4.13",
140140
"aria-query": "^5.3.1",
141141
"axobject-query": "^4.1.0",
142-
"esm-env": "^1.0.0",
142+
"esm-env": "^1.1.0",
143143
"esrap": "^1.2.2",
144144
"is-reference": "^3.0.2",
145145
"locate-character": "^3.0.0",

packages/svelte/src/internal/client/timing.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/** @import { Raf } from '#client' */
22
import { noop } from '../shared/utils.js';
33

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

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

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

pnpm-lock.yaml

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)