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

Add support for using TLA to configure libtap/settings #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

coreyfarrell
Copy link
Member

Top level await alters load ordering. For example if you have ./tap.js:

import './libtap-setup.js'
import t from 'libtap'

./libtap-setup.js:

import settings from 'libtap/settings'
import findUp from 'find-up'

const packageJSON = await findUp('package.json')
// read package.json and use it to alter settings

In this case tap.js was written to run the libtap-setup.js steps to completion before libtap is imported. Unfortunately having top level await in libtap-setup.js or anything it imports changes the order. libtap starts loading as soon as the first top level await is hit.

With this patch you would make two small changes. You would change import t from 'libtap' to import t from 'libtap/tla', then you would add a call to settings.markAsReady() after the settings changes are complete.

I'm not settled on this approach though it's the best I have right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant