Browse Source

Ignore files in fixtures and helpers directories

Don't ignore files starting with '_'

Ignore files starting with '_'

Fix path for fixtures

Add 'fixtures' path to tests

Move ignored fixtures to their own directory
babel-plugin-for-integration-tests
Juan Soto 9 years ago
parent
commit
f6cef7fcf3
  1. 2
      api.js
  2. 2
      readme.md
  3. 26
      test/api.js
  4. 2
      test/fixture/ignored-dirs/fixtures/test.js
  5. 6
      test/fixture/ignored-dirs/helpers/test.js

2
api.js

@ -195,6 +195,8 @@ function handlePaths(files) {
}
files.push('!**/node_modules/**');
files.push('!**/fixtures/**');
files.push('!**/helpers/**');
// convert pinkie-promise to Bluebird promise
files = Promise.resolve(globby(files));

2
readme.md

@ -119,7 +119,7 @@ $ ava --help
test.js test-*.js test/*.js
```
Files starting with `_` are ignored. This can be useful for having helpers in the same directory as your test files.
Files in directories named `fixtures` and `helpers` are ignored, as well as files starting with `_`. This can be useful for having helpers in the same directory as your test files.
*WARNING: NON-STANDARD BEHAVIOR:* The AVA CLI will always try to find and use your projects local install of AVA. This is true even when you run the global `ava` command. This non-standard behavior solves an important [issue](https://github.com/sindresorhus/ava/issues/157), and should have no impact on everyday use.

26
test/api.js

@ -302,7 +302,31 @@ test('testing nonexistent files rejects', function (t) {
test('test file in node_modules is ignored', function (t) {
t.plan(2);
var api = new Api([path.join(__dirname, 'fixture/node_modules/test.js')]);
var api = new Api([path.join(__dirname, 'fixture/ignored-dirs/node_modules/test.js')]);
api.run()
.catch(function (err) {
t.ok(err);
t.match(err.message, /Couldn't find any files to test/);
});
});
test('test file in fixtures is ignored', function (t) {
t.plan(2);
var api = new Api([path.join(__dirname, 'fixture/ignored-dirs/fixtures/test.js')]);
api.run()
.catch(function (err) {
t.ok(err);
t.match(err.message, /Couldn't find any files to test/);
});
});
test('test file in helpers is ignored', function (t) {
t.plan(2);
var api = new Api([path.join(__dirname, 'fixture/ignored-dirs/helpers/test.js')]);
api.run()
.catch(function (err) {

2
test/fixture/node_modules/test.js → test/fixture/ignored-dirs/fixtures/test.js

@ -1,4 +1,4 @@
import test from '../../';
import test from '../../../../';
test(t => {
t.pass();

6
test/fixture/ignored-dirs/helpers/test.js

@ -0,0 +1,6 @@
import test from '../../../../';
test(t => {
t.pass();
t.end();
});
Loading…
Cancel
Save