Skip to content
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

[Bug?]: Custom scaffold tests, mocks and stories are not generated #11754

Open
1 task done
esteban-url opened this issue Dec 7, 2024 · 0 comments · May be fixed by #11755
Open
1 task done

[Bug?]: Custom scaffold tests, mocks and stories are not generated #11754

esteban-url opened this issue Dec 7, 2024 · 0 comments · May be fixed by #11755
Labels
bug/needs-info More information is needed for reproduction

Comments

@esteban-url
Copy link
Contributor

What's not working?

I've set up my own generators, defined tests, stories and mocks for components and pages.
Right now the yarn rw g scaffold [model] command generates this files incorrectly:

I have this templates:

web/generators/scaffold/components/Name.mock.ts.template
web/generators/scaffold/components/Name.stories.tsx.template
web/generators/scaffold/components/Name.test.tsx.template
web/generators/scaffold/components/Name.tsx.template
web/generators/scaffold/pages/Name.stories.tsx.template
web/generators/scaffold/pages/Name.test.tsx.template
web/generators/scaffold/pages/Name.tsx.template

running the command yarn rw g scaffold Delivery generates this files, each in their own directory:

web/src/components/Delivery/Delivery/Delivery.tsx
web/src/components/Delivery/Delivery.mock.template/Delivery.mock.ts.template
web/src/components/Delivery/Delivery.stories/Delivery.stories.tsx
web/src/components/Delivery/Delivery.test/Delivery.test.tsx
web/src/pages/Delivery/DeliveryPage/DeliveryPage.tsx
web/src/pages/Delivery/DeliveryPage.test/DeliveryPage.test.tsx
web/src/pages/Delivery/DeliveryPage.stories/DeliveryPage.stories.tsx

I would expect the command to generate this:

web/src/components/Delivery/Delivery/Delivery.tsx
web/src/components/Delivery/Delivery/Delivery.mock.ts
web/src/components/Delivery/Delivery/Delivery.stories.tsx
web/src/components/Delivery/Delivery/Delivery.test.tsx
web/src/pages/Delivery/DeliveryPage/DeliveryPage.tsx
web/src/pages/Delivery/DeliveryPage/DeliveryPage.test.tsx
web/src/pages/Delivery/DeliveryPage/DeliveryPage.stories.tsx

How do we reproduce the bug?

  • create new project
  • setup custom scaffold generators
  • add test, mock, stories templates
  • generate scaffold

here is a repo that shows the bug, with the commits showing the steps taken: https://github.com/esteban-url/rw-custom-scaffold-templates/commits/main/

What's your environment? (If it applies)

System:
    OS: macOS 15.1.1
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - /private/var/folders/58/mr9bhzsn31q4xtlt4l_r9y940000gn/T/xfs-d8471f42/node
    Yarn: 4.4.0 - /private/var/folders/58/mr9bhzsn31q4xtlt4l_r9y940000gn/T/xfs-d8471f42/yarn
  Databases:
    SQLite: 3.43.2 - /usr/bin/sqlite3
  Browsers:
    Chrome: 131.0.6778.109
    Safari: 18.1.1
  npmPackages:
    @redwoodjs/auth-dbauth-setup: 8.4.1 => 8.4.1 
    @redwoodjs/core: 8.4.1 => 8.4.1 
    @redwoodjs/project-config: 8.4.1 => 8.4.1 
    @redwoodjs/realtime: 8.4.1 => 8.4.1 
    @redwoodjs/studio: 12 => 12.0.0 
  redwood.toml:
    [web]
      title = "apps"
      port = "${WEB_PORT:8910}"
      apiUrl = "/api" # You can customize graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths
      includeEnvironmentVariables = [
        # Add any ENV vars that should be available to the web side to this array
        # See https://redwoodjs.com/docs/environment-variables#web
      ]
    [api]
      port = "${API_PORT:8911}"
    [browser]
      open = false
    [notifications]
      versionUpdates = ["latest"]
    [experimental.opentelemetry]
        enabled = true
        wrapApi = true
    [studio.graphiql.authImpersonation]
      authProvider = "dbAuth"
      email = "[email protected]"
      userId = "3"

Are you interested in working on this?

  • I'm interested in working on this
@esteban-url esteban-url added the bug/needs-info More information is needed for reproduction label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant