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

Ability to use debug AVA tests with a launch configuration #4722

Closed
turadg opened this issue Mar 2, 2022 · 9 comments · Fixed by #4418
Closed

Ability to use debug AVA tests with a launch configuration #4722

turadg opened this issue Mar 2, 2022 · 9 comments · Fixed by #4418
Labels
tooling repo-wide infrastructure

Comments

@turadg
Copy link
Member

turadg commented Mar 2, 2022

What is the Problem Being Solved?

When running tests with a launch configuration (as here) I get this error,

SyntaxError: The requested module '[file:///opt/agoric/agoric-sdk/node_modules/@babel/types/lib/index.js]()' does not provide an export named 'default'

That's caused by import '@agoric/babel-standalone' in @endo/init/pre-bundle-source.js`. (That particular error goes away when I comment out that line.)

Description of the Design

This might be solved by #4718 . I'll check after that is merged.

Security Considerations

--

Test Plan

--

@turadg turadg added the tooling repo-wide infrastructure label Mar 2, 2022
@kriskowal
Copy link
Member

#4718 has merged. We may also be able to land a change that generally closes endojs/endo#768

@turadg
Copy link
Member Author

turadg commented Mar 2, 2022

@kriskowal progress had been made! Error now,

[/opt/agoric/agoric-sdk/node_modules/]()@agoric[/babel-generator/lib/generators/modules.js:182]()
    if (specifiers?.length) {
                   ^

  SyntaxError: Invalid or unexpected token

@kriskowal
Copy link
Member

@kriskowal progress had been made! Error now,

[/opt/agoric/agoric-sdk/node_modules/]()@agoric[/babel-generator/lib/generators/modules.js:182]()
    if (specifiers?.length) {
                   ^

  SyntaxError: Invalid or unexpected token

cc @michaelfig This babel-generator version might be too new.

@kriskowal
Copy link
Member

@turadg Can you confirm your Node.js version?

@turadg
Copy link
Member Author

turadg commented Mar 3, 2022

> node --version
v17.6.0

This works

cd packages/run-protocol
yarn test --serial test/vaultFactory/test-vaultFactory.js
yarn ava --serial test/vaultFactory/test-vaultFactory.js

But these gives the syntax error:

yarn ava packages/run-protocol/test/vaultFactory/test-vaultFactory.js
./node_modules/.bin/ava packages/run-protocol/test/vaultFactory/test-vaultFactory.js

The latter is how my launch configuration is set up, so it can be run anywhere in the repo.

@kriskowal
Copy link
Member

I’ve experienced ava’s sensitivity to the working directory. For example, the paths you give it must be relative to the project root. But this specific error is weird and indicates a stale Node.js version in play. Maybe there’s a fully qualified path in an npm-generated shebang.

@turadg turadg linked a pull request Mar 3, 2022 that will close this issue
@turadg
Copy link
Member Author

turadg commented Mar 3, 2022

SyntaxError appears to have been coming from https://www.npmjs.com/package/esm . Root config (unlike the rest) had it has a preload require. The linked PR upgrades Ava and removes that from config. But doing that requires changing root package type to 'module' which shakes out some other things to update. I'm time boxing that but let me know if you know of a shorter path.

@kriskowal
Copy link
Member

kriskowal commented Mar 9, 2022

Per #4758, we no longer depend on @agoric/babel-standalone or for that matter recast, therefore neither @babel/types. So that just leaves esm in agoric-cli, which is becoming rapidly less necessary as we’ve migrated most if not all dapp deploy scripts to Node.js ESM (NESM).

@michaelfig
Copy link
Member

Per #4758, we no longer depend on [...] @babel/types.

We still need @babel/types. Maybe you were thinking ast-types?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling repo-wide infrastructure
Projects
None yet
3 participants