<commit_before>import * as path from 'path';
import { getGlobalVariable } from '../../utils/env';
import { exec, execAndWaitForOutputToMatch, silentNpm } from '../../utils/process';
import { rimraf } from '../../utils/fs';

export default async function () {
  // setup
  const argv = getGlobalVariable('argv');
  if (argv.noglobal) {
    return;
  }

  await silentNpm(
    'install',
    '-g',
    '@angular-devkit/schematics-cli',
    '--registry=http://localhost:4873',
  );
  await exec(process.platform.startsWith('win') ? 'where' : 'which', 'schematics');

  const startCwd = process.cwd();
  const schematicPath = path.join(startCwd, 'test-schematic');

  try {
    // create blank schematic
    await exec('schematics', 'schematic', '--name', 'test-schematic');

    process.chdir(path.join(startCwd, 'test-schematic'));
    await execAndWaitForOutputToMatch(
      'schematics',
      ['.:', '--list-schematics'],
      /my-full-schematic/,
    );
<commit_msg>test: ensure schematics CLI E2E tests use local package registry<commit_after>import * as path from 'path';
import { getGlobalVariable } from '../../utils/env';
import { exec, execAndWaitForOutputToMatch, silentNpm } from '../../utils/process';
import { rimraf } from '../../utils/fs';

export default async function () {
  // setup
  const argv = getGlobalVariable('argv');
  if (argv.noglobal) {
    return;
  }

  process.env['NPM_CONFIG_REGISTRY'] = 'http://localhost:4873';

  await silentNpm(
    'install',
    '-g',
    '@angular-devkit/schematics-cli',
    '--registry=http://localhost:4873',
  );
  await exec(process.platform.startsWith('win') ? 'where' : 'which', 'schematics');

  const startCwd = process.cwd();
  const schematicPath = path.join(startCwd, 'test-schematic');

  try {
    // create blank schematic
    await exec('schematics', 'schematic', '--name', 'test-schematic');

    process.chdir(path.join(startCwd, 'test-schematic'));
    await execAndWaitForOutputToMatch(
      'schematics',
      ['.:', '--list-schematics'],
      /my-full-schematic/,
    );

{'fraction_non_alphanumeric': 0.17801556420233464, 'fraction_numerical': 0.00632295719844358, 'mean_word_length': 3.4427645788336934, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6433841', 'n_tokens_mistral': 682, 'n_tokens_neox': 665, 'n_words': 139}