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

Component schematics produces test file in different directory #611

Open
MikeDabrowski opened this issue May 30, 2023 · 6 comments
Open

Comments

@MikeDabrowski
Copy link

MikeDabrowski commented May 30, 2023

Is this a regression?

No

Description

Is it intended that running ng g @ngneat/spectator:spectator-component test-help produces:

image

with the test file being in a different directory?
The following line does that:

const movePath = options.flat ? (options.path as string) : normalize(options.path + '/' + strings.dasherize(options.name) || '');

When executing the options.path points to /src/app and if options.flat is true then movePath becomes /src/app/test-help.

If it is intended - how to opt-out and follow the same convention as angular has?
If it is NOT intended - one way to fix this would be to copy the path generating mechanism from angular schematics.

Do you want to create a pull request?

Yes

@screambeard
Copy link

i'm facing the same issue since a couple of weeks

@Sk0vgaard
Copy link

Sk0vgaard commented Nov 3, 2023

Facing same issue... In generel it is always adding the .spec file to the app folder for some reason.

Its seems like it only applies for the @ngneat/spactator:spectator-(component/directive, etc), where "jest" has been set to true:

    "@ngneat/spectator:spectator-component": {
      "jest": true
    },

Could it be because of Angular 15+?

Edit: I have now tried to roll back to v14 from v16 and it seems to work with earlier versions... I rolled back using angular v14.2.10 and "@ngneat/spectator": "^12.0.1",

@JabCorp
Copy link

JabCorp commented Nov 28, 2023

Facing same issue but it's not only when jest parameter is set to true.

@WillBoig
Copy link

I have the same issue and I'm not using jest

@JabCorp
Copy link

JabCorp commented Feb 7, 2024

Some workaround

    "@ngneat/spectator:spectator-component": {
      "jest": true,
      "flat": false
    },

@WillBoig
Copy link

WillBoig commented Jun 27, 2024

This problem applies to every schema that I have tested so far (directive, component, pipe, service). I'm willing to help out and I know where to look for a fix but so far I'm unable to produce a clean solution.

Tested on the latest release of spectator

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

No branches or pull requests

5 participants