File tree Expand file tree Collapse file tree 15 files changed +179
-14
lines changed
integration/projects/tests-folder Expand file tree Collapse file tree 15 files changed +179
-14
lines changed Original file line number Diff line number Diff line change 3535 "istanbul" : " ^0.4.5" ,
3636 "jsonschema" : " ^1.2.4" ,
3737 "lodash" : " ^4.17.15" ,
38- "node-dir" : " ^0.1.17" ,
3938 "node-emoji" : " ^1.10.0" ,
4039 "pify" : " ^4.0.1" ,
40+ "recursive-readdir" : " ^2.2.2" ,
4141 "shelljs" : " ^0.8.3" ,
4242 "solidity-parser-antlr" : " 0.4.7" ,
4343 "web3" : " 1.2.1" ,
Original file line number Diff line number Diff line change 11const PluginUI = require ( './truffle.ui' ) ;
2-
32const globalModules = require ( 'global-modules' ) ;
43const TruffleProvider = require ( '@truffle/provider' ) ;
5- const dir = require ( 'node-dir ' ) ;
4+ const recursive = require ( 'recursive-readdir ' ) ;
65const globby = require ( 'globby' ) ;
76const path = require ( 'path' ) ;
87
@@ -15,15 +14,15 @@ const path = require('path');
1514 * @param {Object } config truffleConfig
1615 * @return {String[] } list of files to pass to mocha
1716 */
18- function getTestFilePaths ( config ) {
17+ async function getTestFilePaths ( config ) {
1918 let target ;
2019 let ui = new PluginUI ( config . logger . log ) ;
2120
2221
2322 // Handle --file <path|glob> cli option (subset of tests)
2423 ( typeof config . file === 'string' )
2524 ? target = globby . sync ( [ config . file ] )
26- : target = dir . files ( config . testDir , { sync : true } ) || [ ] ;
25+ : target = await recursive ( config . testDir ) ;
2726
2827 // Filter native solidity tests and warn that they're skipped
2928 const solregex = / .* \. ( s o l ) $ / ;
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ async function plugin(config){
9696 ) ;
9797
9898 config . all = true ;
99- config . test_files = truffleUtils . getTestFilePaths ( config ) ;
99+ config . test_files = await truffleUtils . getTestFilePaths ( config ) ;
100100 config . compilers . solc . settings . optimizer . enabled = false ;
101101
102102 // Compile Instrumented Contracts
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ "silent" : false ,
3+ "istanbulReporter" : [ "json-summary" , "text" ]
4+ }
Original file line number Diff line number Diff line change 1+ const { loadPluginFile } = require ( "@nomiclabs/buidler/plugins-testing" ) ;
2+ loadPluginFile ( __dirname + "/../plugins/buidler.plugin" ) ;
3+ usePlugin ( "@nomiclabs/buidler-truffle5" ) ;
4+
5+ module . exports = {
6+ defaultNetwork : "buidlerevm" ,
7+ logger : process . env . SILENT ? { log : ( ) => { } } : console ,
8+ } ;
Original file line number Diff line number Diff line change 1+ pragma solidity ^ 0.5.0 ;
2+
3+
4+ contract ContractA {
5+ uint x;
6+ constructor () public {
7+ }
8+
9+ function sendFn () public {
10+ x = 5 ;
11+ }
12+
13+ function callFn () public pure returns (uint ){
14+ uint y = 5 ;
15+ return y;
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ pragma solidity ^ 0.5.0 ;
2+
3+
4+ contract ContractB {
5+ uint x;
6+ constructor () public {
7+ }
8+
9+ function sendFn () public {
10+ x = 5 ;
11+ }
12+
13+ function callFn () public pure returns (uint ){
14+ uint y = 5 ;
15+ return y;
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ pragma solidity ^ 0.5.0 ;
2+
3+
4+ contract ContractC {
5+ uint x;
6+ constructor () public {
7+ }
8+
9+ function sendFn () public {
10+ x = 5 ;
11+ }
12+
13+ function callFn () public pure returns (uint ){
14+ uint y = 5 ;
15+ return y;
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ pragma solidity >= 0.4.21 < 0.6.0 ;
2+
3+ contract Migrations {
4+ address public owner;
5+ uint public last_completed_migration;
6+
7+ constructor () public {
8+ owner = msg .sender ;
9+ }
10+
11+ modifier restricted () {
12+ if (msg .sender == owner) _;
13+ }
14+
15+ function setCompleted (uint completed ) public restricted {
16+ last_completed_migration = completed;
17+ }
18+
19+ function upgrade (address new_address ) public restricted {
20+ Migrations upgraded = Migrations (new_address);
21+ upgraded.setCompleted (last_completed_migration);
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ const ContractA = artifacts . require ( "ContractA" ) ;
2+
3+ contract ( "contracta" , function ( accounts ) {
4+ let instance ;
5+
6+ before ( async ( ) => instance = await ContractA . new ( ) )
7+
8+ it ( 'sends [ @skipForCoverage ]' , async function ( ) {
9+ await instance . sendFn ( ) ;
10+ } ) ;
11+
12+ it ( 'calls [ @skipForCoverage ]' , async function ( ) {
13+ await instance . callFn ( ) ;
14+ } )
15+ } ) ;
You can’t perform that action at this time.
0 commit comments