
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
example-runner
Advanced tools
Run example files with assertions. example-runner can be used as a very basic test runner, optionally with a source transform function. This makes it suitable for testing JavaScript-to-JavaScript compilers such as es6-class, where it is used.
$ npm install [--save-dev] example-runner
example-runner has two exported functions: run
and runCLI
. Most of the time
you'll probably want to use runCLI
which prints to stdout and exits with the
appropriate status code. If you need to customize the output or exit behavior
of example-runner, such as to fit it into another tool, you can use run
.
With no arguments, runCLI
will run test/examples/*.js
.
require('example-runner').runCLI();
You can run specific files if you want:
require('example-runner').runCLI(['a.js', 'b.js']);
Provide the transform
option if you want to modify your examples before
running, such as with sweet.js:
require('example-runner').runCLI({
transform: function(source, testName, filename, options) {
return sweetjs.compile(source);
}
});
The arguments given to transform
are:
.js
suffix./* config a:b, log:true */
in the
source file will create options like so: { config: { a: "b", log: true } }
.If you need to pass data to your example files, use the context
option.
require('example-runner').runCLI({
context: { mydata: [1, 2], mylib: require('mylib') }
});
Note that there are some default context properties:
/* example-runner assert:false */
at the top of your
example file.transform
(see
above).Like runCLI()
, run()
takes files and options. Unlike runCLI()
it returns
an EventEmitter
that emits three events:
pass(testName)
: called when an example file passesfail(testName, error)
: called when an example file fails, along with the
error throwndone(passed, failed)
: called when all tests have run, along with the
names of the passed and failed examplesFAQs
Runner for example files, usually tests.
The npm package example-runner receives a total of 16 weekly downloads. As such, example-runner popularity was classified as not popular.
We found that example-runner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.