diff --git a/test/env.html b/test/env.html new file mode 100644 index 0000000..09f9299 --- /dev/null +++ b/test/env.html @@ -0,0 +1,24 @@ + + + Tests env + + + + +
+ + + + + + diff --git a/test/lib/mocha-phantomjs.js b/test/lib/mocha-phantomjs.js index 986248e..860ccb4 100644 --- a/test/lib/mocha-phantomjs.js +++ b/test/lib/mocha-phantomjs.js @@ -275,7 +275,7 @@ }); }); }); - return describe('config', function() { + describe('config', function() { describe('user-agent', function() { /* $ ./bin/mocha-phantomjs -R spec test/user-agent.html @@ -330,6 +330,14 @@ }); }); }); + return describe('env', function() { + return it('has passed environment variables', function(done) { + process.env.FOO = 'bar'; + return this.runner(done, [fileURL('env')], function(code, stdout, stderr) { + return expect(stdout).to.match(/^bar/); + }); + }); + }); }); }).call(this); diff --git a/test/src/mocha-phantomjs.coffee b/test/src/mocha-phantomjs.coffee index 0c3fe4a..6d5e390 100644 --- a/test/src/mocha-phantomjs.coffee +++ b/test/src/mocha-phantomjs.coffee @@ -276,3 +276,9 @@ describe 'mocha-phantomjs', -> it 'suppresses color output', (done) -> @runner done, ['-C', fileURL('mixed')], (code, stdout, stderr) -> expect(stdout).to.not.match /\u001b\[\d\dm/ + + describe 'env', -> + it 'has passed environment variables', (done) -> + process.env.FOO = 'bar' + @runner done, [fileURL('env')], (code, stdout, stderr) -> + expect(stdout).to.match /^bar/