Skip to main content
Glama
nrwl

Nx MCP Server

Official
by nrwl
generator-context.cy.ts1.95 kB
import { GeneratorSchema } from '@nx-console/shared-generate-ui-types'; import { expectConsoleLogToHaveBeenCalledWith, spyOnConsoleLog, } from '../support/console-spy'; import { getFieldByName } from '../support/get-elements'; import { visitGenerateUi } from '../support/visit-generate-ui'; const schemaProj: GeneratorSchema = { collectionName: '@nx/test', generatorName: 'test', description: 'description', options: [ { name: 'project', isRequired: true, aliases: [], items: ['project1', 'project2', 'project3'], }, ], context: { project: 'project3', directory: 'nested/nested2', prefillValues: { project: 'project3', }, }, }; describe('generator context', () => { it('should correctly use the context to prefill values', () => { visitGenerateUi(schemaProj); getFieldByName('project').should('have.value', 'project3'); spyOnConsoleLog().then((consoleLog: any) => { cy.get("[data-cy='generate-button']").click(); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); expectConsoleLogToHaveBeenCalledWith(consoleLog, '--project=project3'); }); }); const schemaFixed: GeneratorSchema = { collectionName: '@nx/test', generatorName: 'test', description: 'description', options: [ { name: 'project', isRequired: false, aliases: [], items: ['project1', 'project2', 'project3'], }, ], context: { fixedFormValues: { sample: 'value', }, }, }; it('should use fixed form value and use them to construct the generate command', () => { visitGenerateUi(schemaFixed); spyOnConsoleLog().then((consoleLog: any) => { cy.get("[data-cy='generate-button']").click(); expectConsoleLogToHaveBeenCalledWith(consoleLog, 'run-generator'); expectConsoleLogToHaveBeenCalledWith(consoleLog, '--sample=value'); }); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nrwl/nx-console'

If you have feedback or need assistance with the MCP directory API, please join our Discord server