From 72e752d04870b61a5a96fe51f2227cb939d26d97 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Wed, 18 Dec 2024 22:51:50 -0800 Subject: [PATCH] Use `@nx.js/inspect` for REPL tests --- packages/repl/package.json | 1 + packages/repl/test/repl.test.ts | 12 +++++------- pnpm-lock.yaml | 3 +++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/repl/package.json b/packages/repl/package.json index 652faa66..c2fd0154 100644 --- a/packages/repl/package.json +++ b/packages/repl/package.json @@ -26,6 +26,7 @@ "sisteransi": "^1.0.5" }, "devDependencies": { + "@nx.js/inspect": "workspace:*", "@nx.js/runtime": "workspace:*", "vite": "^5.4.2", "vitest": "^2.0.5" diff --git a/packages/repl/test/repl.test.ts b/packages/repl/test/repl.test.ts index 6b69e903..f6049634 100644 --- a/packages/repl/test/repl.test.ts +++ b/packages/repl/test/repl.test.ts @@ -1,13 +1,11 @@ -import util from 'node:util'; +import { createInspect } from '@nx.js/inspect'; import { describe, expect, test } from 'vitest'; import { REPL, type REPLOptions } from '../src/index'; const encoder = new TextEncoder(); const opts: REPLOptions = { - inspect(v: unknown): string { - return util.inspect(v); - }, + inspect: createInspect(), }; describe('REPL', () => { @@ -61,10 +59,10 @@ describe('REPL', () => { chunk = await reader.read(); expect(chunk.value).toMatchInlineSnapshot(` - "2 + "2 - " - `); + " + `); expect(globalThis._).toBe(2); }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 29c96b84..8ca7e5ac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -673,6 +673,9 @@ importers: specifier: ^1.0.5 version: 1.0.5 devDependencies: + '@nx.js/inspect': + specifier: workspace:* + version: link:../inspect '@nx.js/runtime': specifier: workspace:* version: link:../runtime