@0x/sol-compiler: Make source paths in output artifacts nicer if they're within modules.

`@0x/sol-compiler`: Makea Add v0.6 solidity test.
This commit is contained in:
Lawrence Forman
2020-03-30 15:54:27 -04:00
parent b36373ab81
commit 6e29c8bea9
3 changed files with 72 additions and 8 deletions

View File

@@ -26,7 +26,7 @@ describe('#Compiler', function(): void {
it('should create a Compiler with empty opts', async () => {
const _compiler = new Compiler(); // tslint:disable-line no-unused-variable
});
it('should create an Exchange artifact with the correct unlinked binary', async () => {
it.only('should create an Exchange artifact with the correct unlinked binary', async () => {
compilerOpts.contracts = ['Exchange'];
const exchangeArtifactPath = `${artifactsDir}/Exchange.json`;
@@ -114,4 +114,22 @@ describe('#Compiler', function(): void {
expect(artifact).to.equal('EmptyContract.json');
}
});
it('should compile a V0.6 contract', async () => {
compilerOpts.contracts = ['V6Contract'];
const artifactPath = `${artifactsDir}/V6Contract.json`;
if (fsWrapper.doesPathExistSync(artifactPath)) {
await fsWrapper.removeFileAsync(artifactPath);
}
await new Compiler(compilerOpts).compileAsync();
const opts = {
encoding: 'utf8',
};
const exchangeArtifactString = await fsWrapper.readFileAsync(artifactPath, opts);
const exchangeArtifact: ContractArtifact = JSON.parse(exchangeArtifactString);
const bin = exchangeArtifact.compilerOutput.evm.bytecode.object;
expect(bin.slice(2)).to.length.to.be.gt(0);
});
});