by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 10 13:33

    jason0x43 on master-mono

    fix(cli): don't overwrite confi… test(leadfoot): temporarily dis… (compare)

  • 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
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.
Jason Cheatham
@jason0x43
What version of Intern are you using?
Khobab
@khobabc
"intern": "4.8.0",
But I have also tried with 4.8.4 and it does not matter
Jason Cheatham
@jason0x43
Do you have node_modules/@theintern/common?
Khobab
@khobabc
yes, it exists.
Jason Cheatham
@jason0x43
What does your tsconfig look like? In particular, what is the value for moduleResolution?
Khobab
@khobabc
{
  "compilerOptions": {
    "noImplicitAny": true,
    "noImplicitUseStrict": true,
    "noEmitOnError": false,
    "module": "amd",
    "moduleResolution": "classic",
    "target": "es5",
    "sourceMap": true,
    "experimentalDecorators": true,
    "types": ["intern"],
    "baseUrl": ".",
    "paths": {
        "abc/*": ["src/abc/*"],
        "def/*": ["src/def/*"]
    }
  },
  "exclude": [
    "node_modules"
  ],
  "include": [
    "src/**/*",
    "tests/unit/**/*"
  ],
  "files": [
    "./node_modules/dojo-typings/dojo/1.11/index.d.ts",
    "./node_modules/dojo-typings/dojo/1.11/modules.d.ts",
    "./node_modules/dojo-typings/dijit/1.11/index.d.ts",
    "./node_modules/dojo-typings/dijit/1.11/modules.d.ts",
    "./node_modules/dojo-typings/dojox/1.11/index.d.ts",
    "./node_modules/dojo-typings/dojox/1.11/modules.d.ts",
    "./node_modules/dojo-typings/dojox/1.11/html/entities.d.ts",
    "./node_modules/dojo-typings/custom/dgrid/1.1/dgrid.d.ts",
    "./node_modules/dojo-typings/custom/dstore/1.1/dstore.d.ts"
  ]
}
You can see tsconfig above.
I do not have separate files for src and tests, there is only one file at the base.
Jason Cheatham
@jason0x43
Can you set moduleResolution to node? (Will that work with your app?)
Khobab
@khobabc
I have tried that too just to check but does not think it works. I can try that again.
ah, btw it worked with moduleResolution node.
Not sure why it did not work earlier.
I have to check with my lead if this module resolution would work and smoke test the app.
Jason Cheatham
@jason0x43
:thumbsup: