ospec
Advanced tools
Comparing version 4.1.3 to 4.1.4
11
ospec.js
@@ -35,2 +35,3 @@ "use strict" | ||
var hasProcess = typeof process === "object", hasOwn = ({}).hasOwnProperty | ||
var hasSuiteName = arguments.length !== 0 | ||
@@ -531,3 +532,3 @@ var only = [] | ||
var aIsArgs = isArguments(a), bIsArgs = isArguments(b) | ||
if (a.constructor === Object && b.constructor === Object && !aIsArgs && !bIsArgs) { | ||
if (a.constructor === Object && b.constructor === Object && !aIsArgs && !bIsArgs || Object.getPrototypeOf(a) == null && Object.getPrototypeOf(b) == null) { | ||
for (var i in a) { | ||
@@ -556,2 +557,3 @@ if ((!(i in b)) || !deepEqual(a[i], b[i])) return false | ||
} | ||
if (typeof a.valueOf !== "function" || typeof b.valueOf !== "function") return false | ||
if (a.valueOf() === b.valueOf()) return true | ||
@@ -589,5 +591,7 @@ } | ||
} | ||
// workaround for Rollup | ||
// direct `require` calles are hoisted at the top of the file | ||
// and ran unconditionally. | ||
function serialize(value) { | ||
if (hasProcess) return require("util").inspect(value) // eslint-disable-line global-require | ||
var serialize = function serialize(value) { | ||
if (value === null || (typeof value === "object" && !(value instanceof Array)) || typeof value === "number") return String(value) | ||
@@ -597,2 +601,3 @@ else if (typeof value === "function") return value.name || "<anonymous function>" | ||
} | ||
try {serialize = require("util").inspect} catch(e) {/* deliberately empty */} // eslint-disable-line global-require | ||
@@ -599,0 +604,0 @@ // o.spy is functionally equivalent to this: |
{ | ||
"name": "ospec", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"description": "Noiseless testing framework", | ||
@@ -30,10 +30,11 @@ "main": "ospec.js", | ||
"self-test-cli": "node ./bin/ospec tests/test-cli.js", | ||
"lint": "eslint . bin/ospec" | ||
"lint": "eslint --cache --ignore-pattern \"tests/fixtures/**/*.*\" . bin/ospec", | ||
"lint-fix": "eslint --cache --ignore-pattern \"tests/fixtures/**/*.*\" --fix . bin/ospec" | ||
}, | ||
"devDependencies": { | ||
"cmd-shim": "4.0.2", | ||
"compose-regexp": "0.6.22", | ||
"compose-regexp": "^0.6.22", | ||
"eslint": "^6.8.0", | ||
"ospec-stable": "npm:ospec@4.1.2-postinstall-experiments" | ||
"ospec-stable": "npm:ospec@4.1.3" | ||
} | ||
} |
// This is a dev script that is shipped with the package because | ||
// I couldn't find a cross-platform way of running code conditionally | ||
// The shell syntaxes are too complex. | ||
"use strict" | ||
// eslint-disable no-process-exit | ||
const {rename} = require("node:fs/promises") | ||
const glob = require("glob") | ||
let count = 0 | ||
glob("node_modules/.bin/ospec*(.*)") | ||
.on("match", x => {rename(x, x.replace(/ospec(?:-stable)?((?:\.\w+)?)/, "ospec-stable$1"))}) | ||
.on("match", (x) => {count++; rename(x, x.replace(/ospec(?:-stable)?((?:\.\w+)?)/, "ospec-stable$1"))}) | ||
.on("error", e => { | ||
console.error(e) | ||
process.exit(1) | ||
}) | ||
.on("error", (e) => { | ||
throw e | ||
}) | ||
.on("end", () => {process.exit(0)}) | ||
.on("end", () => {if (count !== 0) console.log(`We renamed ${count} file${count > 1 ? "s" : ""}`)}) |
Sorry, the diff of this file is not supported yet
52528
703