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

Function mockWorkspaces

deps/npm/test/lib/commands/explain.js:180–253  ·  view source on GitHub ↗
(t, exec = [], workspaces = true)

Source from the content-addressed store, hash-verified

178
179t.test('workspaces', async t => {
180 const mockWorkspaces = async (t, exec = [], workspaces = true) => {
181 const mock = await mockExplain(t, {
182 prefixDir: {
183 'package.json': JSON.stringify({
184 name: 'workspaces-project',
185 version: '1.0.0',
186 workspaces: ['packages/*'],
187 dependencies: {
188 abbrev: '^1.0.0',
189 },
190 }),
191 node_modules: {
192 a: t.fixture('symlink', '../packages/a'),
193 b: t.fixture('symlink', '../packages/b'),
194 c: t.fixture('symlink', '../packages/c'),
195 once: {
196 'package.json': JSON.stringify({
197 name: 'once',
198 version: '1.0.0',
199 dependencies: {
200 wrappy: '2.0.0',
201 },
202 }),
203 },
204 abbrev: {
205 'package.json': JSON.stringify({
206 name: 'abbrev',
207 version: '1.0.0',
208 }),
209 },
210 wrappy: {
211 'package.json': JSON.stringify({
212 name: 'wrappy',
213 version: '2.0.0',
214 }),
215 },
216 },
217 packages: {
218 a: {
219 'package.json': JSON.stringify({
220 name: 'a',
221 version: '1.0.0',
222 dependencies: {
223 once: '1.0.0',
224 },
225 }),
226 },
227 b: {
228 'package.json': JSON.stringify({
229 name: 'b',
230 version: '1.0.0',
231 dependencies: {
232 abbrev: '^1.0.0',
233 },
234 }),
235 },
236 c: {
237 'package.json': JSON.stringify({

Callers 1

explain.jsFile · 0.70

Calls 2

mockExplainFunction · 0.85
execMethod · 0.45

Tested by

no test coverage detected