/
githubmirror
/
yarn
Обзор
Документация
Войти
/
githubmirror
/
yarn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
__tests__/hooks.js
43 строки
1 KB
Maël Nison
feat(install): Implement a very basic hook system (#5293)
02 фев 2018, 21:39
Не верифицирован
02 фев 2018, 21:39
aee005a
Код
Авторство
О чём код?
/* @flow */ import {runInstall} from './commands/_helpers.js'; test('install should call the resolveStep hook', async () => { global.experimentalYarnHooks = { resolveStep: jest.fn(cb => cb()), }; await runInstall({}, 'install-production', config => { expect(global.experimentalYarnHooks.resolveStep.mock.calls.length).toEqual(1); }); delete global.experimentalYarnHooks; }); test('install should call the fetchStep hook', async () => { global.experimentalYarnHooks = { fetchStep: jest.fn(cb => cb()), }; await runInstall({}, 'install-production', config => { expect(global.experimentalYarnHooks.fetchStep.mock.calls.length).toEqual(1); }); delete global.experimentalYarnHooks; }); test('install should call the linkStep hook', async () => { global.experimentalYarnHooks = { linkStep: jest.fn(cb => cb()), }; await runInstall({}, 'install-production', config => { expect(global.experimentalYarnHooks.linkStep.mock.calls.length).toEqual(1); }); delete global.experimentalYarnHooks; }); test('install should call the buildStep hook', async () => { global.experimentalYarnHooks = { buildStep: jest.fn(cb => cb()), }; await runInstall({}, 'install-production', config => { expect(global.experimentalYarnHooks.buildStep.mock.calls.length).toEqual(1); }); delete global.experimentalYarnHooks; });