Skip to content

Commit

Permalink
Don't allow default as a spinner (#175)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
erezrokah and sindresorhus authored Jun 8, 2021
1 parent c7d6dba commit 659f839
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class Ora {
} else if (spinner === undefined) {
// Set default spinner
this._spinner = cliSpinners.dots;
} else if (cliSpinners[spinner]) {
} else if (spinner !== 'default' && cliSpinners[spinner]) {
this._spinner = cliSpinners[spinner];
} else {
throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`);
Expand Down
6 changes: 6 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ if (process.platform !== 'win32') {
});
}

test('throw when spinner is set to `default`', t => {
t.throws(() => {
new Ora({spinner: 'default'}); // eslint-disable-line no-new
}, /no built-in spinner/);
});

test('indent option', t => {
const stream = getPassThroughStream();
stream.isTTY = true;
Expand Down

0 comments on commit 659f839

Please sign in to comment.