/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/jest-runtime/src/__tests__/runtime_wrap.js
60 строк
1 KB
Simen Bekkhus
chore(runtime): lift module executor (#16084)
03 май 2026, 00:12
Не верифицирован
03 май 2026, 00:12
6abdcf1
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ let createRuntime; describe('Runtime', () => { beforeEach(() => { createRuntime = require('createRuntime'); }); describe('constructInjectedModuleParameters', () => { it('generates the correct args', async () => { const runtime = await createRuntime(__filename); expect(runtime.executor.constructInjectedModuleParameters()).toEqual([ 'module', 'exports', 'require', '__dirname', '__filename', 'jest', ]); }); it('injects "extra globals"', async () => { const runtime = await createRuntime(__filename, { sandboxInjectedGlobals: ['Math'], }); expect(runtime.executor.constructInjectedModuleParameters()).toEqual([ 'module', 'exports', 'require', '__dirname', '__filename', 'jest', 'Math', ]); }); it('avoid injecting `jest` if `injectGlobals = false`', async () => { const runtime = await createRuntime(__filename, { injectGlobals: false, }); expect(runtime.executor.constructInjectedModuleParameters()).toEqual([ 'module', 'exports', 'require', '__dirname', '__filename', ]); }); }); });