mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
3007d24c98
* chore: Migrate All packages/create-astro/test to node:test * Some minor fix * Requested Changes done * Reopen * Apply suggestions from code review * let's test with concurrency * chore: fix possible false positive tests * todo test * skip tests * Apply suggestions from code review --------- Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
80 lines
1.7 KiB
JavaScript
80 lines
1.7 KiB
JavaScript
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);
|
|
});
|
|
});
|