Skip to content

Commit

Permalink
add failing test, re issue 312
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Oct 2, 2024
1 parent 253eec5 commit f5b3903
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/local/importsChangelogParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import parseChangelog from 'changelog-parser'

export default parseChangelog
1 change: 1 addition & 0 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"dependencies": {
"express": "^4.18.2",
"changelog-parser": "^3.0.1",
"@aws-sdk/client-s3": "^3.408.0",
"babelGeneratedDoubleDefault": "file:./local/babelGeneratedDoubleDefault",
"eslint": "^8.54.0",
Expand Down
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 @@ -5,6 +5,18 @@ import esmock from 'esmock'
import sinon from 'sinon'
import esmockCache from '../../src/esmockCache.js'

// https://github.com/iambumblehead/esmock/issues/312
test('should mock changelog-parser', {skip: true}, async () => {
const parseChangelog = await esmock(
'../local/importsChangelogParser.js', {}, {
'node:fs': {
read: test.mock.fn(() => 'content')
}
})

assert.strictEqual(await parseChangelog({ filePath: 'fake' }), 'content')
})

test('should mock node:process', async () => {
// has direct and in-direct calls to `process.cwd()`
const thingBeingTested = await esmock('../local/usesNodeProcess.js', {}, {
Expand Down

0 comments on commit f5b3903

Please sign in to comment.