/
githubmirror
/
jest
Обзор
Документация
Войти
/
githubmirror
/
jest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
e2e/__tests__/coverageTransformInstrumented.test.ts
37 строк
1 KB
Simen Bekkhus
chore: use consistent casing in escape characters (#14806)
29 дек 2023, 19:15
Не верифицирован
29 дек 2023, 19:15
90ef733
Код
Авторство
О чём код?
/** * 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. */ import * as path from 'path'; import {readFileSync} from 'graceful-fs'; import {cleanup, runYarnInstall} from '../Utils'; import runJest from '../runJest'; const dir = path.resolve(__dirname, '../coverage-transform-instrumented'); const coverageDir = path.join(dir, 'coverage'); beforeAll(() => { cleanup(coverageDir); }); it('code coverage for transform instrumented code', () => { runYarnInstall(dir); const result = runJest(dir, ['--coverage', '--no-cache']); expect(result.exitCode).toBe(0); const coverageMapFile = path.join(coverageDir, 'coverage-final.json'); const coverageMap = JSON.parse(readFileSync(coverageMapFile, 'utf8')); // reduce absolute paths embedded in the coverage map to just filenames for (const filename of Object.keys(coverageMap)) { coverageMap[filename].path = path.basename(coverageMap[filename].path); delete coverageMap[filename].hash; coverageMap[path.basename(filename)] = coverageMap[filename]; delete coverageMap[filename]; } expect(coverageMap).toMatchSnapshot(); });