1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import assert from 'node:assert/strict';
- import { dependencies } from '../dist/index.js';
- import { describe, it } from 'node:test';
- import { setup } from './utils.js';
- describe('dependencies', () => {
- const fixture = setup();
- it('--yes', async () => {
- const context = {
- cwd: '',
- yes: true,
- packageManager: 'npm',
- dryRun: true,
- prompt: () => ({ deps: true }),
- };
- await dependencies(context);
- assert.ok(fixture.hasMessage('Skipping dependency installation'));
- });
- it('prompt yes', async () => {
- const context = {
- cwd: '',
- packageManager: 'npm',
- dryRun: true,
- prompt: () => ({ deps: true }),
- install: undefined,
- };
- await dependencies(context);
- assert.ok(fixture.hasMessage('Skipping dependency installation'));
- assert.equal(context.install, true);
- });
- it('prompt no', async () => {
- const context = {
- cwd: '',
- install: true,
- packageManager: 'npm',
- dryRun: true,
- prompt: () => ({ deps: false }),
- install: undefined,
- };
- await dependencies(context);
- assert.ok(fixture.hasMessage('Skipping dependency installation'));
- assert.equal(context.install, false);
- });
- it('--install', async () => {
- const context = {
- cwd: '',
- install: true,
- packageManager: 'npm',
- dryRun: true,
- prompt: () => ({ deps: false }),
- };
- await dependencies(context);
- assert.ok(fixture.hasMessage('Skipping dependency installation'));
- assert.equal(context.install, true);
- });
- it('--no-install ', async () => {
- const context = {
- cwd: '',
- install: false,
- packageManager: 'npm',
- dryRun: true,
- prompt: () => ({ deps: false }),
- };
- await dependencies(context);
- assert.ok(fixture.hasMessage('Skipping dependency installation'));
- assert.equal(context.install, false);
- });
- });
|