| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 54cbf28 commit ee7754b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -243,7 +243,7 @@ blocks. The `preserveCursor` argument is passed to [`readline.prompt`][]. This i | |||
| 243 | 243 | used primarily with `defineCommand`. It's also used internally to render each | |
| 244 | 244 | prompt line. | |
| 245 | 245 | ||
| 246 | - ## repl.start(options) | ||
| 246 | + ## repl.start([options]) | ||
| 247 | 247 | ||
| 248 | 248 | Returns and starts a `REPLServer` instance, that inherits from | |
| 249 | 249 | [Readline Interface][]. Accepts an "options" Object that takes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -194,8 +194,6 @@ function REPLServer(prompt, | |||
| 194 | 194 | prompt = options.prompt; | |
| 195 | 195 | dom = options.domain; | |
| 196 | 196 | replMode = options.replMode; | |
| 197 | - } else if (typeof prompt !== 'string') { | ||
| 198 | - throw new Error('An options Object, or a prompt String are required'); | ||
| 199 | 197 | } else { | |
| 200 | 198 | options = {}; | |
| 201 | 199 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,3 +77,17 @@ var r3 = repl.start({ | |||
| 77 | 77 | ||
| 78 | 78 | assert.equal(r3.replMode, repl.REPL_MODE_MAGIC); | |
| 79 | 79 | assert.equal(r3.historySize, 50); | |
| 80 | + | ||
| 81 | + // Verify that defaults are used when no arguments are provided | ||
| 82 | + const r4 = repl.start(); | ||
| 83 | + | ||
| 84 | + assert.strictEqual(r4._prompt, '> '); | ||
| 85 | + assert.strictEqual(r4.input, process.stdin); | ||
| 86 | + assert.strictEqual(r4.output, process.stdout); | ||
| 87 | + assert.strictEqual(r4.terminal, !!r4.output.isTTY); | ||
| 88 | + assert.strictEqual(r4.useColors, r4.terminal); | ||
| 89 | + assert.strictEqual(r4.useGlobal, false); | ||
| 90 | + assert.strictEqual(r4.ignoreUndefined, false); | ||
| 91 | + assert.strictEqual(r4.replMode, repl.REPL_MODE_SLOPPY); | ||
| 92 | + assert.strictEqual(r4.historySize, 30); | ||
| 93 | + r4.close(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments