Lazy vars undefined when running multiple test files
dkreft opened this issue · 6 comments
Something broke between 1.1.4 and 1.1.5.
I'm having a heck of a time nailing this down to a specific condition, but when I run a single test, everything works just fine:
$ gulp test --name ingest-endpoints-test
[11:38:36] Using gulpfile /workplace/exm-admin-tool/gulpfile.js
[11:38:36] Starting 'test'...
IngestEndpointsResponse
✓ extends BulkResponse
on the default object
toBulkResponseList
✓ has a show_url
2 passing (9ms)
[11:38:38] Finished 'test' after 2.03 s
But if I run multiple tests, I get failures:
$ gulp test --name ingest-endpoints
[11:38:56] Using gulpfile /workplace/exm-admin-tool/gulpfile.js
[11:38:56] Starting 'test'...
IngestEndpointsUpload
✓ is a Bulk subclass
on the default object
validate
✓ has validation errors
group validation
✓ has a group missing attribute error
zip file validation
✓ has a group missing attribute error
IngestEndpointsResponse
✓ extends BulkResponse
on the default object
toBulkResponseList
1) has a show_url
5 passing (19ms)
1 failing
1) IngestEndpointsResponse on the default object toBulkResponseList has a show_url:
ReferenceError: $subject is not defined
at Context.<anonymous> (ingest-endpoints-test.js:26:16)
[11:38:57] 'test' errored after 738 ms
[11:38:57] Error in plugin 'gulp-mocha'
Message:
1 test failed.
Here's what my gulp task looks like:
var babel = require('babel-register')({
presets: ['es2015'],
ignore: [/node_modules/, /(templates|partials)\.js/]
});
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var argv = require('yargs').argv;
gulp.task('test', function () {
var wildcard = 'test/**/*.js'
if (argv.name) {
wildcard = 'test/**/*' + argv.name + '*.js'
}
// The larger timeout is because the bamboo server is awfully slow.
var opts = {
timeout: 5000,
ui: 'bdd-lazy-var/global'
};
if(argv.reporter){
opts.reporter = argv.reporter;
}
if(argv.reporterOptions){
var fileNameArray = argv.reporterOptions.split('=');
if(fileNameArray && fileNameArray.length){
var fileName = fileNameArray.pop();
if(fileName && fileName.length > 0){
opts.reporterOptions = {
mochaFile: fileName
};
}
}
}
return gulp.src(wildcard, {read: false})
// gulp-mocha needs filepaths so you can't have any plugins before it
.pipe(mocha(opts));
});
It'd be good to see your tests if possible
@dkreft Could you also clarify which your env: browser or nodejs?
I'm seeing the same issue on 1.1.6. Downgrading to 1.1.4 resolved the issue. We're using PhantomJS with Karma to run our specs.
@giantyellowrobot @dkreft guys can you try 1.1.7 version? And tell me if the issue is fixed now
Looks like version 1.1.7 is working perfectly for me. Thanks for the quick response!
Confirmed fix on my end, too. Thank you very much.