Skip to content

fix(cli): correct Redis datasource name in test-helper, nycrc, and datasource files #2286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Tyagi-Sunny
Copy link
Contributor

@Tyagi-Sunny Tyagi-Sunny commented Jun 21, 2025

changes made are as follows:

  • Fixed incorrect Redis datasource name in test-helper.ts
  • Ensured proper naming in generated datasource files
  • Corrected .nycrc file generation

#2285

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Intermediate change (work in progress)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • Performed a self-review of my own code
  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Any dependent changes have been merged and published in downstream modules

…tasource files

correct Redis datasource name in test-helper, nycrc, and datasource files

2285
@Tyagi-Sunny Tyagi-Sunny requested a review from a team as a code owner June 21, 2025 06:56
@rohit-sourcefuse rohit-sourcefuse requested a review from Copilot June 23, 2025 06:31
Copilot

This comment was marked as outdated.

@rohit-sourcefuse rohit-sourcefuse requested a review from Copilot June 23, 2025 07:24
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the incorrect Redis datasource naming in various templates and configuration files. It updates the test-helper to correctly bind the Redis or Auth cache datasource, refines the .nycrc configuration, and adjusts datasource template injection to rely on the new naming conventions.

  • Updated test-helper.ts to build the correct import mappings and binding configurations.
  • Refined the datasource templates (redis.datasource.ts.tpl and name.datasource.ts.tpl) to choose the correct datasource name based on project properties.
  • Adjusted the .nycrc configuration file to use a stricter coverage check.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/cli/src/generators/microservice/templates/src/tests/acceptance/test-helper.ts.ejs Adjusted dynamic import mapping and binding for Redis/Auth datasource based on project configuration.
packages/cli/src/generators/microservice/templates/.nycrc Revised configuration settings to improve coverage reporting.
packages/cli/src/generators/microservice/index.ts Corrected assignment of baseServiceCacheName using a fallback to 'redis' when necessary.
packages/cli/src/generators/datasource/templates/redis.datasource.ts.tpl Updated template to use the correct datasource name from project properties.
packages/cli/src/generators/datasource/templates/name.datasource.ts.tpl Modified template to select between a configured store name and a default value.

Copy link
Contributor

@a-ganguly a-ganguly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved



<% if (project.facade || project.baseServiceCacheName) { -%>
<% if (project.serviceDependency && project.baseServiceCacheName ) { -%>
app.bind(`datasources.config.${<%= project.baseServiceCacheName %>}`).to({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we are binding redis anyways on line 84? do we still need it?

<%
const importMap = {};

if (project.baseServiceDSList) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this logic in template? this should be in the generator

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants