This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix: official repo to list Solidity's releases #5008
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
320db95
Fix: official repo to list Solidity's releases
Neurone 3b0e4f6
New urls for solc binaries;
Neurone 18f85cb
redo the list of url roots for fetching the Solidity compiler
eggplantzzz c709ec6
rewrite test to dynamically find the cached compiler filename
eggplantzzz 301ae21
adjust obtain tests
eggplantzzz 248dcb8
make a test update or two
eggplantzzz 0f320f3
correct mistake in test
eggplantzzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,55 +6,52 @@ const path = require("path"); | |
const assert = require("assert"); | ||
const sandbox = require("../sandbox"); | ||
|
||
let logger, config, project, expectedPath; | ||
let logger, config, project, compilersCacheDirectory; | ||
|
||
describe("truffle obtain", function () { | ||
project = path.join(__dirname, "../../sources/obtain"); | ||
|
||
beforeEach(async function () { | ||
expectedPath = path.join( | ||
compilersCacheDirectory = path.join( | ||
Config.getTruffleDataDirectory(), | ||
"compilers", | ||
"node_modules", | ||
"soljson-v0.7.2+commit.51b20bc0.js" | ||
"node_modules" | ||
); | ||
this.timeout(10000); | ||
config = await sandbox.create(project); | ||
logger = new MemoryLogger(); | ||
config.logger = logger; | ||
|
||
// ensure the compiler is not cached beforehand | ||
if (fse.existsSync(compilersCacheDirectory)) { | ||
fse.removeSync(compilersCacheDirectory); | ||
} | ||
}); | ||
|
||
afterEach(() => { | ||
if (fse.existsSync(compilersCacheDirectory)) { | ||
fse.removeSync(compilersCacheDirectory); | ||
} | ||
}); | ||
|
||
it("fetches the solc version specified", async function () { | ||
this.timeout(70000); | ||
// ensure the compiler does not yet exist | ||
try { | ||
fse.unlinkSync(expectedPath); | ||
} catch (error) { | ||
// unlink throws when file doesn't exist | ||
if (error.code !== "ENOENT") { | ||
throw error; | ||
} | ||
} | ||
await CommandRunner.run("obtain --solc=0.7.2", config); | ||
assert(fse.statSync(expectedPath), "The compiler was not obtained!"); | ||
fse.unlinkSync(expectedPath); | ||
const cachedCompilersFilenames = fse.readdirSync(compilersCacheDirectory); | ||
|
||
assert( | ||
cachedCompilersFilenames.some(filename => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same note here as earlier about |
||
return filename.includes("v0.7.2+commit.51b20bc0"); | ||
}), | ||
"The compiler was not obtained!" | ||
); | ||
}); | ||
|
||
it("respects the `quiet` option", async function () { | ||
this.timeout(80000); | ||
// ensure the compiler does not yet exist | ||
try { | ||
fse.unlinkSync(expectedPath); | ||
} catch (error) { | ||
// unlink throws when file doesn't exist | ||
if (error.code !== "ENOENT") { | ||
throw error; | ||
} | ||
} | ||
await CommandRunner.run("obtain --solc=0.7.2 --quiet", config); | ||
// logger.contents() returns false as long as nothing is written to the | ||
// stream that is used for logging in MemoryLogger | ||
|
||
// in Node12, Ganache prints a warning and it cannot be suppressed | ||
// I guess we have to allow it until we stop supporting Node12 | ||
const ganacheNode12WarningRegex = | ||
|
@@ -68,6 +65,5 @@ describe("truffle obtain", function () { | |
!loggedStuff, | ||
"The command logged to the console when it shouldn't have." | ||
); | ||
fse.unlinkSync(expectedPath); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is truly nitpicking and you don't need to change this, but
filename => { return foo; }
could instead just befilename => foo
.