File: hooks.js

package info (click to toggle)
node-yarnpkg 1.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 92,980 kB
  • sloc: sh: 323; makefile: 19
file content (43 lines) | stat: -rw-r--r-- 1,367 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* @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;
});