1
0
mirror of synced 2026-03-28 08:20:50 +00:00

fix(CLI): allow scoped npm package names

switch to npm's validate-npm-package-name internally

Fixes #68
This commit is contained in:
Jason Dreyzehner
2018-03-13 20:40:37 -04:00
parent 0bb76c24e6
commit 83fdc67c50
5 changed files with 26 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ import {
install,
Placeholders
} from '../tasks';
import { getIntro, Runner } from '../utils';
import { getIntro, Runner, validateName } from '../utils';
test('errors if outdated', async t => {
nock.disableNetConnect();
@@ -101,6 +101,12 @@ test('checkArgs always returns { install } (so --no-install works in interactive
t.deepEqual(opts, { install: true });
});
test('only accepts valid package names', async t => {
t.true(validateName('package-name'));
t.true(validateName('package-name-2'));
t.true(validateName('@example/package-name-2'));
});
test('ascii art shows if stdout has 85+ columns', async t => {
const jumbo = getIntro(100);
const snippet = `| __| | | | '_ \\ / _ \\/ __|/ __| '__| | '_ \\|`;