New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fly-mocha

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fly-mocha - npm Package Compare versions

Comparing version 0.5.0 to 1.0.0

yarn.lock

23

index.js

@@ -0,14 +1,21 @@

const {format} = require("path")
const Mocha = require("mocha")
module.exports = function () {
this.mocha = function (opts) {
module.exports = {
name: "mocha",
every: false,
* func(files, opts) {
const mocha = new Mocha(opts)
return new Promise((resolve, reject) => {
this.unwrap((files) => {
files.forEach(f => mocha.addFile(f))
mocha.run((failures) => failures > 0
? reject(failures + " error(s).") : resolve())
})
for (const file of files) {
mocha.addFile( format(file) )
}
mocha.run(errors => {
if (errors > 0) {
return this.emit("plugin_error", {
error: `${errors} error(s).`,
plugin: "fly-mocha"
})
}
})
}
}
{
"name": "fly-mocha",
"version": "0.5.0",
"version": "1.0.0",
"description": "Mocha plugin for Fly",

@@ -9,9 +9,3 @@ "license": "MIT",

"scripts": {
"lint": "eslint *.js",
"setup": "npm i && npm test",
"spec": "npm run test | tspec",
"test": "npm run lint && npm run test-harmony",
"build": "echo No build task specified.",
"deploy": "npm run test && git push origin master && npm publish",
"test-harmony": "node test-harmony"
"test": "eslint *.js && tape test/*.js | tap-spec"
},

@@ -30,10 +24,10 @@ "author": "Jorge Bucaran",

"devDependencies": {
"fly-util": "^4.0.1",
"eslint": "^2.7.0",
"tap-spec": "^4.0.2",
"eslint": "^3.14.1",
"fly": "^2.0.0",
"fly-clear": "^1.0.0",
"tap-spec": "^4.1.1",
"tape": "^4.0.0"
},
"engines": {
"iojs": ">= 1.0.0",
"node": ">= 0.11.0"
"node": ">= 6"
},

@@ -40,0 +34,0 @@ "keywords": [

@@ -46,12 +46,12 @@ <div align="center">

[fly]: https://www.github.com/flyjs/fly
[fly-badge]: https://img.shields.io/badge/fly-JS-05B3E1.svg?style=flat-square
[mit-badge]: https://img.shields.io/badge/license-MIT-444444.svg?style=flat-square
[fly-badge]: https://img.shields.io/badge/fly-JS-05B3E1.svg?style=flat-square&maxAge=2592000
[mit-badge]: https://img.shields.io/badge/license-MIT-444444.svg?style=flat-square&maxAge=2592000
[npm-pkg-link]: https://www.npmjs.org/package/fly-mocha
[npm-ver-link]: https://img.shields.io/npm/v/fly-mocha.svg?style=flat-square
[dl-badge]: http://img.shields.io/npm/dm/fly-mocha.svg?style=flat-square
[npm-ver-link]: https://img.shields.io/npm/v/fly-mocha.svg?style=flat-square&maxAge=2592000
[dl-badge]: http://img.shields.io/npm/dm/fly-mocha.svg?style=flat-square&maxAge=2592000
[travis-link]: https://travis-ci.org/flyjs/fly-mocha
[travis-badge]: http://img.shields.io/travis/flyjs/fly-mocha.svg?style=flat-square
[travis-badge]: http://img.shields.io/travis/flyjs/fly-mocha.svg?style=flat-square&maxAge=2592000
[david-link]: https://david-dm.org/flyjs/fly-mocha
[david-badge]: https://img.shields.io/david/flyjs/fly-mocha.svg?style=flat-square
[david-dev-link]: https://david-dm.org/flyjs/fly-mocha#info=devDependencies&view=table
[david-dev-badge]: https://img.shields.io/david/dev/flyjs/fly-mocha.svg?style=flat-square
[david-badge]: https://img.shields.io/david/flyjs/fly-mocha.svg?style=flat-square&maxAge=2592000
[david-dev-link]: https://david-dm.org/flyjs/fly-mocha?type=dev
[david-dev-badge]: https://img.shields.io/david/dev/flyjs/fly-mocha.svg?style=flat-square&maxAge=2592000

@@ -1,33 +0,29 @@

const test = require("tape").test
const join = require("path").join
const bind = require("fly-util").bind
const state = {
pass: {
msg: "pass spec",
spec: [join("test", "spec", "pass.js")]
},
fail: {
msg: "fail spec",
spec: [join("test", "spec", "fail.js")]
}
}
const unwrap = function (f) { f(this.spec) }
const {join} = require("path")
const test = require("tape")
const Fly = require("fly")
const dir = join(__dirname, "spec")
test("fly-mocha", function (t) {
t.plan(3)
t.plan(5)
const fly = {}
require(bind("../")).call(fly)
const fly = new Fly({
plugins: [require("../")],
tasks: {
* foo(f) {
f.emit = (str, obj) => {
t.equal(str, "plugin_error", "emits `plugin_error` on errors")
t.true(/1/.test(obj.error), "emits with # of errors")
}
yield f.source(`${dir}/pass.js`).mocha()
t.pass("pass spec")
yield f.source(`${dir}/fail.js`).mocha()
t.pass("fail spec")
}
}
})
t.ok(fly.mocha !== undefined, "inject mocha in fly instance")
t.true("mocha" in fly.plugins, "attach mocha() to fly")
fly.unwrap = unwrap.bind(state.pass)
fly.mocha()
.then(() => t.ok(true, state.pass.msg))
.catch(() => t.ok(false, state.pass.msg))
fly.unwrap = unwrap.bind(state.fail)
fly.mocha()
.then(() => t.ok(false, state.fail.msg))
.catch(() => t.ok(true, state.fail.msg))
fly.start("foo")
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc