Skip to content

Commit dab3634

Browse files
committed
Prefer truffle-config.js
1 parent ab3a65d commit dab3634

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/app.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ class App {
9494
});
9595
}
9696

97-
// Load config if present, accomodate common windows naming.
97+
// Load config
9898
let truffleConfig;
99+
let oldTrufflePath = `${this.workingDir}/truffle.js`;
100+
let newTrufflePath = `${this.workingDir}/truffle-config.js`;
99101

100-
shell.test('-e', `${this.workingDir}/truffle.js`)
101-
? truffleConfig = reqCwd.silent(`${this.workingDir}/truffle.js`)
102-
: truffleConfig = reqCwd.silent(`${this.workingDir}/truffle-config.js`);
102+
if (shell.test('-e', oldTrufflePath)) truffleConfig = reqCwd.silent(oldTrufflePath);
103+
else if (shell.test('-e', newTrufflePath)) truffleConfig = reqCwd.silent(newTrufflePath);
103104

104105
// Coverage network opts specified: use port if declared
105106
if (truffleConfig && truffleConfig.networks && truffleConfig.networks.coverage) {
@@ -109,10 +110,7 @@ class App {
109110
// No coverage network defaults to the dev network on port 8555, high gas / low price.
110111
} else {
111112
const trufflejs = defaultTruffleConfig(this.port, gasLimitHex, gasPriceHex);
112-
113-
(process.platform === 'win32')
114-
? fs.writeFileSync(`${this.coverageDir}/truffle-config.js`, trufflejs)
115-
: fs.writeFileSync(`${this.coverageDir}/truffle.js`, trufflejs);
113+
fs.writeFileSync(`${this.coverageDir}/truffle-config.js`, trufflejs);
116114
}
117115

118116
// Compile the contracts before instrumentation and preserve their ABI's.
@@ -272,7 +270,7 @@ class App {
272270
const defaultCommand = `truffle compile ${this.network} ${this.silence}`;
273271
const command = this.compileCommand || defaultCommand;
274272
this.log(`Running: ${command}\n(this can take a few seconds)...`);
275-
273+
276274
shell.cd(this.coverageDir);
277275
shell.exec(command);
278276
this.testsErrored = shell.error();

0 commit comments

Comments
 (0)