Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 00:00
    maier49 assigned #1000
  • Dec 13 20:56
    jason0x43 synchronize #998
  • Dec 13 20:56

    jason0x43 on repo-reunion

    Update showConfig unit test (compare)

  • Dec 13 20:01
    jason0x43 synchronize #998
  • Dec 13 20:01

    jason0x43 on repo-reunion

    Add development note to README Update dependencies Handle args with spaces in cli and 3 more (compare)

  • Dec 13 14:20

    jason0x43 on 4.7.1

    (compare)

  • Dec 13 14:20

    jason0x43 on 4.7

    Marshal lifecycleMethod on Suit… Updating metadata for 4.7.1 Updating source version to 4.7.… (compare)

  • Dec 13 13:52

    jason0x43 on master

    Marshal lifecycleMethod on Suit… (compare)

  • Dec 13 13:52
    jason0x43 closed #1006
  • Dec 13 13:50
    jason0x43 commented #1005
  • Dec 13 01:46
    devpaul synchronize #1005
  • Dec 12 23:42
    codecov-io commented #1006
  • Dec 12 23:41
    codecov-io commented #1006
  • Dec 12 23:24
    codecov-io commented #1005
  • Dec 12 23:21
    codecov-io commented #1005
  • Dec 12 23:20
    jonnycornwell synchronize #1006
  • Dec 12 22:47
    devpaul synchronize #1005
  • Dec 12 22:43
    jonnycornwell edited #1006
  • Dec 12 22:42
    jonnycornwell opened #1006
  • Dec 12 22:23
    devpaul synchronize #1005
loiclegoff
@loiclegoff
I will try thx a lot :)!
loiclegoff
@loiclegoff

It's seems work but now, I have this error:

Suite chrome on windows nt FAILED
Error: Unable to resolve specifier 'test/packages/app-builder-ui/src/models/context/__tests__/ProjectContext.intern_test.js' from http://localhost:9000/__intern/browser/
  @ node_modules\systemjs\dist\system.min.js:4:5206
  at y.g.resolve @ node_modules\systemjs\dist\system.min.js:4:5267
  @ node_modules\systemjs\dist\system.min.js:4:2305
TOTAL: tested 1 platforms, 0 passed, 0 failed; suite error occurred

Before this, I run tsc with a specific config to buil in es5 my tests in the folder test :

{
  "extends": "./tsconfig.json",
  "rootDir": "./",
  "baseUrl": "./",
  "compilerOptions": {
    "outDir": "./test",
    "sourceMap": false
  },
  "include": ["./packages/**/__tests__/**/*.intern_test.ts"],
  "target": "es5",
  "types": ["systemjs"]
}

N.B.: Sorry for my english

Jason Cheatham
@jason0x43
I believe systemjs requires absolute URLs by default now. You may need to do something like const url = System.resolve(moduleId, '/'); (assuming your base URL is '/'), and then System.import the resolved URL.
Ondrej Medek
@xmedeko

Hello, is it possible to share (extend) default loader in another config? I need to change just loader.script. E.g.

"loader": {
    "script": "myintern.js",
    "options": { ... },
    "packages": [ ... ]
},
"configs" {
  "electron": {
    "loader": { "script": "myintern-electron.js" }
  }
}

It always redefines all loader (without options, packages). I have tried loader+, but with same result.

Jason Cheatham
@jason0x43
Changing the loader script will not affect what options are passed to the loader. Intern's process for initializing a loader script is:
  1. Load the script pointed to by loader.script. That script should call intern.registerLoader.
  2. After it has loaded the script, Intern attempts to initialize the loader, using the callback provided when the loaded called intern.registerLoader, by calling callback(options).
To be a proper loader script, the myintern.js script should call intern.registerLoader with a callback that Intern can use to initialize it. Intern will call that function, passing it the value of loader.options.
Note that script and options are the only two properties that loader should have. Any loader-specific options, like a packages definition, should go in loader.options.
Ondrej Medek
@xmedeko
First of all, I want to apologize, yes, we have loader.options.packages the snippet is wrong. So, basically, I would like to share same loader.options for multiple loader.script. However, when redefining the loader.script in a configs, then the intern.registerLoader got no options. I have to copy&paste them to the configs.
Jason Cheatham
@jason0x43
Ah, OK. loader isn't one of the options that can be extended (those are suites, plugins, reporters, instrumenterOptions, tunnelOptions, and capabilities). That wouldn't be hard to add, though.
Ondrej Medek
@xmedeko
OK, thanks. I've made the myintern.js flexible to recognize the environments it's running, so do not need configs now. But adding the loader to the extendable options could be useful.
Jason Cheatham
@jason0x43
Hmmm...now that I think about it, extendable properties are only shallow-copied right now. For that to be useful for loader options, we'd either need to specifically make loader.optionsextendable (or add a separate loaderOptions key), or we'd need to add a general purpose + handler so that any property could be extended. Either of those are possible.
Ondrej Medek
@xmedeko
Aha, do not need it right now. I will let you know if I would need it in the future. Thank you.
jake-harrington
@jake-harrington
does a custom reporter have access to requireing modules? I can't seem to figure out how to load fs or other modules from inside a custom reporter
jake-harrington
@jake-harrington
i'm writing a custom reporter that integrates with some other tooling i have to combine test results with a different testing framework for other things, but i need to read/write to a json file as well as read another custom configuration file
Jason Cheatham
@jason0x43
Assuming the reporter is only being loaded in Node, you can use require.
jake-harrington
@jake-harrington
i'm using it to run unit tests in chrome/ie, but using the node test runner
image.png
i am using requirejs for the unit tests so i thought maybe i'd need to use an AMD instead but then i was getting define is undefined
Jason Cheatham
@jason0x43
Load the reporter script in the plugins list, and set useLoader to true:
"plugins": [
  { "script": "myreporter.js", "useLoader": true }
]
jake-harrington
@jake-harrington
got a little closer, i didn't seem to be able to load fs by either just define(['fs]... or define(['dojo/node!fs']..., apparently i am using dojo 2 and dojo 2 doesn't need dojo/node! anymore right? either way i wasn't able to get it
Jason Cheatham
@jason0x43
What kind of error do you get with define(['fs'])?
jake-harrington
@jake-harrington
image.png
doesn't quite look right with that HTMLScriptElement, so i'm sure i'm just doing something wrong
Jason Cheatham
@jason0x43
Yeah, that's because the reporter is being loaded in the browser
If you're running multiple environments, put the reporter in a "node" section:
"node": {
  "reporters": [...]
}
Or update the reporter so that any defines or requires aren't executed immediately when the module is loaded (so you can skip them if you notice you're in a browser)
jake-harrington
@jake-harrington
i noticed i couldn't do any console.logs on browser globals like navigator and couldn't do alert so i was confused about what context it was running in :/
i've got an express server running as part of my tests, i can probably just change it around to sending the results to that and handle fs operations there
would maybe be a bit cleaner
i'll try with the node reporter config you mentioned first though. thanks for the help!
jake-harrington
@jake-harrington
in that case do you need to use intern.registerPlugin()?
Jason Cheatham
@jason0x43
Either should technically work, but use registerPlugin. registerReporter just calls registerPlugin in the background, and it will likely be removed in a future release.
jake-harrington
@jake-harrington
image.png
image.png
image.png
anything obvious i'm not doing right here?
Jason Cheatham
@jason0x43
"node": {
  "plugins": { "script": "TESTS/intern-reporter.js" }
}
jake-harrington
@jake-harrington
Thank you!! That's what did it
loiclegoff
@loiclegoff
@jason0x43 Sorry for my late response but thank you, it works good :)
lullaby
@yvfisch
Hello! I am running INTERN Tests in Jenkins using the Junit-Reporter. If an error occurs in the "before" setup, a suite error is recognized by the runner, but the junit-reporter marks no error/skipped/whatever for the suite and it's testcases. So in Jenkins the tests are green because the junit report is green while half of the tests might fail with suite errors during the before setup. How can I fix this, so that tests with suite errors are recognized by the junit reporter as failures or at least as skipped tests?
Jason Cheatham
@jason0x43
The most immediate solution would be to create a custom version of the JUnit reporter. It's not the most ideal solution, but the fastest. There's also an open PR related to that issue (#955) that's feel off the radar, but should take care of the problem.
lullaby
@yvfisch
thank you!
Ondrej Medek
@xmedeko
Hi, is if possible e.g. to log the suite errors to console.error? We have sometimes test suites with before() returning a Promise. All works fine, but if there's some error thrown, I see just "Suite error".
Jason Cheatham
@jason0x43

How are you running Intern? I mean, if it's in Node and you're using the default reporter, you should see normal error output for a suite error. For example, with a suite containing this:

        before() {
            return new Promise((_resolve, reject) => {
                reject(new Error('failed'));
            });
        },

Intern's default reporter displays:

Suite node - fool FAILED
Error: failed
  @ tests/unit/foo.ts:7:12
  at new Promise @ anonymous
  at Suite.before @ tests/unit/foo.ts:6:11
  @ src/lib/Suite.ts:433:55
  at runLifecycleMethod @ src/lib/Suite.ts:398:14
  at before @ src/lib/Suite.ts:497:14
TOTAL: tested 1 platforms, 0 passed, 0 failed, 1 skipped, 2 not run; suite error occurred
Ondrej Medek
@xmedeko
I'm running them in a browser with html reporter.
Jason Cheatham
@jason0x43
By default the Console reporter should also be enabled, and you should see test results in the console, unless you're specifically only using the Html reporter.
Ondrej Medek
@xmedeko
Yeah, I've been using reportes=html only, adding console has helped. Thanks!
David Schontzler
@schontz
@jason0x43 Is this still up to date? Specifically, YCM and not an LSP? https://www.sitepen.com/blog/a-modern-terminal-based-development-environment/
Jason Cheatham
@jason0x43
@schontz Since that article I've switched to coc (https://github.com/neoclide/coc.nvim) and its ecosystem. Coc is basically a port of the VScode ecosystem to vim. It's written in JS and includes a number of LSP plugins (TS, python, rust, java, ...) and language support plugins (angular, css, json). It's not without its occasional hiccups, but overall it's very easy to get up and running and is pretty performant.
David Schontzler
@schontz
@jason0x43 Sounds good. I love VS Code for its IDE-ness, but it's VIM mode is only so good and it slows down frequently...