
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
create-test-promise
Advanced tools
Creates a function that returns a promise whose resultant state is dependent on whether the included code throws or rejects.
You can pass in a any of the folloing:
You can pass in a second parameter, an options object, with the following option property:
timeout: number of milliseconds after which to time the test out.
Default is Infinity.const test = require('create-test-promise')
function shouldFail () {
throw new Error('this one should have failed')
}
function noop () {}
Promise.all([
test(function () {})(),
test(function () {
throw new Error('foo')
})().then(shouldFail, noop),
test(Promise.resolve())(),
test(Promise.reject(new Error('foo')))().then(shouldFail, noop),
test(function () {
return Promise.resolve()
})(),
test(function () {
return Promise.reject(new Error('foo'))
})().then(shouldFail, noop),
test(function (cb) {
cb()
})(),
test(function (cb) {
cb(new Error('foo'))
})().then(shouldFail, noop),
test(function (cb) {
setTimeout(cb, 10)
}, { timeout: 100 })
]).catch(function(e){
console.error(e.stack)
console.error('none of these should have failed!')
process.exit(1)
})
See LICENSE.txt
FAQs
creates a promise for a single test case (originally for pitesti)
We found that create-test-promise 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
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.