diff --git a/docs/generated/packages/react/generators/library.json b/docs/generated/packages/react/generators/library.json index 9fa76aa2de8e5..b2a20b39fe6b2 100644 --- a/docs/generated/packages/react/generators/library.json +++ b/docs/generated/packages/react/generators/library.json @@ -80,7 +80,8 @@ "unitTestRunner": { "type": "string", "enum": ["jest", "vitest", "none"], - "description": "Test runner to use for unit tests." + "description": "Test runner to use for unit tests.", + "x-prompt": "What unit test runner should be used?" }, "inSourceTests": { "type": "boolean", diff --git a/packages/react/package.json b/packages/react/package.json index f51f4f52c7622..d0fe3976d10fc 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -36,7 +36,6 @@ "@nrwl/workspace": "file:../workspace", "@phenomnomnominal/tsquery": "4.1.1", "chalk": "^4.1.0", - "enquirer": "~2.3.6", "minimatch": "3.0.5", "semver": "7.3.4" }, diff --git a/packages/react/src/generators/component-test/component-test.spec.ts b/packages/react/src/generators/component-test/component-test.spec.ts index c752f4d2468a5..88b05bb7ebe3f 100644 --- a/packages/react/src/generators/component-test/component-test.spec.ts +++ b/packages/react/src/generators/component-test/component-test.spec.ts @@ -14,9 +14,6 @@ describe(componentTestGenerator.name, () => { > = assertMinimumCypressVersion as never; beforeEach(() => { tree = createTreeWithEmptyV1Workspace(); - jest - .spyOn(enquirer, 'prompt') - .mockReturnValue(new Promise((res) => res({ runner: 'jest' }))); }); it('should create component test for tsx files', async () => { mockedAssertMinimumCypressVersion.mockReturnValue(); diff --git a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts index 09c545f78cf83..5fa7dae1861be 100644 --- a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts +++ b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.spec.ts @@ -30,9 +30,6 @@ describe('React:CypressComponentTestConfiguration', () => { > = assertMinimumCypressVersion as never; beforeEach(() => { tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); - jest - .spyOn(enquirer, 'prompt') - .mockReturnValue(new Promise((res) => res({ runner: 'jest' }))); }); it('should generate cypress config with vite', async () => { diff --git a/packages/react/src/generators/library/library.spec.ts b/packages/react/src/generators/library/library.spec.ts index 754985088e7f3..9b10d2bb48ef1 100644 --- a/packages/react/src/generators/library/library.spec.ts +++ b/packages/react/src/generators/library/library.spec.ts @@ -371,9 +371,6 @@ describe('lib', () => { describe('--unit-test-runner none', () => { it('should not generate test configuration', async () => { - jest - .spyOn(enquirer, 'prompt') - .mockReturnValue(new Promise((res) => res({ runner: 'none' }))); await libraryGenerator(tree, { ...defaultSchema, unitTestRunner: 'none', diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts index 12b8ded58f5a7..5eef3bca9eede 100644 --- a/packages/react/src/generators/library/library.ts +++ b/packages/react/src/generators/library/library.ts @@ -23,26 +23,11 @@ import { createFiles } from './lib/create-files'; import { updateBaseTsConfig } from './lib/update-base-tsconfig'; import { extractTsConfigBase } from '../../utils/create-ts-config'; import { installCommonDependencies } from './lib/install-common-dependencies'; -import { prompt } from 'enquirer'; import { setDefaults } from './lib/set-defaults'; export async function libraryGenerator(host: Tree, schema: Schema) { const tasks: GeneratorCallback[] = []; - // Check if unit test runner was provided or if we have a default - if (!schema.unitTestRunner) { - schema.unitTestRunner = ( - await prompt<{ runner: 'vitest' | 'jest' | 'none' }>([ - { - message: 'What unit test runner should be used?', - type: 'select', - name: 'runner', - choices: ['vitest', 'jest', 'none'], - }, - ]) - ).runner; - } - const options = normalizeOptions(host, schema); if (options.publishable === true && !schema.importPath) { throw new Error( diff --git a/packages/react/src/generators/library/schema.json b/packages/react/src/generators/library/schema.json index 297694725977f..a76f03090a818 100644 --- a/packages/react/src/generators/library/schema.json +++ b/packages/react/src/generators/library/schema.json @@ -83,7 +83,8 @@ "unitTestRunner": { "type": "string", "enum": ["jest", "vitest", "none"], - "description": "Test runner to use for unit tests." + "description": "Test runner to use for unit tests.", + "x-prompt": "What unit test runner should be used?" }, "inSourceTests": { "type": "boolean", diff --git a/packages/react/src/generators/stories/stories.lib.spec.ts b/packages/react/src/generators/stories/stories.lib.spec.ts index 20e43daa8cbcc..58b87eb1b34d9 100644 --- a/packages/react/src/generators/stories/stories.lib.spec.ts +++ b/packages/react/src/generators/stories/stories.lib.spec.ts @@ -10,9 +10,6 @@ describe('react:stories for libraries', () => { let appTree: Tree; beforeEach(async () => { - jest - .spyOn(enquirer, 'prompt') - .mockReturnValue(new Promise((res) => res({ runner: 'jest' }))); appTree = await createTestUILib('test-ui-lib'); // create another component diff --git a/packages/react/src/generators/storybook-configuration/configuration.spec.ts b/packages/react/src/generators/storybook-configuration/configuration.spec.ts index 793f50f912040..1f33dbbc5dc1d 100644 --- a/packages/react/src/generators/storybook-configuration/configuration.spec.ts +++ b/packages/react/src/generators/storybook-configuration/configuration.spec.ts @@ -25,9 +25,6 @@ describe('react:storybook-configuration', () => { mockedInstalledCypressVersion.mockReturnValue(10); jest.spyOn(logger, 'warn').mockImplementation(() => {}); jest.spyOn(logger, 'debug').mockImplementation(() => {}); - jest - .spyOn(enquirer, 'prompt') - .mockReturnValue(new Promise((res) => res({ runner: 'jest' }))); }); afterEach(() => {