-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from iambumblehead/add-plain-tests
Add plain tests
- Loading branch information
Showing
7 changed files
with
421 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import test from 'node:test'; | ||
import assert from 'node:assert/strict'; | ||
import esmock from '../../src/esmock.js'; | ||
|
||
test('should throw error if !esmockloader', async () => { | ||
global.esmockloader = false; | ||
await assert.rejects(() => esmock('./to/module.js'), { | ||
message : 'process must be started with --loader=esmock' | ||
}); | ||
global.esmockloader = true; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import test from 'node:test'; | ||
import assert from 'assert'; | ||
import esmock from '../../src/esmock.js'; | ||
|
||
// this error can occur when sources do not define 'esmockloader' | ||
// on 'global' but use a process linked variable instead | ||
test('should not error when esmock used with ava.only', { | ||
only : true | ||
}, async () => { | ||
await esmock('../local/mainUtil.js', { | ||
'form-urlencoded' : () => 'mock encode' | ||
}); | ||
|
||
assert.ok(true); | ||
}); |
Oops, something went wrong.