Add --temp command flag (#414)

truffle-plugin
cgewecke 5 years ago
parent 2552ebaef0
commit 3421207276
  1. 1
      README.md
  2. 2
      dist/plugin-assets/plugin.utils.js
  3. 14
      test/units/truffle/flags.js

@ -46,6 +46,7 @@ truffle run coverage [options]
| file | `--file="test/registry/*.js"` | Filename or glob describing a subset of JS tests to run. (Globs must be enclosed by quotes.)|
| solcoverjs | `--solcoverjs ./../.solcover.js` | Relative path from working directory to config. Useful for monorepo packages that share settings. (Path must be "./" prefixed) |
| network | `--network development` | Use network settings defined in the Truffle config |
| 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. |
| version | | Version info |
| help | | Usage notes |

@ -85,7 +85,7 @@ function toRelativePath(pathToFile, pathToParent){
function getTempLocations(config){
const cwd = config.working_directory;
const contractsDirName = '.coverage_contracts';
const artifactsDirName = '.coverage_artifacts';
const artifactsDirName = config.temp || '.coverage_artifacts';
return {
tempContractsDir: path.join(cwd, contractsDirName),

@ -211,6 +211,20 @@ describe('Truffle Plugin: command line options', function() {
);
});
it('--coverageArtifacts', async function(){
truffleConfig.logger = mock.testLogger;
truffleConfig.temp = 'special_location';
mock.install('Simple', 'simple.js', solcoverConfig);
await plugin(truffleConfig);
assert(
mock.loggerOutput.val.includes("/special_location/contracts"),
`Should write artifacts to "special_location": ${mock.loggerOutput.val}`
);
});
it('--network (network_id mismatch in configs)', async function(){
truffleConfig.logger = mock.testLogger;

Loading…
Cancel
Save