Skip to content

Commit 9188a54

Browse files
authored
Add --temp command flag (#414)
1 parent 9574783 commit 9188a54

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ truffle run coverage [options]
4646
| file | `--file="test/registry/*.js"` | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)|
4747
| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
4848
| network | `--network development` | Use network settings defined in the Truffle config |
49+
| temp | `--temp build` | :warning: *Use with caution* :warning:. Disposable folder to store compilation artifacts in. Useful when your test setup scripts include hard-coded paths to a build directory. |
4950
| version | | Version info |
5051
| help | | Usage notes |
5152

dist/plugin-assets/plugin.utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function toRelativePath(pathToFile, pathToParent){
8585
function getTempLocations(config){
8686
const cwd = config.working_directory;
8787
const contractsDirName = '.coverage_contracts';
88-
const artifactsDirName = '.coverage_artifacts';
88+
const artifactsDirName = config.temp || '.coverage_artifacts';
8989

9090
return {
9191
tempContractsDir: path.join(cwd, contractsDirName),

test/units/truffle/flags.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,20 @@ describe('Truffle Plugin: command line options', function() {
211211
);
212212
});
213213

214+
it('--coverageArtifacts', async function(){
215+
truffleConfig.logger = mock.testLogger;
216+
217+
truffleConfig.temp = 'special_location';
218+
219+
mock.install('Simple', 'simple.js', solcoverConfig);
220+
await plugin(truffleConfig);
221+
222+
assert(
223+
mock.loggerOutput.val.includes("/special_location/contracts"),
224+
`Should write artifacts to "special_location": ${mock.loggerOutput.val}`
225+
);
226+
});
227+
214228
it('--network (network_id mismatch in configs)', async function(){
215229
truffleConfig.logger = mock.testLogger;
216230

0 commit comments

Comments
 (0)