Skip to content

Commit

Permalink
Avoid helper compilation during API tests
Browse files Browse the repository at this point in the history
We're ending up compiling all helper-like files in AVA's test/
directory, which is unnecessary.
  • Loading branch information
novemberborn committed Feb 12, 2017
1 parent 314ef00 commit 09a4765
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/api.js
Expand Up @@ -14,7 +14,11 @@ function apiCreator(options) {
options.powerAssert = true;
options.projectDir = options.projectDir || ROOT_DIR;
options.resolveTestsFrom = options.resolveTestsFrom || options.projectDir;
return new Api(options);
const instance = new Api(options);
if (!options.precompileHelpers) {
instance._precompileHelpers = () => Promise.resolve();
}
return instance;
}

generateTests('Without Pool: ', options => apiCreator(options || {}));
Expand Down Expand Up @@ -76,9 +80,12 @@ function generateTests(prefix, apiCreator) {
test(`${prefix} precompile helpers`, t => {
t.plan(1);

const api = apiCreator();
const api = apiCreator({
precompileHelpers: true,
resolveTestsFrom: path.join(__dirname, 'fixture/precompile-helpers')
});

return api.run([path.join(__dirname, 'fixture/precompile-helpers/test/test.js')])
return api.run()
.then(result => {
t.is(result.passCount, 1);
});
Expand Down

0 comments on commit 09a4765

Please sign in to comment.