Skip to content

Commit 1ea44ea

Browse files
authored
Fix broken import test using Truffle 5.1.2 (#454)
1 parent 212c88f commit 1ea44ea

File tree

6 files changed

+36
-19
lines changed

6 files changed

+36
-19
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solidity-coverage",
3-
"version": "0.7.0-beta.2",
3+
"version": "0.7.0-beta.3",
44
"description": "",
55
"main": "plugins/buidler.plugin.js",
66
"bin": {
@@ -53,7 +53,7 @@
5353
"mocha": "5.2.0",
5454
"nyc": "^14.1.1",
5555
"solc": "^0.5.10",
56-
"truffle": "^5.0.31",
56+
"truffle": "5.0.31",
5757
"truffle-config": "^1.1.18"
5858
}
5959
}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
pragma solidity >=0.4.21 <0.6.0;
22

33
import "package/AnotherImport.sol";
4-
5-
interface Void {}

test/units/truffle/flags.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ describe('Truffle Plugin: command line options', function() {
2727

2828
afterEach(() => mock.clean());
2929

30+
// Running out of memory...
31+
it('--usePluginTruffle', async function(){
32+
truffleConfig.usePluginTruffle = true;
33+
truffleConfig.logger = mock.testLogger;
34+
35+
mock.install('Simple', 'simple.js', solcoverConfig);
36+
await plugin(truffleConfig);
37+
38+
assert(
39+
mock.loggerOutput.val.includes('fallback Truffle library module'),
40+
`Should notify it's using plugin truffle lib copy: ${mock.loggerOutput.val}`
41+
);
42+
});
43+
3044
it('--file test/<fileName>', async function() {
3145
truffleConfig.file = path.join(
3246
truffleConfig.working_directory,
@@ -186,19 +200,6 @@ describe('Truffle Plugin: command line options', function() {
186200
);
187201
});
188202

189-
it('--usePluginTruffle', async function(){
190-
truffleConfig.usePluginTruffle = true;
191-
truffleConfig.logger = mock.testLogger;
192-
193-
mock.install('Simple', 'simple.js', solcoverConfig);
194-
await plugin(truffleConfig);
195-
196-
assert(
197-
mock.loggerOutput.val.includes('fallback Truffle library module'),
198-
`Should notify it's using plugin truffle lib copy: ${mock.loggerOutput.val}`
199-
);
200-
});
201-
202203
it('--temp', async function(){
203204
truffleConfig.logger = mock.testLogger;
204205

test/units/truffle/standard.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,26 @@ describe('Truffle Plugin: standard use cases', function() {
102102
verify.lineCoverage(expected);
103103
});
104104

105-
it('with relative path solidity imports', async function() {
105+
it('imports: relative path imports & file w/ only-import statements', async function() {
106+
// Earlier versions of truffle crash on this case (5.0.31)
107+
// Later versions of truffle OOM (5.1.2)
108+
truffleConfig.useGlobalTruffle = true;
109+
106110
mock.installFullProject('import-paths');
107111
await plugin(truffleConfig);
112+
113+
const expected = [
114+
{
115+
file: mock.pathToContract(truffleConfig, 'OnlyUsesImports.sol'),
116+
pct: 100
117+
},
118+
{
119+
file: mock.pathToContract(truffleConfig, 'UsesImports.sol'),
120+
pct: 100,
121+
},
122+
];
123+
124+
verify.lineCoverage(expected);
108125
});
109126

110127
it('uses libraries', async function() {

test/util/integration.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const path = require('path');
77
const fs = require('fs');
88
const shell = require('shelljs');
99
const decache = require('decache');
10+
const globalModules = require('global-modules');
1011

1112
const TruffleConfig = require('truffle-config');
1213
const { resetBuidlerContext } = require("@nomiclabs/buidler/plugins-testing")

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7372,7 +7372,7 @@ truffle-provider@^0.1.14:
73727372
truffle-interface-adapter "^0.2.3"
73737373
web3 "1.2.1"
73747374

7375-
truffle@^5.0.31:
7375+
73767376
version "5.0.31"
73777377
resolved "https://registry.yarnpkg.com/truffle/-/truffle-5.0.31.tgz#372a826e330720e29514458ff25750aa2b5efa65"
73787378
integrity sha512-dNBH5OFcqHXCaaQO0YGcEtNarIPcToU+tbq+lBph4tI2YjboiwakguvrNCL+cTP4sySKqeg+2QA1W5miyOQGpA==

0 commit comments

Comments
 (0)