Skip to content

Stencil generate: generated Spec Test .spec.tsx file with import component path #2396

Closed

Description

@elpupi

Stencil version:

 @stencil/core@@1.12.6

I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
stencil generate test-comp with Spec Test enabled as follow

? Which additional files do you want to generate? ›  
Instructions:
    ↑/↓: Highlight option
    ←/→/[space]: Toggle selection
    a: Toggle all
    enter/return: Complete answer
◉   Stylesheet (.css)
◉   Spec Test  (.spec.tsx)
◉   E2E Test (.e2e.ts)

will generate in src/components/test-component/test directory the test-comp.spec.tsx file with the following import statement:

import { TestComponent } from './mt-image';

Expected behavior:
It should be:

import { TestComponent } from '../mt-image'; // NOTE THE .. instead of .

Culprit:

In the file src/cli/tasks/task-generate.ts, the method getSpecTestBoilerplate has the following line:

import { ${toPascalCase(tagName)} } from './${tagName}';

It should be:

import { ${toPascalCase(tagName)} } from '../${tagName}';

Activity

  1. alexandertrefz commented on May 13, 2020

    @alexandertrefz

    For the love of god, dear stencil team. Stop breaking generate! This is a massive issue for existing code bases with loads of components that all need to be refactored to the new way of generate every time you change it, and you keep changing (and breaking!!!) it without ANY community communication! At least do the changes to generate in one fell swoop so we don't have to continually refactor all existing components! And document them in the changenotes!

  2. elpupi commented on May 13, 2020

    @elpupi
    Author

    @alexandertrefz is right. It would be nice a feature like Angular Schematics.

  3. tricki commented on Jun 12, 2020

    @tricki
    Contributor

    The import was fixed in #2486

  4. rwaskiewicz commented on Apr 19, 2022

    @rwaskiewicz
    Member

    Hey all, I'm closing this issue, as it was fixed in #2486, as @tricki pointed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions