From 0ef19376e68961a91c4766fc70fcd6b61802dd11 Mon Sep 17 00:00:00 2001 From: Vladimir Grenaderov Date: Tue, 14 Mar 2023 20:15:06 +0000 Subject: [PATCH] strictest fail demo --- tests/local/strictest.js | 4 ++++ tests/tests-node/esmock.node.test.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/local/strictest.js diff --git a/tests/local/strictest.js b/tests/local/strictest.js new file mode 100644 index 00000000..a4558bb2 --- /dev/null +++ b/tests/local/strictest.js @@ -0,0 +1,4 @@ +import { log } from "console"; +import { basename } from "path"; + +log(basename(import.meta.url)); diff --git a/tests/tests-node/esmock.node.test.js b/tests/tests-node/esmock.node.test.js index 099f29e4..388485c2 100644 --- a/tests/tests-node/esmock.node.test.js +++ b/tests/tests-node/esmock.node.test.js @@ -434,6 +434,18 @@ test('should throw error when strict mock definition not found', async () => { assert.deepEqual(pathWrapPartial.basename('/dog.png'), 'dog.png') }) +test('should error when "strictest" called with defs: {}', async () => { + await assert.rejects(async () => esmock.strictest( + '../local/strictest.js', {} + )); +}); + +test('should error when "strictest" called with defs: undefined', async () => { + await assert.rejects(async () => esmock.strictest( + '../local/strictest.js' + )); +}); + test('should error when "strictest" mock tree module not mocked', async () => { const strictestTree = await esmock.strictest( '../local/importsCoreLocalAndPackage.js', {