Files
meeting-room/frontend/node_modules/es-shim-unscopables/test/with.js
flying-hero 96f6318101 📦 添加虚拟环境和启动脚本
新增:
- backend/venv/ - Python 虚拟环境
- backend/start.sh - 启动脚本(使用虚拟环境)
- backend/requirements.txt - 依赖列表
- .gitignore - 忽略虚拟环境和缓存文件

说明:
- 每个项目使用独立虚拟环境
- 避免依赖冲突
- 启动脚本自动创建和激活虚拟环境
2026-04-04 18:29:02 +08:00

44 lines
1.3 KiB
JavaScript

/* eslint no-restricted-syntax: 0, no-with: 0, strict: 0 */
var test = require('tape');
var shimUnscopables = require('../');
test('`with` statement', { skip: typeof Symbol !== 'function' || !Symbol.unscopables }, function (t) {
// @ts-expect-error this variable is declared in case unscopables doesn't work
var entries;
// @ts-expect-error this variable is declared in case unscopables doesn't work
var concat;
// @ts-expect-error `with` unsupported
with ([]) {
t.equal(concat, Array.prototype.concat, 'concat is dynamically bound');
t.notEqual(entries, Array.prototype.entries, 'entries is not dynamically bound');
}
/** @type {Record<PropertyKey, unknown>} */
var obj = {
foo: 1,
bar: 2
};
// @ts-expect-error this variable is declared in case unscopables doesn't work
var foo;
// @ts-expect-error this variable is declared in case unscopables doesn't work
var bar;
obj[Symbol.unscopables] = { foo: true };
// @ts-expect-error `with` unsupported
with (obj) {
t.equal(foo, undefined);
t.equal(bar, obj.bar);
}
shimUnscopables('concat');
// @ts-expect-error `with` unsupported
with ([]) {
t.notEqual(concat, Array.prototype.concat, 'concat is no longer dynamically bound');
t.notEqual(entries, Array.prototype.entries, 'entries is still not dynamically bound');
}
t.end();
});