Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed resolvewithplus #181

Merged
merged 6 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# changelog

* 2.0.7 _Oct.??.2022_
* 2.0.7 _Oct.20.2022_
* [embed resolvewithplus inside esmock,](https://github.com/iambumblehead/esmock/pull/181) to support yarn PnP, per @koshic
* [use loader mechanism to detect](https://github.com/iambumblehead/esmock/pull/180) presence of esmock loader
* [detect and use import.meta.resolve,](https://github.com/iambumblehead/esmock/pull/179) when defined by host environment
* 2.0.6 _Oct.14.2022_
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "esmock",
"type": "module",
"version": "2.0.6",
"version": "2.0.7",
"license": "ISC",
"readmeFilename": "README.md",
"description": "provides native ESM import mocking for unit tests",
Expand Down Expand Up @@ -75,7 +75,7 @@
"test-cover": "npm run test:install && c8 npm run test:all",
"lint": "eslint --ext=.js,.mjs .",
"lint-fix": "eslint --ext=.js,.mjs --fix .",
"mini:pkg": "npm pkg delete scripts devDependencies",
"mini:pkg": "npm pkg delete scripts devDependencies dependencies",
"prepublishOnly": "npm run lint && npm run test-ci && npm run mini:pkg"
}
}
5 changes: 3 additions & 2 deletions src/esmockCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const esmockTreeIdGet = key => (
global.mockKeys[String(key)])

const esmockCacheSet = (key, mockDef) => (
esmockCache.mockDefs[key] = mockDef)
global.esmockCache.mockDefs[key] = mockDef)

const esmockCacheGet = key => (
esmockCache.mockDefs[key])
global.esmockCache.mockDefs[key])

const esmockCacheResolvedPathIsESMGet = mockPathFull => (
esmockCache.isESM[mockPathFull])
Expand All @@ -25,6 +25,7 @@ const esmockCacheResolvedPathIsESMSet = (mockPathFull, isesm) => (
esmockCache.isESM[mockPathFull] = isesm)

Object.assign(global, {
esmockCache,
esmockCacheGet,
esmockTreeIdGet,
mockKeys: {}
Expand Down
4 changes: 1 addition & 3 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
"babelGeneratedDoubleDefault": "file:./local/babelGeneratedDoubleDefault"
},
"scripts": {
"mini:default": "cd .. && npx esbuild ./src/*js --minify --allow-overwrite --outdir=src",
"mini:win32": "cd .. && cd src && forfiles /m \"*.js\" /c \"cmd /c npx esbuild @file --minify --allow-overwrite --outfile=@file\"",
"mini": "run-script-os",
"mini": "cd .. && cd src && npx esbuild esmockLoader.js --minify --bundle --allow-overwrite --platform=node --format=esm --outfile=esmockLoader.js",
"isnodelt18": "node -e \"+process.versions.node.split('.')[0] < 18 || process.exit(1)\"",
"install:esmock": "cd .. && npm install",
"install:test-ava": "cd tests-ava && npm install",
Expand Down