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]: Reduce of empty array with no initial value #11

Open
1 task
mmahut opened this issue Jan 24, 2023 · 1 comment
Open
1 task

[Bug]: Reduce of empty array with no initial value #11

mmahut opened this issue Jan 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@mmahut
Copy link

mmahut commented Jan 24, 2023

What happened?

Calling the main file works okay.

$ stepci run ./main.yml 
 PASS  blocks/487800d208d4cb43ef8d8a4ec162f479a76dbeee3b4c14295bd920d99d33e0c7

Tests: 0 failed, 1 passed, 1 total
Steps: 0 failed, 0 skipped, 1 passed, 1 total
Time:  0.149s, estimated 0s
CO2:   0.00024g

Workflow passed after 0.149s
Give us your feedback on https://step.ci/feedback

Calling a file that includes it does not:

$ cat workflow.yml
version: "1.1"
name: My tests
include:
 - main.yml
node_modules/@stepci/runner/dist/index.js:97
            co2: testResults.map(test => test.co2).reduce((a, b) => a + b)
                                                   ^

TypeError: Reduce of empty array with no initial value
    at Array.reduce (<anonymous>)
    at run (node_modules/@stepci/runner/dist/index.js:97:52)

What did you expect to happen?

To run my included workflow as does the main file.

Version

2.6.3

Environment

v16.16.0

How can we reproduce this bug?

See above.

Relevant log output

No response

Would you be interested in working on a bugfix for this issue?

  • Yes! Assign me
@mmahut mmahut added the bug Something isn't working label Jan 24, 2023
@mishushakov
Copy link
Member

mishushakov commented Jan 27, 2023

Interesting, but I cannot reproduce without seeing what's in that main.yml file 😔

Can you try to clone the repository "examples" folder and try running the "structure.yml" example?
Do you get any bugs?

Is there any specific directive you're using, that could cause the bug?
Does it only happen for the URL you're sending requests to, or all the URLs?

@mishushakov mishushakov transferred this issue from stepci/stepci Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants