| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 87e820e commit 5bbc6df
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,16 +1,15 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | // Can't test this when 'make test' doesn't assign a tty to the stdout. | |
| 3 | - var common = require('../common'); | ||
| 4 | - var assert = require('assert'); | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | 5 | ||
| 6 | - var exceptionCaught = false; | ||
| 7 | - | ||
| 8 | - try { | ||
| 6 | + const shouldThrow = function() { | ||
| 9 | 7 | process.stdout.end(); | |
| 10 | - } catch (e) { | ||
| 11 | - exceptionCaught = true; | ||
| 12 | - assert.ok(common.isError(e)); | ||
| 13 | - assert.equal('process.stdout cannot be closed.', e.message); | ||
| 14 | - } | ||
| 8 | + }; | ||
| 9 | + | ||
| 10 | + const validateError = function(e) { | ||
| 11 | + return e instanceof Error && | ||
| 12 | + e.message === 'process.stdout cannot be closed.'; | ||
| 13 | + }; | ||
| 15 | 14 | ||
| 16 | - assert.ok(exceptionCaught); | ||
| 15 | + assert.throws(shouldThrow, validateError); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments