/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
e2e/vmscript-coverage/__tests__/extract-coverage.test.js
42 строки
815 B
Tom Mrazauskas
fix(jest-runtime, @jest/transform): allow V8 coverage provider to collect coverage from files which were not loaded explicitly (#13974)
04 мар 2023, 13:03
Не верифицирован
04 мар 2023, 13:03
0060728
Код
Авторство
О чём код?
/** * 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. */ const fs = require('fs'); const path = require('path'); const vm = require('vm'); const filePath = path.resolve(__dirname, '../package/vmscript.js'); test('extract coverage', () => { const content = fs.readFileSync(filePath, {encoding: 'utf8'}); const case1 = vm.runInNewContext( content, { inputObject: { number: 0, }, }, { filename: filePath, }, ); const case2 = vm.runInNewContext( content, { inputObject: { number: 7, }, }, { filename: filePath, }, ); expect(case1).toBe(false); expect(case2).toBe(true); });