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

Multiple root elements in logfile #71

Open
categoryshell opened this issue Jan 3, 2017 · 2 comments
Open

Multiple root elements in logfile #71

categoryshell opened this issue Jan 3, 2017 · 2 comments

Comments

@categoryshell
Copy link

Hello,

When i want to write the results to a logfile (in this case i've tested json and junit output), multiple root elements a written to the file, which causes the file to be json/xml invalid.

In case of the junit output, a lot of information is missing anyway.
jUnit export should include all files, including all failed and succeeded tests. As far as i can see, only failed tests are included.
When using this in Bamboo, the number of performed tests won't match the real number of performed test.
And when a bug is fixed, the test won't change from error to succes but it simply disappears.

Am i doing something wrong?

The task i'm running is:

gulp.task('ci-scssLint', function () {
    var file = fs.createWriteStream('../log/sassLint.json');
    var stream = gulp.src('../../app/design/frontend/**/*.scss')
        .pipe(sassLint({
            options: {
                configFile: 'sass-lint.yml',
                formatter: 'json'
            }
        }))
        .pipe(sassLint.format(file));
    stream.on('finish', function() {
        file.end();
    });
    return stream;
});
@tuckerjt07
Copy link

tuckerjt07 commented Feb 4, 2017

I'm having the exact same issue.

I was also having the same issue with eslint when creating the stream as a variable. I was able to fix it by creating the stream inline in its format function but that is not an option with this library to my understanding.

I haven't debugged it but from looking at the underlying code I'm almost certain that each file is being passed off to the formatter separately instead of concatenating them into a collection and passing them off as a single entity.

@tuckerjt07
Copy link

After playing around with some potential workarounds I came up with this solution using the gulp-shell package (npm install --save-dev gulp-shell).

gulp.task('lint:test', shell.task(['sass-lint -c sass-lint.yaml -v']));

I noticed that the cli version was working just not the gulp so I am using the shell package to pass through to the command line from gulp. The -v is important or it will not write the file from looking at the sass-lint issues. My output files, source, and formatters are contained in my yaml but can be added with the -f for formatter and -o out/put/path immediately after my yaml file in the above command. The source can be wildcarded and goes between yaml and -v.

sass-lint -f json -o path/to/file src/**/*.scss -v

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

2 participants