mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
062623438b
* chore: use biome to sort imports * do the sorting * Update package.json Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
80 lines
1.7 KiB
JavaScript
80 lines
1.7 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
import { dependencies } from '../dist/index.js';
|
|
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);
|
|
});
|
|
});
|