Skip to content

Commit 98e151a

Browse files
committed
since we moved to esm we no longer need proxyquire
1 parent e800d69 commit 98e151a

File tree

5 files changed

+74
-133
lines changed

5 files changed

+74
-133
lines changed

package-lock.json

Lines changed: 56 additions & 102 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@
8888
"node": ">=16"
8989
},
9090
"devDependencies": {
91-
"@babel/code-frame": "^7.25.7",
91+
"@babel/code-frame": "^7.25.9",
9292
"@types/jest": "^29.5.13",
9393
"@types/semver": "^7.5.8",
9494
"@types/strip-comments": "^2.0.4",
95-
"@typescript-eslint/eslint-plugin": "^8.10.0",
96-
"@typescript-eslint/parser": "^8.10.0",
95+
"@typescript-eslint/eslint-plugin": "^8.11.0",
96+
"@typescript-eslint/parser": "^8.11.0",
9797
"c8": "^9.1.0",
9898
"cross-env": "^7.0.3",
9999
"eslint": "^9.13.0",
@@ -107,7 +107,6 @@
107107
"jest-watch-typeahead": "^2.2.2",
108108
"lines-and-columns": "^2.0.4",
109109
"prettier": "^3.3.3",
110-
"proxyquire": "^2.1.3",
111110
"solc": "^0.8.28",
112111
"strip-comments": "^2.0.1",
113112
"ts-loader": "^9.5.1",

tests/unit/prettier-version/esmock-plugin.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import esmock from 'esmock';
2-
import prettier from 'prettier';
2+
import getPrettier from '../../config/get-prettier.js';
3+
4+
const prettier = await getPrettier();
35

46
const esmockPlugin = async () => {
57
const prettierMock = { ...prettier, version: '2.2.1' };
68

7-
const plugin = await esmock(
8-
'../../../src/index.ts',
9-
{},
10-
{ prettier: prettierMock }
11-
);
9+
const pluginPath = process.env.TEST_STANDALONE
10+
? '../../../dist/standalone.js'
11+
: '../../../src/index.ts';
12+
13+
const mockedObject = process.env.TEST_STANDALONE
14+
? { 'prettier/standalone': prettierMock }
15+
: { prettier: prettierMock };
16+
17+
const plugin = await esmock(pluginPath, {}, mockedObject);
1218

1319
return { plugin, prettierMock };
1420
};

tests/unit/prettier-version/index.test.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
test('should throw if the installed version of prettier is less than v2.3.0', async () => {
2-
const entry = process.env.TEST_STANDALONE
3-
? new URL('./proxyquire-plugin.cjs', import.meta.url) // standalone uses proxyquire to mock cjs
4-
: './esmock-plugin.js'; // uses esmock to mock esm
1+
import esmockPlugin from './esmock-plugin.js';
52

6-
const { plugin, prettierMock } = await import(entry).then((module) =>
7-
module.default()
8-
);
3+
test('should throw if the installed version of prettier is less than v2.3.0', async () => {
4+
const { plugin, prettierMock } = await esmockPlugin();
95

106
const data = 'contract CheckPrettierVersion {}';
117

tests/unit/prettier-version/proxyquire-plugin.cjs

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)