Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for TypeScript scripts #477

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: Make test run names able to handle refactoring
`fn.name` was introduced in Node 0.10.0, so this improves test suite maintainability without changing the minimum node version.

Also added a test that for certain proves that Promises can be awaited.
  • Loading branch information
Ricky C committed Jul 6, 2024
commit ccf1a8e117e1e95b26fcce37d95558535dd42570
12 changes: 10 additions & 2 deletions __test__/async-function.test.ts
Original file line number Diff line number Diff line change
@@ -2,13 +2,21 @@

import {callAsyncFunction} from '../src/async-function'

describe('callAsyncFunction', () => {
describe(callAsyncFunction.name, () => {
test('calls the function with its arguments', async () => {
const result = await callAsyncFunction({foo: 'bar'} as any, 'return foo')
expect(result).toEqual('bar')
})

test('throws on ReferenceError', async () => {
test('can await a Promise', async () => {
const result = await callAsyncFunction(
{} as any,
'return await new Promise(resolve => resolve("bar"))'
)
expect(result).toEqual('bar')
})

test(`throws an ${ReferenceError.name}`, async () => {
expect.assertions(1)

try {
2 changes: 1 addition & 1 deletion __test__/get-retry-options.test.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

import {getRetryOptions} from '../src/retry-options'

describe('getRequestOptions', () => {
describe(getRetryOptions.name, () => {
test('retries disabled if retries == 0', async () => {
const [retryOptions, requestOptions] = getRetryOptions(
0,