Gathering detailed insights and metrics for example-runner
Gathering detailed insights and metrics for example-runner
npm install example-runner
Typescript
Module System
NPM Version
JavaScript (100%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
180,723
Last Day
9
Last Week
33
Last Month
125
Last Year
2,423
1 Stars
12 Commits
12 Watchers
2 Branches
1 Contributors
Updated on Jan 28, 2023
Latest Version
0.2.0
Package Id
example-runner@0.2.0
Size
4.08 kB
NPM Version
1.4.23
Published on
Aug 27, 2014
Cumulative downloads
Total Downloads
Last Day
350%
9
Compared to previous day
Last Week
22.2%
33
Compared to previous week
Last Month
54.3%
125
Compared to previous month
Last Year
-84.8%
2,423
Compared to previous year
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
.
1require('example-runner').runCLI();
You can run specific files if you want:
1require('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:
1require('example-runner').runCLI({
2 transform: function(source, testName, filename, options) {
3 return sweetjs.compile(source);
4 }
5});
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.
1require('example-runner').runCLI({ 2 context: { mydata: [1, 2], mylib: require('mylib') } 3});
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 examplesNo vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
project is archived
Details
Reason
no SAST tool detected
Details
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-02-17
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More