by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 29 20:50
    jsf-clabot commented #1171
  • Jul 29 20:50

    dependabot[bot] on npm_and_yarn

    build(deps): bump elliptic from… (compare)

  • Jul 29 20:50
    dependabot[bot] labeled #1171
  • Jul 29 20:50
    dependabot[bot] opened #1171
  • Jul 21 01:52
    jason0x43 closed #1170
  • Jul 21 01:52
    jason0x43 commented #1170
  • Jul 21 01:40
    jason0x43 closed #1165
  • Jul 21 01:40

    jason0x43 on monorepo

    (compare)

  • Jul 17 11:44
    github-actions[bot] labeled #1170
  • Jul 17 11:42
    sridattasp opened #1170
  • Jul 15 21:15

    dependabot[bot] on npm_and_yarn

    (compare)

  • Jul 15 21:15
    jsf-clabot commented #86
  • Jul 15 21:15
    dependabot[bot] closed #85
  • Jul 15 21:15
    dependabot[bot] commented #85
  • Jul 15 21:15
    dependabot[bot] labeled #86
  • Jul 15 21:15

    dependabot[bot] on npm_and_yarn

    Bump lodash from 4.17.11 to 4.1… (compare)

  • Jul 15 21:15
    dependabot[bot] opened #86
  • Jul 15 20:50
    jsf-clabot commented #190
  • Jul 15 20:50
    dependabot[bot] labeled #190
  • Jul 15 20:50
    dependabot[bot] opened #190
Jason Cheatham
@jason0x43
That's happening when the local server is trying to parse coverage data it downloaded from the browser.
It means that whatever it got wasn't valid JSON. Possibly the raw selenium log from BS would show more information.
That error should also ideally be showing some part of the invalid data.
rhpijnacker
@rhpijnacker
In this session I did not request for coverage results. But apparently it still tries to get that from the browser? Does that make sense?
Jason Cheatham
@jason0x43
Coverage data is collected by default unless coverage is set to false. You shouldn't be getting an error in any case, though -- if there was no coverage data available, the request shouldn't return any. Try setting coverage: false in your config. If you happen to see what data cause the error, that would be useful to know so we could fix the underlying issue.
rhpijnacker
@rhpijnacker
Does it have to be false or falsy? I only set coverage to an actual value for other configurations.
The raw selenium logs does not seem to show anything suspicious:
13:04:29.538 DEBUG [WebDriverServlet.handle] - Found handler: fef00a61-78c4-43a9-97df-11ba3c1b0a0e (org.openqa.selenium.ie.InternetExplorerDriverService)
13:04:29.538 DEBUG [WebDriverServlet.lambda$handle$3] - Handler thread for session fef00a61-78c4-43a9-97df-11ba3c1b0a0e (internet explorer): Executing POST on /session/fef00a61-78c4-43a9-97df-11ba3c1b0a0e/execute (handler: ServicedSession)
13:04:29.540 DEBUG [Passthrough.handle] - To upstream: {"script":"return (function getCoverageData(coverageVariable) {\n        var coverageData = (function () {\n            return this;\n        })()[coverageVariable];\n        return coverageData && JSON.stringify(coverageData);\n    }).apply(this, arguments);","args":["__coverage__"]}
13:04:29.540 DEBUG [HttpURLConnection.writeRequests] - sun.net.www.MessageHeader@c2cff515 pairs: {POST /session/fef00a61-78c4-43a9-97df-11ba3c1b0a0e/execute HTTP/1.1: null}{Authorization: Basic cnV1ZGdyYXZlc3RlaWpuMTpGMXBReFRIYnk3d3hCZVBkc21IUw==}{Accept: application/json,text/plain;q=0.9}{X-Forwarded-Host: hub.browserstack.com}{User-Agent: axios/0.19.2}{X-Forwarded-For: 194.171.252.100}{x-connid: 21621292158}{BStack-Host: 185.44.130.87}{x-conn: keep-alive}{Content-Type: application/json; charset=utf-8}{Connection: close}{Cache-Control: no-cache}{Pragma: no-cache}{Host: localhost:64856}{Content-Length: 285}
13:04:29.610 DEBUG [HttpURLConnection.getInputStream0] - sun.net.www.MessageHeader@1b0da276 pairs: {null: HTTP/1.1 200 OK}{Content-Length: 77}{Content-Type: application/json; charset=UTF-8}{Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept}{Accept-Ranges: bytes}{Connection: close}
13:04:29.611 DEBUG [Passthrough.handle] - To downstream: {"sessionId":"fef00a61-78c4-43a9-97df-11ba3c1b0a0e","status":0,"value":null}
Jason Cheatham
@jason0x43
false. It can be specifically false, or an array of files or globs.
rhpijnacker
@rhpijnacker
What happens when it is not set in the config? Does it default to false?
Jason Cheatham
@jason0x43
No (hence "Coverage data is collected by default" :smile: )
rhpijnacker
@rhpijnacker
Ah, ok. That's something I would want to definitely fix then.
Jason Cheatham
@jason0x43
It should probably be disabled by default, though. Currently the default is [], which enables coverage collection, but doesn't actually instrument any files.
rhpijnacker
@rhpijnacker
Is there any usecase where that is useful?
Jason Cheatham
@jason0x43
When you've instrumented code using an external tool like nyc
rhpijnacker
@rhpijnacker
Ah, ok
Jason Cheatham
@jason0x43
That could be more clear, too, though. Like, coverage could support false, an array of globs, and something more explicit like 'external' to indicate that coverage data should be collected even though Intern isn't instrumenting any files itself.
rhpijnacker
@rhpijnacker
Even with coverage: false I get this error:
19:35:11 SyntaxError: Unexpected token E in JSON at position 26
19:35:11   at Server.get @ node_modules\src\Server.ts:376:16
19:35:11   at runRequest @ node_modules\src\Session.ts:133:12
19:35:11   @ node_modules\src\Session.ts:167:44
19:35:11   at new e @ node_modules\@theintern\common\index.js:16:5068
Any other ideas?
Jason Cheatham
@jason0x43
It looks like that's something different. Try printing the data that's causing the error so we can see what the problem is.
Dylan Staley
@dstaley

@jason0x43 any idea what I'm doing wrong here?

it("should emit an event on create", function () {
    const { resolve } = this.async();
    articles.events.on("create", () => resolve());
    articles.create({ title: "win" });
});

articles.create asynchronously emits a create event, so I'm essentially just trying to assert that the event is emitted. However, I get what appears to be an Intern error, saying Cannot read property '_resolver' of undefined.

Jason Cheatham
@jason0x43

The return value of this.async is a Deferred object, so it shouldn't be destructured.

const dfd = this.async();
articles.events.on("create", () => dfd.resolve());

You can also use a Promise:

it("should emit an event on create", function () {
  return new Promise(resolve => {
    articles.events.on("create", resolve);
    articles.create({ title: "win" });
  });
});
Dylan Staley
@dstaley
Thanks! The Promise version worked perfectly. The other version still didn't work, but I actually think that's because of how EventEmitter works on Node. It messes with this, so that could explain why it wasn't working.
Jason Cheatham
@jason0x43
this should be fine since you're using a function declaration for your test, but Tests are also passed the current Test object to support arrow function test callbacks (where this isn't applicable), so you can do
it("should emit an event on create", function (test) {
  const dfd = test.async();
Promises are generally simpler unless you need some of Deferred's more complex behaviors, though.
Dylan Staley
@dstaley
@jason0x43 what are your opinions on tools like Playwright? What benefits/drawbacks would Intern gain by using something like that over WebDriver?
Dylan Staley
@dstaley
(not suggesting, just inquiring since it looks like you might have thought about it already 😁)
Jason Cheatham
@jason0x43
They seem like they could be complementary to WebDriver. Playwright and Puppeteer provide a lot of capability and are easier to setup and use for local testing than WebDriver. WebDriver supports a wider range of browsers and browser versions, as well as remote testing.
Dylan Staley
@dstaley
Ah gotcha! I forgot that Playwright includes copies of browsers.
Any suggestions on how I could write a TypeScript test that's compiled, but not executed? Here's my workaround for the time being:
describe("library", () => {
  it("should compile without errors", () => {
    // Note: This is not executed, only compiled for type-checking.
    () => {
      const n: number = "";
    };
  });
});
Jason Cheatham
@jason0x43

You could use skip:

describe("library", () => {
  it("should compile without errors", test => {
    test.skip('compiled only');
    const n: number = "";
  });
});

The next version of Intern will support xit and xdescribe (non-executed tests and suites), which would be a bit cleaner.

Dylan Staley
@dstaley
awesome! Intern 5, or a minor release?
Jason Cheatham
@jason0x43
Definitely 5, maybe a minor release (depending on how long 5 is taking)
Guido Boshouwers
@GARMBoshouwers
If I want to check code coverage of functional tests, do I need to set the coverage variable to the .js files used in the web page?
rhpijnacker
@rhpijnacker
Is there a way to have the test reporter include the time it takes to execute beforeEach/afterEach?
I'm trying to pinpoint tests that take too long to run, but it looks like only the time spent in the actual testcase is reported.
Jason Cheatham
@jason0x43
@GARMBoshouwers you'd set the coverage variable in the same way as for unit tests, and you would need to load your test pages through Intern's test server (e.g. localhost:9000). Coverage requires source files to be instrumented, and instrumentation for browser tests happens when files are served by the test server.
@rhpijnacker Not currently; time is only recorded for the test itself. I can see that being a useful stat to collect, though.
rhpijnacker
@rhpijnacker
Would that be an easy change to make?
Every now and then, the BrowserStack run on IE11 does not put the window full-screen. I'm passing "resolution": "1280x1024" to the environment, but nothing else. Do I need some extra setting to get the window maximized?
Jason Cheatham
@jason0x43
Sending a resolution capability to BrowserStack sets the desktop resolution. To maximize the IE window itself, you'd need to use the maximizeWindow Leadfoot command.
Jason Cheatham
@jason0x43
Adding timing for before/after each probably wouldn't be difficult, although how it gets collected and reported would need some thought. Like, should Intern remember the time for each beforeEach call, or should it average them for a suite? Should those results be kept as Suite properties, or should Intern just include that info in events emitted when a beforeEach (afterEach, etc) finishes?
dave-hart
@dave-hart

Hi, I have a custom reporter that listens to the testEnd event for some functional tests

  @eventHandler()
  testEnd(test: Test) {

but on running, this event seems to get fired during initialisation before the browser even loads (it also hits after an actual test when I would expect it)

Is this as expected behaviour?

dave-hart
@dave-hart
I am answering my own question, it is because of skipped tests
Khobab
@khobabc
Hello Good People.
I have some questions that I could not find answer to anywhere. I thought I should ask here.
Jason Cheatham
@jason0x43
Hi! This is a great place to ask questions, assuming they're about Intern. :smile:
Khobab
@khobabc
They sure are :-)
we are using Intern 4 with dojo and we have started using TypeScript with dojo typings so tests are in ts.
Khobab
@khobabc
and now when we do npm run tsc to compile type script we see following errors in compilation.

node_modules/@theintern/digdug/BrowserStackTunnel.d.ts:2:36 - error TS2307: Cannot find module '@theintern/common'.

2 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/digdug/interfaces.d.ts:1:36 - error TS2307: Cannot find module '@theintern/common'.

1 export { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/digdug/SeleniumTunnel.d.ts:3:36 - error TS2307: Cannot find module '@theintern/common'.

3 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/digdug/Tunnel.d.ts:2:66 - error TS2307: Cannot find module '@theintern/common'.

2 import { Evented, EventObject, Handle, CancellablePromise } from '@theintern/common';
                                                                   ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/leadfoot/Command.d.ts:3:36 - error TS2307: Cannot find module '@theintern/common'.

3 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/leadfoot/Element.d.ts:2:36 - error TS2307: Cannot find module '@theintern/common'.

2 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/leadfoot/interfaces.d.ts:2:36 - error TS2307: Cannot find module '@theintern/common'.

2 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/leadfoot/Server.d.ts:1:52 - error TS2307: Cannot find module '@theintern/common'.

1 import { CancellablePromise, RequestOptions } from '@theintern/common';
                                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@theintern/leadfoot/Session.d.ts:4:36 - error TS2307: Cannot find module '@theintern/common'.

4 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/@types/istanbul-lib-instrument/index.d.ts:8:30 - error TS2307: Cannot find module 'source-map'.

8 import { RawSourceMap } from 'source-map';
                               ~~~~~~~~~~~~

node_modules/@types/istanbul-lib-source-maps/index.d.ts:8:30 - error TS2307: Cannot find module 'source-map'.

8 import { RawSourceMap } from 'source-map';
                               ~~~~~~~~~~~~

node_modules/intern/lib/BenchmarkTest.d.ts:1:36 - error TS2307: Cannot find module '@theintern/common'.

1 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/intern/lib/channels/Base.d.ts:1:36 - error TS2307: Cannot find module '@theintern/common'.

1 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/intern/lib/executors/Executor.d.ts:2:44 - error TS2307: Cannot find module '@theintern/common'.

2 import { Handle, CancellablePromise } from '@theintern/common';
                                             ~~~~~~~~~~~~~~~~~~~

node_modules/intern/lib/executors/Node.d.ts:4:36 - error TS2307: Cannot find module '@theintern/common'.

4 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/intern/lib/RemoteSuite.d.ts:1:36 - error TS2307: Cannot find module '@theintern/common'.

1 import { CancellablePromise } from '@theintern/common';
                                     ~~~~~~~~~~~~~~~~~~~

node_modules/intern/lib/reporters/Benchmark.d.ts:22:22 - error TS2694: Namespace '"C:/Users/Khobab/Documents/webapps/node_modules/intern/lib/reporters/Benchmark"' has no exported member 'Times'.

22     times: Benchmark.Times;
                        ~~~~~

node_modules/intern/lib/Server.d.ts:5:24 - error TS2307: Cannot find module '@theintern/common'.

5 import { Handle } from '@theintern/common';
                         ~~~~~~~~~~~~
I am not sure how we can fix these. Any help would be much appreciated.