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

Top Level await throws error in Codemirror editor #1214

Closed
cheleb opened this issue Dec 13, 2023 · 6 comments
Closed

Top Level await throws error in Codemirror editor #1214

cheleb opened this issue Dec 13, 2023 · 6 comments

Comments

@cheleb
Copy link

cheleb commented Dec 13, 2023

Using await / async in Test raise error in IDE, whereas working in CLI / UI run.

`tests {
await test("should have unchanged _info", async function() {
var _ = require('lodash');
const data = res.getBody();

const nonRegURL = 'http://localhost:8080/_info';

const axios = require('axios');

let p = await axios({
  url: nonRegURL,
  method: 'get'
});

assert.deepEqual(data, p.data, "WTF");

});
}`

image

@RicardoVizcaya
Copy link

I also wanted to raise this issue, so plus one from me.
grafik

@sahidshaikh23
Copy link

I want to solve this issue can u add me please

@helloanoop
Copy link
Contributor

@sahidshaikh23 That'd be great!
Currently there is no process to assign the issues.

You can go ahead and work on it. Please raise a PR once ready.

@helloanoop helloanoop changed the title await test("An async test", async function [...]: raise error in Bruno IDE. Top Level await throws error in Codemirror editor Jan 5, 2024
@helloanoop
Copy link
Contributor

I confirm the errors due to top level await

image

This is because, codemirror uses jshint, and currently jshint does not have an option to disable errors due to top level await.
See jshint/jshint#3447

I am going to push a temporary fix (until jshint support arrives) by making updates to the codemirror javascript linter.

@cheleb
Copy link
Author

cheleb commented Jan 5, 2024

Thank I tried to understand/find a fix, but as a scala backend, my js knowledge clearly lacked

@helloanoop
Copy link
Contributor

No worries @cheleb! I have taken care of this.

The fixes are now available in v1.6.1 🎉🎉

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

No branches or pull requests

4 participants