This repository has been archived by the owner on Feb 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Notifier = require('node-notifier') | ||
|
||
export default (opts: Notifier.Notification, cb?: Notifier.NotificationCallback) => { | ||
const notifier: typeof Notifier = require('node-notifier') | ||
return notifier.notify({ | ||
// title: `heroku ${process.argv[2]}`, | ||
// icon: path.join('Terminal Icon'), | ||
// icon: path.join(__dirname, '../assets/heroku.png'), | ||
// contentImage: path.join(__dirname, '../assets/heroku.png'), | ||
// open: // URL to open on Click | ||
// wait: false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds | ||
|
||
// New in latest version. See `example/macInput.js` for usage | ||
// timeout: 5, // Takes precedence over wait if both are defined. | ||
// closeLabel: void 0, // String. Label for cancel button | ||
// actions: void 0, // String | Array<String>. Action label or list of labels in case of dropdown | ||
// dropdownLabel: void 0, // String. Label to be used if multiple actions | ||
// reply: false // Boolean. If notification should take input. Value passed as third argument in callback and event emitter. | ||
...opts | ||
}, cb) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import chalk from 'chalk' | ||
import {expect, fancy as base, FancyTypes, NockScope} from 'fancy-test' | ||
import * as fs from 'fs-extra' | ||
import * as path from 'path' | ||
|
||
import cli from '../src' | ||
|
||
export { | ||
expect, | ||
FancyTypes, | ||
NockScope, | ||
} | ||
|
||
let count = 0 | ||
const logLevel = cli.config.logLevel | ||
|
||
export const fancy = base | ||
.do(async (ctx: {count: number, base: string}) => { | ||
ctx.count = count++ | ||
ctx.base = path.join(__dirname, '../tmp', `test-${ctx.count}`) | ||
await fs.remove(ctx.base) | ||
cli.config.errlog = path.join(ctx.base, 'error.log') | ||
chalk.enabled = false | ||
}) | ||
.finally(async () => { | ||
cli.config.logLevel = logLevel | ||
await cli.done() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import cli from '../src' | ||
|
||
import {fancy} from './fancy' | ||
|
||
describe('notify', () => { | ||
fancy | ||
.stderr() | ||
.it('shows notification', (_, done) => { | ||
cli.notify({message: 'example notification'}, done) | ||
}) | ||
}) |