Skip to content

Commit

Permalink
Add a env test
Browse files Browse the repository at this point in the history
  • Loading branch information
hokaccha committed Aug 21, 2013
1 parent e7b1582 commit 83f342b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
24 changes: 24 additions & 0 deletions test/env.html
@@ -0,0 +1,24 @@
<html>
<head>
<title>Tests env</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script>
mocha.ui('bdd');
mocha.reporter('html');
</script>
<script>
console.log(window.mochaPhantomJS.env.FOO);
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
} else {
mocha.run();
}
</script>
</body>
</html>

10 changes: 9 additions & 1 deletion test/lib/mocha-phantomjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions test/src/mocha-phantomjs.coffee
Expand Up @@ -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/

0 comments on commit 83f342b

Please sign in to comment.