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: --json flag no longer parsed properly for tests #3724

Closed
3 tasks done
rwaskiewicz opened this issue Oct 17, 2022 · 2 comments
Closed
3 tasks done

bug: --json flag no longer parsed properly for tests #3724

rwaskiewicz opened this issue Oct 17, 2022 · 2 comments
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@rwaskiewicz
Copy link
Member

Prerequisites

Stencil Version

2.18.1

Current Behavior

When running Stencil tests with the --json flag, previously, JSON would be output on a successful test run. With Stencil v2.18.1, it appears that this flag no longer works as expected - no output is created when tests are run with this flag.

Expected Behavior

JSON is output when stencil test --json is run with for a project.

This works on a project using v2.16:


npx stencil test --spec --json -- my-component.spec.ts
[36:14.5]  @stencil/core
[36:14.6]  v2.16.1 🎻
[36:14.7]  testing spec files
[36:14.7]  jest args: --json -- my-component.spec.ts --spec --max-workers=8
 PASS  src/components/my-component/my-component.spec.ts
  my-component
    ✓ renders (9 ms)
    ✓ renders with values (2 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.24 s, estimated 1 s
Ran all test suites matching /my-component.spec.ts|--spec|--max-workers=8/i.
{"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":1,"numPassedTests":2,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":1,"numTotalTests":2,"openHandles":[],"snapshot":{"added":0,"didUpdate":false,"failure":false,"filesAdded":0,"filesRemoved":0,"filesRemovedList":[],"filesUnmatched":0,"filesUpdated":0,"matched":0,"total":0,"unchecked":0,"uncheckedKeysByFile":[],"unmatched":0,"updated":0},"startTime":1666028175170,"success":true,"testResults":[{"assertionResults":[{"ancestorTitles":["my-component"],"failureMessages":[],"fullName":"my-component renders","location":null,"status":"passed","title":"renders"},{"ancestorTitles":["my-component"],"failureMessages":[],"fullName":"my-component renders with values","location":null,"status":"passed","title":"renders with values"}],"endTime":1666028175407,"message":"","name":"/private/tmp/json-test/src/components/my-component/my-component.spec.ts","startTime":1666028175184,"status":"passed","summary":""}],"wasInterrupted":false}

Steps to Reproduce

  1. Generate a new project using the create-stencil CLI: npm init stencil component json-test
  2. cd json-test && npm i to get dependencies
  3. Run:
npx stencil test --spec --json -- my-component.spec.ts
[56:20.5]  @stencil/core
[56:20.6]  v2.18.1 😛
[56:20.7]  testing spec files
[56:20.7]  jest args: -- my-component.spec.ts --spec --json --max-workers=8
 PASS  src/components/my-component/my-component.spec.ts
  my-component
    ✓ renders (10 ms)
    ✓ renders with values (2 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.264 s, estimated 1 s
Ran all test suites matching /my-component.spec.ts|--spec|--json|--max-workers=8/i.

Note the line at the end:

Ran all test suites matching /my-component.spec.ts|--spec|--json|--max-workers=8/i.

To see the program working:
2. npm i @stencil/core@2.16
3. Run:

npx stencil test --spec --json -- my-component.spec.ts
[57:44.0]  @stencil/core
[57:44.1]  v2.16.1 🎻
[57:44.2]  testing spec files
[57:44.2]  jest args: --json -- my-component.spec.ts --spec --max-workers=8
 PASS  src/components/my-component/my-component.spec.ts
  my-component
    ✓ renders (10 ms)
    ✓ renders with values (2 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.259 s, estimated 1 s
Ran all test suites matching /my-component.spec.ts|--spec|--max-workers=8/i.
{"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":1,"numPassedTests":2,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":1,"numTotalTests":2,"openHandles":[],"snapshot":{"added":0,"didUpdate":false,"failure":false,"filesAdded":0,"filesRemoved":0,"filesRemovedList":[],"filesUnmatched":0,"filesUpdated":0,"matched":0,"total":0,"unchecked":0,"uncheckedKeysByFile":[],"unmatched":0,"updated":0},"startTime":1666029464728,"success":true,"testResults":[{"assertionResults":[{"ancestorTitles":["my-component"],"failureMessages":[],"fullName":"my-component renders","location":null,"status":"passed","title":"renders"},{"ancestorTitles":["my-component"],"failureMessages":[],"fullName":"my-component renders with values","location":null,"status":"passed","title":"renders with values"}],"endTime":1666029464984,"message":"","name":"/private/tmp/json-test/src/components/my-component/my-component.spec.ts","startTime":1666029464751,"status":"passed","summary":""}],"wasInterrupted":false}

Note on 2.16, we got

Ran all test suites matching /my-component.spec.ts|--spec|--max-workers=8/i.

Code Reproduction URL

Stencil Component Starter

Additional Information

Originally seen in https://stencil-worldwide.slack.com/archives/C79EANFL7/p1666027278669499

@ionitron-bot ionitron-bot bot added the triage label Oct 17, 2022
@rwaskiewicz rwaskiewicz added the Bug: Validated This PR or Issue is verified to be a bug within Stencil label Oct 17, 2022
@ionitron-bot ionitron-bot bot removed the triage label Oct 17, 2022
@alicewriteswrongs alicewriteswrongs self-assigned this Oct 18, 2022
@alicewriteswrongs
Copy link
Contributor

A fix for this issue was merged in #3730 and will be included in the next release of Stencil.

@rwaskiewicz
Copy link
Member Author

This has been fixed in Stencil v2.19.0, which was just released. I'm going to close this issue as a result. If this bug should reappear, feel free to open a new issue. Thanks!

(Yes, I closed my own issue 😆)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

No branches or pull requests

2 participants