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

Create outputDir directory in case it doesn't exist #3389

Closed
nami-varthakavi opened this issue Jan 22, 2019 · 9 comments
Closed

Create outputDir directory in case it doesn't exist #3389

nami-varthakavi opened this issue Jan 22, 2019 · 9 comments
Labels
Enhancement good first pick a reasonable task to start getting familiar with the code base help wanted Issues that are free to take by anyone interested

Comments

@nami-varthakavi
Copy link
Contributor

On a fresh start of running the tests, we expect the WDIO tester runner will be creating the folder mentioned in the outputDir arg for allure.
This is how I provided in the config file,

reporters: [
        'spec',
        ['allure', {
            outputDir: './test-reporters/allure-results'
        }]
    ]

On running my test I get the following error

[0-0] events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: ENOENT: no such file or directory, open 'C:\path\to\my\package\test-reports\allure-results\wdio-0-0-allure-reporter.log'

I also tried giving the default value like this

reporters: [
        'spec',
        ['allure', {
            outputDir: 'allure-results'
        }]
    ]

but the error persists.

@christian-bromann
Copy link
Member

@nami-varthakavi if the directory doesn't exist it can't put files in there. I would agree however that wdio should create the folder in case it doesn't exit.

@christian-bromann christian-bromann changed the title Adding an 'outputDir' to the 'allure' args throws an error Create outputDir directory in case it doesn't exist Jan 22, 2019
@christian-bromann christian-bromann added Enhancement help wanted Issues that are free to take by anyone interested good first pick a reasonable task to start getting familiar with the code base labels Jan 22, 2019
@nami-varthakavi
Copy link
Contributor Author

Can you also update outputDir in config file(https://webdriver.io/docs/options.html#outputdir) also to incorporate the same idea?

christian-bromann pushed a commit that referenced this issue Feb 6, 2019
## Proposed changes

[//]: # (Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.)

This change adds a check in wdio-reporter that will create the output directory if it's defined but doesn't exist on the system. This addresses #3389

## Types of changes

[//]: # (What types of changes does your code introduce to WebdriverIO?)
[//]: # (_Put an `x` in the boxes that apply_)

- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

[//]: # (_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._)

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [x] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

## Further comments

[//]: # (If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...)

I don't think this really needs a documentation change, but can add something if preferred.

### Reviewers: @webdriverio/technical-committee
@tendonstrength
Copy link

Should this issue be closed since there is a merged PR for it?

@WillBrock
Copy link
Member

@tendonstrength yes, closing.

@atti187
Copy link

atti187 commented Feb 19, 2019

@WillBrock - not working, at least not on Windows. I moved the ensureDirSync-call to before the call to createWriteStream in the constructor and it starts working, which seems reasonable?

wdio.conf looks like:

reporters: [
    'spec',
    ['junit', {
        outputDir: './reports',
        outputFileFormat: function(opts) { // optional
            return `wdio-${opts.cid}-junit-report.xml`
        }
    }]
]

Options-object looks like:

{
    logLevel: 'silent',
    setLogFile: [Function: NOOP],
    outputDir: './reports',
    outputFileFormat: [Function: outputFileFormat],
    logFile: 'reports\\wdio-0-0-junit-report.xml',
    writeStream: {
        write: [Function: write]
    }
}

@WillBrock
Copy link
Member

@atti187 That might be OK but not sure why that would change creating the directory. I don't have windows so I don't have a way to test. Mind creating a pr so someone can test with windows?

@klamping
Copy link
Contributor

Looks like my fix resolved the issue in junit, but not allure... working on an update in #3578

@nami-varthakavi
Copy link
Contributor Author

Looks like my fix resolved the issue in junit, but not allure... working on an update in #3578

Haven't really had time to follow up on your changes. Anyways thanks for checking this out for me :)

@atti187
Copy link

atti187 commented Feb 20, 2019

@WillBrock - guess @klamping beat me to it! Anyway, thx.

yamkay pushed a commit to MoveInc/webdriverio that referenced this issue Jun 13, 2019
…rio#3510)

## Proposed changes

[//]: # (Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.)

This change adds a check in wdio-reporter that will create the output directory if it's defined but doesn't exist on the system. This addresses webdriverio#3389

## Types of changes

[//]: # (What types of changes does your code introduce to WebdriverIO?)
[//]: # (_Put an `x` in the boxes that apply_)

- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

[//]: # (_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._)

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [x] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

## Further comments

[//]: # (If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...)

I don't think this really needs a documentation change, but can add something if preferred.

### Reviewers: @webdriverio/technical-committee
yamkay pushed a commit to MoveInc/webdriverio that referenced this issue Sep 4, 2019
…rio#3510)

## Proposed changes

[//]: # (Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.)

This change adds a check in wdio-reporter that will create the output directory if it's defined but doesn't exist on the system. This addresses webdriverio#3389

## Types of changes

[//]: # (What types of changes does your code introduce to WebdriverIO?)
[//]: # (_Put an `x` in the boxes that apply_)

- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Checklist

[//]: # (_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._)

- [x] I have read the [CONTRIBUTING](https://github.com/webdriverio/webdriverio/blob/master/CONTRIBUTING.md) doc
- [x] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)

## Further comments

[//]: # (If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...)

I don't think this really needs a documentation change, but can add something if preferred.

### Reviewers: @webdriverio/technical-committee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement good first pick a reasonable task to start getting familiar with the code base help wanted Issues that are free to take by anyone interested
Projects
None yet
Development

No branches or pull requests

6 participants