We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
globals
1 parent 9bae18e commit 712e5dcCopy full SHA for 712e5dc
__tests__/require.test.ts
@@ -18,13 +18,18 @@ it('should work with relative require in file', () => {
18
expect(res).toBe('hi')
19
})
20
21
+it('should work with provided globals', () => {
22
+ const res = requireFromString('module.exports = process.cwd()', { process })
23
+ expect(res).toBe(process.cwd())
24
+})
25
+
26
it('should have meaningful error message', () => {
27
expect.assertions(1)
28
try {
29
requireFromString("throw new Error('Boom!')")
30
} catch (err) {
31
expect(
- err.stack.search(/module-from-string\/__tests__\/require\.test\.ts:24:5/)
32
+ err.stack.search(/module-from-string\/__tests__\/require\.test\.ts:29:5/)
33
).toBeGreaterThan(-1)
34
}
35
0 commit comments