Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
masking-tape
Advanced tools
A tape test harness with "beforeEach", "afterEach", and "afterAll" lifecycle hooks. Also lets you add an identifying comment to the beginning of each test file's run.
var mask = require('masking-tape')
// a pretend module that overrides http requests, like sinon's fakeServer,
// perhaps
var mockServer = require('mock-server')
var server = new mockServer
var test = mask('my bestest test', afterAll, beforeEach, afterEach)
function beforeEach() {
// maybe we've got a dom available.
document.body.innerHTML = '<div>test html</div>'
}
function afterEach() {
server.removeAllEndpoints()
}
function afterAll() {
mockServer.teardownAll()
}
test('my coolestest test', function(t) {
/*
* This is just a normal tape test.
*/
t.end()
})
var test = mask(name, afterAll, beforeEach, afterEach)
name
: a string to be printed as a comment before the test runs. Can have
multiple lines: Each line will have #
prepended to it.
afterAll
: A function to be run after each test completes. This is necessary
because by default tape runs all tests in the same environment, so leaving it
out can pollute your test run.
beforeEach
: A function to be run before each test begins. There is no
functionality to schedule the next test after an asynchronous process
specified in before
completes. The next test will be queued as
soon as this function returns.
afterEach
: A function to be run after each tests completes. masking-tape
does
not support asynchronous function calls here, meaning that the next test will
be queued as soon as this function returns.
Errors occurring in these functions are unhandled. Tracebacks should be easy to follow because of the complete lack of asynchronous support.
The function returned by require('masking-tape')
has an attribute attached to
it called .stream
. require('masking-tape').stream
is a function that
returns a stream. tape
's stream of text data is piped into the returned
stream in order to report test results. The "class" method is available to
support tests, but you could also use it to report test results across a
network, or in a browser. The default stream lives in
lib/reporter.js
<insert module here>
This module implements its functionality without overriding any tape methods, or adding unnecessary clutter to tape's output. It simply makes a test harness, and creates an object stream which informs the client of the test's life-cycle.
The only caveat is we had to write a custom reporter stream for writing to stdout, since tape does not expose the reporter it uses internally.
Please see the contributing guidelines.
FAQs
a tape harness with life-cycle hooks.
The npm package masking-tape receives a total of 2 weekly downloads. As such, masking-tape popularity was classified as not popular.
We found that masking-tape 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.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.