Skip to content

Commit 09a4765

Browse files
committed
Avoid helper compilation during API tests
We're ending up compiling all helper-like files in AVA's test/ directory, which is unnecessary.
1 parent 314ef00 commit 09a4765

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/api.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ function apiCreator(options) {
1414
options.powerAssert = true;
1515
options.projectDir = options.projectDir || ROOT_DIR;
1616
options.resolveTestsFrom = options.resolveTestsFrom || options.projectDir;
17-
return new Api(options);
17+
const instance = new Api(options);
18+
if (!options.precompileHelpers) {
19+
instance._precompileHelpers = () => Promise.resolve();
20+
}
21+
return instance;
1822
}
1923

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

79-
const api = apiCreator();
83+
const api = apiCreator({
84+
precompileHelpers: true,
85+
resolveTestsFrom: path.join(__dirname, 'fixture/precompile-helpers')
86+
});
8087

81-
return api.run([path.join(__dirname, 'fixture/precompile-helpers/test/test.js')])
88+
return api.run()
8289
.then(result => {
8390
t.is(result.passCount, 1);
8491
});

0 commit comments

Comments
 (0)