Skip to content

Commit

Permalink
Now more efficiently excluding node_modules in glob instead of in loo…
Browse files Browse the repository at this point in the history
…p on test files, and also excluding .cpp files in node_modules for contract compilation.
  • Loading branch information
thekevinbrown committed May 6, 2019
1 parent 56e586b commit 505212d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,14 @@ export const runTests = async () => {

// Any .test.ts, .test.js, .spec.ts, .spec.js files anywhere in the working tree
// outside of node_modules get added.
// Note: This also adds files from node_modules. These will get filtered out in the loop below
...(await glob('**/*.{test,spec}.{js,ts}')),
...(await glob('!(node_modules)/**/*.{test,spec}.{js,ts}')),
];

// Instantiate a Mocha instance.
const mocha = new Mocha();

for (const testFile of files) {
if (!testFile.startsWith('node_modules/')) {
mocha.addFile(path.join(WORKING_DIRECTORY, testFile));
}
mocha.addFile(path.join(WORKING_DIRECTORY, testFile));
}

// Our tests are more like integration tests than unit tests. Taking two seconds is
Expand All @@ -289,7 +286,7 @@ export const runTests = async () => {
*/
export const buildAll = async (contracts?: string[]) => {
// Find all contract files
contracts = await glob('./**/*.cpp');
contracts = await glob('!(node_modules)/**/*.cpp');
const errors = [];
// Log the batch building process
console.log(`BUILDING ${contracts.length} SMART CONTRACTS`, '\n');
Expand Down

0 comments on commit 505212d

Please sign in to comment.