Skip to content

Commit

Permalink
strictest fail demo
Browse files Browse the repository at this point in the history
  • Loading branch information
koshic committed Mar 14, 2023
1 parent 8838e6a commit 0ef1937
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/local/strictest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { log } from "console";
import { basename } from "path";

log(basename(import.meta.url));
12 changes: 12 additions & 0 deletions tests/tests-node/esmock.node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down

0 comments on commit 0ef1937

Please sign in to comment.