MCPcopy Create free account
hub / github.com/nodejs/node / mockWorkspaces

Function mockWorkspaces

deps/npm/test/lib/commands/ls.js:1534–1623  ·  view source on GitHub ↗
(t, exec = [], config = {})

Source from the content-addressed store, hash-verified

1532
1533 t.test('loading a tree containing workspaces', async t => {
1534 const mockWorkspaces = async (t, exec = [], config = {}) => {
1535 const { result, ls } = await mockLs(t, {
1536 config,
1537 prefixDir: {
1538 'package.json': JSON.stringify({
1539 name: 'workspaces-tree',
1540 version: '1.0.0',
1541 workspaces: ['./a', './b', './d', './group/*'],
1542 dependencies: { pacote: '1.0.0' },
1543 }),
1544 node_modules: {
1545 a: t.fixture('symlink', '../a'),
1546 b: t.fixture('symlink', '../b'),
1547 c: {
1548 'package.json': JSON.stringify({
1549 name: 'c',
1550 version: '1.0.0',
1551 }),
1552 },
1553 d: t.fixture('symlink', '../d'),
1554 e: t.fixture('symlink', '../group/e'),
1555 f: t.fixture('symlink', '../group/f'),
1556 foo: {
1557 'package.json': JSON.stringify({
1558 name: 'foo',
1559 version: '1.1.1',
1560 dependencies: {
1561 bar: '^1.0.0',
1562 },
1563 }),
1564 },
1565 bar: {
1566 'package.json': JSON.stringify({ name: 'bar', version: '1.0.0' }),
1567 },
1568 baz: {
1569 'package.json': JSON.stringify({ name: 'baz', version: '1.0.0' }),
1570 },
1571 pacote: {
1572 'package.json': JSON.stringify({ name: 'pacote', version: '1.0.0' }),
1573 },
1574 },
1575 a: {
1576 'package.json': JSON.stringify({
1577 name: 'a',
1578 version: '1.0.0',
1579 dependencies: {
1580 c: '^1.0.0',
1581 d: '^1.0.0',
1582 },
1583 devDependencies: {
1584 baz: '^1.0.0',
1585 },
1586 }),
1587 },
1588 b: {
1589 'package.json': JSON.stringify({
1590 name: 'b',
1591 version: '1.0.0',

Callers 1

ls.jsFile · 0.70

Calls 4

mockLsFunction · 0.85
cleanCwdFunction · 0.85
resultFunction · 0.85
execMethod · 0.45

Tested by

no test coverage detected