From af35e4b44644b9f3b1de7672c0e21aa863814954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Yves=20G=C3=A9rardy?= Date: Wed, 29 Nov 2017 21:46:26 +0100 Subject: [PATCH] Make ospec work natively in browser environments --- ospec/ospec.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ospec/ospec.js b/ospec/ospec.js index 5b29ec84..51e60e55 100644 --- a/ospec/ospec.js +++ b/ospec/ospec.js @@ -1,7 +1,9 @@ /* eslint-disable global-require, no-bitwise, no-process-exit */ "use strict" - -module.exports = new function init(name) { +;(function(m) { +if (typeof module !== "undefined") module["exports"] = m() +else window.o = m() +})(function init(name) { var spec = {}, subjects = [], results, only = null, ctx = spec, start, stack = 0, nextTickish, hasProcess = typeof process === "object", reporter, hasOwn = ({}).hasOwnProperty if (name != null) spec[name] = ctx = {} @@ -265,4 +267,4 @@ module.exports = new function init(name) { } return o -} +})