/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/env/lib/test/execute-lifecycle-script.js
56 строк
1 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
'use strict'; /* eslint-disable jest/no-conditional-expect */ const { LifecycleScriptError, executeLifecycleScript, } = require( '../execute-lifecycle-script' ); describe( 'executeLifecycleScript', () => { const spinner = { info: jest.fn(), }; afterEach( () => { jest.clearAllMocks(); } ); it( 'should do nothing without event option when debugging', async () => { await executeLifecycleScript( 'test', { lifecycleScripts: { test: null }, debug: true }, spinner ); expect( spinner.info ).not.toHaveBeenCalled(); } ); it( 'should run event option and print output when debugging', async () => { await executeLifecycleScript( 'test', { lifecycleScripts: { test: 'node -v' }, debug: true }, spinner ); expect( spinner.info ).toHaveBeenCalledWith( expect.stringMatching( /test Script:\nv[0-9]/ ) ); } ); it( 'should throw LifecycleScriptError when process errors', async () => { try { await executeLifecycleScript( 'test', { lifecycleScripts: { test: 'node -vvvvvvv', }, }, spinner ); } catch ( error ) { expect( error ).toBeInstanceOf( LifecycleScriptError ); expect( error.message ).toMatch( /test Error:\n.*bad option/ ); } } ); } ); /* eslint-enable jest/no-conditional-expect */