Skip to content

Commit

Permalink
chore: replace nyc with c8
Browse files Browse the repository at this point in the history
nyc doesn't support ESM, but c8 does and is a drop in replacement

See https://github.com/bcoe/c8
  • Loading branch information
mroderick committed Jan 20, 2024
1 parent 715083e commit 775439f
Show file tree
Hide file tree
Showing 6 changed files with 410 additions and 2,292 deletions.
5 changes: 3 additions & 2 deletions lib/copy-prototype-methods.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ var disallowedProperties = [

// This branch is covered when tests are run with `--disable-proto=throw`,
// however we cannot test both branches at the same time, so this is ignored
/* istanbul ignore next */
/* c8 ignore start */
if (throwsOnProto) {
disallowedProperties.push("__proto__");
}
/* c8 ignore stop */

/**
* Copies prototype methods into a new object that has no prototype
Expand Down Expand Up @@ -41,6 +42,6 @@ function copyPrototypeMethods(prototype) {
return result;
},
Object.create(null));
};
}

export default copyPrototypeMethods;
1 change: 0 additions & 1 deletion lib/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export function defaultMsg(packageName, funcName) {
* @returns {undefined}
*/
export function printWarning(msg) {
/* istanbul ignore next */
if (typeof process === "object" && process.emitWarning) {
// Emit Warnings in Node
process.emitWarning(msg);
Expand Down
5 changes: 2 additions & 3 deletions lib/global.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
* @type {object} globalObject
*/
var globalObject;

/* istanbul ignore else */
if (typeof global !== "undefined") {
// Node
globalObject = global;
} else if (typeof window !== "undefined") {
} /* c8 ignore start */ else if (typeof window !== "undefined") {
// Browser
globalObject = window;
} else {
// WebWorker
globalObject = self;
}
/* c8 ignore stop */

export default globalObject;
4 changes: 2 additions & 2 deletions lib/throws-on-proto.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ try {
// eslint-disable-next-line no-proto, no-unused-expressions
object.__proto__;
throwsOnProto = false;
} catch (_) {
} /* c8 ignore start */ catch (_) {
// This branch is covered when tests are run with `--disable-proto=throw`,
// however we can test both branches at the same time, so this is ignored
/* istanbul ignore next */
throwsOnProto = true;
}
/* c8 ignore end */

export default throwsOnProto;
Loading

0 comments on commit 775439f

Please sign in to comment.