diff --git a/dev/aliases.cjs b/dev/aliases.cjs index cb1c599c248..8e2eef55163 100644 --- a/dev/aliases.cjs +++ b/dev/aliases.cjs @@ -18,6 +18,7 @@ const devAliases = { // because they will be escaped by the jest config '@sanity/block-tools': './packages/@sanity/block-tools/src', '@sanity/diff': './packages/@sanity/diff/src', + '@sanity/cli': './packages/@sanity/cli/src', '@sanity/mutator': './packages/@sanity/mutator/src', '@sanity/portable-text-editor': './packages/@sanity/portable-text-editor/src', '@sanity/schema': './packages/@sanity/schema/src/_exports', diff --git a/packages/sanity/src/_internal/cli/threads/__tests__/validateDocuments.test.ts b/packages/sanity/src/_internal/cli/threads/__tests__/validateDocuments.test.ts index 76e571866ed..18a6edc83e1 100644 --- a/packages/sanity/src/_internal/cli/threads/__tests__/validateDocuments.test.ts +++ b/packages/sanity/src/_internal/cli/threads/__tests__/validateDocuments.test.ts @@ -2,8 +2,10 @@ import {afterAll, beforeAll, describe, expect, it, jest} from '@jest/globals' import {type SanityDocument, type SanityProject} from '@sanity/client' import {evaluate, parse} from 'groq-js' import {createServer, type Server} from 'http' +import path from 'path' import {Worker} from 'worker_threads' +import {getAliases} from '../../server/aliases' import {createReceiver, type WorkerChannelReceiver} from '../../util/workerChannels' import {type ValidateDocumentsWorkerData, type ValidationWorkerChannel} from '../validateDocuments' @@ -198,8 +200,11 @@ describe('validateDocuments', () => { const worker = new Worker( ` + const moduleAlias = require('module-alias') const { register } = require('esbuild-register/dist/node') + moduleAlias.addAliases(${JSON.stringify(getAliases({monorepo: {path: path.resolve(__dirname, '../../../../../../..')}}))}) + const { unregister } = register({ target: 'node18', format: 'cjs',