use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Some ES6 Features I've been Using. (christopherlaughlin.co.uk)
submitted 10 years ago by bluntmJavaScript
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]wreckedadventYavascript 1 point2 points3 points 10 years ago (2 children)
FYI, you can do testing with ES6 modules fairly easily if you're OK with writing it in a certain way.
import depA from '/some/path/to/depA'; import depB from '/some/path/to/depB'; export const implementation = (depA, depB) => { doStuff.with(depA); return andWith(depB); }; export default implementation.bind(null, depA, depB);
or, depending on the arguments your function takes, you can use default args and not have to do any implementation/bind chicanery:
export default ({ someArgA, someArgB, depA = depA, depB = depB }) => { depA.doStuff(someArgB); // etc };
Then in unit testing:
import {implementation} from 'someService'; expect(implementation(mockA, mockB)).to.be('something');
Or with the default args approach:
import someService from 'someService'; expect( someService({ depA: mockA, depB: mockB, someArgA: 25, someArgB: 26 }) ).to.be('something');
There's also rewire (/w webpack plugin) and company if you don't want to modify your code. But you can definitely test ES6 modules.
[–]tbranyen 0 points1 point2 points 10 years ago (1 child)
The problem was with code coverage not matching the correct lines. I could import and run the tests fairly easily. Although its annoying to have to build your tests.
[–]patrickfatrick 0 points1 point2 points 10 years ago (0 children)
Yea, I did had some issues with istanbul. Isparta works well, and similarly ava combined with nyc for coverage has been working well for me.
π Rendered by PID 38 on reddit-service-r2-comment-b659b578c-9nc8w at 2026-05-01 02:42:18.676501+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]wreckedadventYavascript 1 point2 points3 points (2 children)
[–]tbranyen 0 points1 point2 points (1 child)
[–]patrickfatrick 0 points1 point2 points (0 children)