/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/npm/test/lib/utils/explain-eresolve.js
31 строка
1 KB
npm CLI robot
deps: upgrade npm to 9.7.1
08 июн 2023, 15:24
Не верифицирован
08 июн 2023, 15:24
8c8e7e9
Код
Авторство
О чём код?
const t = require('tap') const { explain, report } = require('../../../lib/utils/explain-eresolve.js') const cases = require('../../fixtures/eresolve-explanations.js') t.test('basic', async t => { const { Chalk } = await import('chalk') const color = new Chalk({ level: 3 }) const noColor = new Chalk({ level: 0 }) for (const [name, expl] of Object.entries(cases)) { // no sense storing the whole contents of each object in the snapshot // we can trust that JSON.stringify still works just fine. expl.toJSON = () => ({ name, json: true }) t.test(name, t => { const colorReport = report(expl, color, noColor) t.matchSnapshot(colorReport.explanation, 'report with color') t.matchSnapshot(colorReport.file, 'report from color') const noColorReport = report(expl, noColor, noColor) t.matchSnapshot(noColorReport.explanation, 'report with no color') t.equal(noColorReport.file, colorReport.file, 'same report written for object') t.matchSnapshot(explain(expl, color, 2), 'explain with color, depth of 2') t.matchSnapshot(explain(expl, noColor, 6), 'explain with no color, depth of 6') t.end() }) } })