Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
testling
Advanced tools
Changelog
v1.7.5 - 2024-02-15
object-inspect
, resolve
, shell-quote
eeba066
<br />
instead of a newline, for IE < 8 e7b99cf
^
74b1923
object-inspect
, resolve
28ace20
tape
6b716f2
tape
50ee689
resolve
a7ab4ee
tape
8e2490e
Readme
Run testling-ci tests locally.
write a test:
var test = require('tape');
test('beep boop', function (t) {
t.plan(2);
t.equal(1+1, 2);
t.ok(true);
});
run your test in a local headless browser:
$ browserify example/test.js | testling
TAP version 13
# beep boop
ok 1 should be equal
ok 2 (unnamed assert)
1..2
# tests 2
# pass 2
# ok
with an exit code of 0 for successes and non-zero for failures like a good unix citizen
Once you have a package.json
with a configured "testling"
field, you can just
type:
$ testling
to run all your tests locally just like they will be run on testling-ci. This includes mocha harnesses, scripts, and files parameters.
usage: testling {DIRECTORY|-} {OPTIONS}
If there (is no DIRECTORY and stdin is a tty) or the DIRECTORY is "-",
javascript will be read from stdin and executed.
Otherwise, DIRECTORY (or the $CWD) will be checked for a package.json with a
testling field.
OPTIONS are:
--html Instead of launching a server, show the generated html.
--no-show Don't render the console.log() output to the document body.
-u Instead of launching a browser, print the url to visit so you can
open the browser yourself.
-x Launch a browser with an explicit command. By default, chrome or
firefox is launched by searching your $PATH.
--host Set up the testling url on a specific hostname. Default: localhost
--port Set up the testling url on a specific port
Read more about how the package.json "testling" field works.
To compute code coverage, just use the
coverify
transform with -t coverify
when you run browserify.
coverify writes coverage data with
console.log(), so you can pipe the output of testling through to the coverify
command to parse the results and give human-readable output:
$ browserify -t coverify test.js | testling | coverify
TAP version 13
# beep boop
ok 1 should be equal
1..1
# tests 1
# pass 1
# ok
# /home/substack/projects/coverify/example/test.js: line 7, column 16-28
if (err) deadCode();
^^^^^^^^^^^
# /home/substack/projects/coverify/example/foo.js: line 3, column 35-48
if (i++ === 10 || (false && neverFires())) {
^^^^^^^^^^^^
The exit code of coverify is non-zero when there are unreachable expressions.
Make sure you have PhantomJS installed; this is the headless browser that testling will run your tests in if you are not using the -u
option.
First, install browserify
globally so that the testling
command can find it
when there is no browserify
in ./node_modules/.bin
:
npm install -g browserify
then do:
npm install -g testling
MIT
FAQs
write tests for browser code
The npm package testling receives a total of 173 weekly downloads. As such, testling popularity was classified as not popular.
We found that testling demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.