Skip to content

Commit 0b51216

Browse files
committed
fix: create temporary directory instead of /tmp
Create temporary directory fix-parentheses require to import add typescript support for tmp add typescript support for tmp compiler.ts add typescript support for tmp compiler.ts v-2 Change tmp import in smtsolver.ts to the correct form implement the suggestions
1 parent bf7d6c7 commit 0b51216

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
},
6060
"devDependencies": {
6161
"@types/node": "^16.11.7",
62+
"@types/tmp": "^0.2.3",
6263
"@types/semver": "^7.3.9",
6364
"@types/tape": "^4.13.2",
6465
"@typescript-eslint/eslint-plugin": "^5.8.0",

test/compiler.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import assert from 'assert';
22
import tape from 'tape';
33
import * as semver from 'semver';
4+
import * as tmp from 'tmp';
45
import solc from '../';
56
import linker from '../linker';
67
import { execSync } from 'child_process';
@@ -888,8 +889,10 @@ if (!noRemoteVersions) {
888889
];
889890
for (let version in versions) {
890891
version = versions[version];
891-
execSync(`curl -L -o /tmp/${version}.js https://binaries.soliditylang.org/bin/soljson-${version}.js`);
892-
const newSolc = wrapper(require(`/tmp/${version}.js`));
892+
// NOTE: The temporary directory will be removed on process exit.
893+
const tempDir = tmp.dirSync({ unsafeCleanup: true, prefix: 'solc-js-compiler-test-' }).name;
894+
execSync(`curl -L -o ${tempDir}/${version}.js https://binaries.soliditylang.org/bin/soljson-${version}.js`);
895+
const newSolc = wrapper(require(`${tempDir}/${version}.js`));
893896
runTests(newSolc, version);
894897
}
895898
}

0 commit comments

Comments
 (0)