-
Notifications
You must be signed in to change notification settings - Fork 444
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
8 changed files
with
987 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root: true | ||
parser: '@typescript-eslint/parser' | ||
plugins: ['@typescript-eslint'] | ||
extends: | ||
- eslint:recommended | ||
- plugin:@typescript-eslint/eslint-recommended | ||
- plugin:@typescript-eslint/recommended | ||
- prettier/@typescript-eslint | ||
rules: | ||
# '@typescript-eslint/explicit-function-return-type': 0 | ||
'@typescript-eslint/no-use-before-define': | ||
- 2 | ||
- functions: false |
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,5 @@ | ||
arrowParens: avoid | ||
bracketSpacing: false | ||
semi: false | ||
singleQuote: true | ||
trailingComma: none |
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 |
---|---|---|
@@ -1,26 +1,28 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
import {callAsyncFunction} from '../src/async-function' | ||
|
||
describe('callAsyncFunction', () => { | ||
test('calls the function with its arguments', async () => { | ||
const result = await callAsyncFunction({foo: 'bar'}, 'return foo') | ||
const result = await callAsyncFunction({foo: 'bar'} as any, 'return foo') | ||
expect(result).toEqual('bar') | ||
}) | ||
|
||
test('throws on ReferenceError', async () => { | ||
expect.assertions(1) | ||
|
||
try { | ||
await callAsyncFunction({}, 'proces') | ||
await callAsyncFunction({} as any, 'proces') | ||
} catch (err) { | ||
expect(err).toBeInstanceOf(ReferenceError) | ||
} | ||
}) | ||
|
||
test('can access process', async () => { | ||
await callAsyncFunction({}, 'process') | ||
await callAsyncFunction({} as any, 'process') | ||
}) | ||
|
||
test('can access console', async () => { | ||
await callAsyncFunction({}, 'console') | ||
await callAsyncFunction({} as any, 'console') | ||
}) | ||
}) |
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
Oops, something went wrong.