From: Justin Wind <justin.wind+git@gmail.com>
Date: Thu, 1 Aug 2024 22:32:19 +0000 (-0700)
Subject: throw if sinon not provided
X-Git-Tag: v3.0.0~2
X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4bd482b2cd816f01afa752446f8721f4e75a2fa5;p=squeep-test-helper

throw if sinon not provided
---

diff --git a/lib/stub-logger.js b/lib/stub-logger.js
index 428fdd0..9564c84 100644
--- a/lib/stub-logger.js
+++ b/lib/stub-logger.js
@@ -1,7 +1,10 @@
 'use strict';
 
+const assert = require('node:assert');
+
 class StubLogger {
   constructor(sinon, verbose = false) {
+    assert.strictEqual(sinon?.constructor?.name, 'Sandbox', 'sinon dependency not recognized');
     this.sinon = sinon;
     const logger = (process.env.VERBOSE_TESTS || verbose) ? console : this.constructor._nullLogger;
     Object.keys(this.constructor._nullLogger).forEach((level) => {
diff --git a/test/lib/stub-logger.js b/test/lib/stub-logger.js
index 3d5bb6a..528fba5 100644
--- a/test/lib/stub-logger.js
+++ b/test/lib/stub-logger.js
@@ -17,6 +17,11 @@ describe('StubLogger', function () {
       assert(logger[level][property]);
     });
   }
+  describe('sinon dependency', function () {
+    it('is required', function () {
+      assert.throws(() => new StubLogger(), assert.AssertionError);
+    });
+  });
   describe('null logger', function () {
     beforeEach(function () {
       logger = new StubLogger(sinon);
@@ -59,4 +64,4 @@ describe('StubLogger', function () {
       assertAllLevels('notCalled');
     });
   }); // console logger
-}); // StubLogger
\ No newline at end of file
+}); // StubLogger