MCPcopy
hub / github.com/TypeStrong/ts-node / createReplViaApi

Function createReplViaApi

src/test/repl/helpers.ts:33–61  ·  view source on GitHub ↗
({
    registerHooks,
    createReplOpts,
    createServiceOpts,
  }: CreateReplViaApiOptions)

Source from the content-addressed store, hash-verified

31 return { createReplViaApi, executeInRepl };
32
33 function createReplViaApi({
34 registerHooks,
35 createReplOpts,
36 createServiceOpts,
37 }: CreateReplViaApiOptions) {
38 const stdin = new PassThrough();
39 const stdout = new PassThrough();
40 const stderr = new PassThrough();
41 const replService = tsNodeUnderTest.createRepl({
42 stdin,
43 stdout,
44 stderr,
45 ...createReplOpts,
46 });
47 const service = (
48 registerHooks ? tsNodeUnderTest.register : tsNodeUnderTest.create
49 )({
50 ...replService.evalAwarePartialHost,
51 project: `${TEST_DIR}/tsconfig.json`,
52 ...createServiceOpts,
53 tsTrace: replService.console.log.bind(replService.console),
54 });
55 replService.setService(service);
56 t.teardown(async () => {
57 service.enabled(false);
58 });
59
60 return { stdin, stdout, stderr, replService, service };
61 }
62
63 async function executeInRepl(input: string, options: ExecuteInReplOptions) {
64 const {

Callers 1

executeInReplFunction · 0.85

Calls 2

setServiceMethod · 0.80
enabledMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…