Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add failing test for negative .gitignore rules #199

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ test.failing('ignores fixture', async t => {
test('ignore files in .gitignore', async t => {
const cwd = path.join(__dirname, 'fixtures/gitignore');

try {
await execa('../../../cli.js', ['--no-local'], {cwd});
} catch (err) {
t.is(err.stdout.indexOf('foo.js'), -1);
t.true(err.stdout.indexOf('bar.js') !== -1);
}
const err = await t.throws(execa('../../../cli.js', ['--no-local'], {cwd}));
t.is(err.stdout.indexOf('foo.js'), -1);
t.true(err.stdout.indexOf('bar.js') !== -1);
});

test.failing('negative gitignores', async t => {
const cwd = path.join(__dirname, 'fixtures/negative-gitignore');

const err = await t.throws(execa(`../../../cli.js`, [`${cwd}/bar.js`, '--no-local'], {cwd}));
t.is(err.stdout.indexOf('foo.js'), -1, 'Should not lint foo.js');
});

test('supports being extended with a shareable config', async () => {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/negative-gitignore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!foo.js
1 change: 1 addition & 0 deletions test/fixtures/negative-gitignore/bar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('no semicolon')
1 change: 1 addition & 0 deletions test/fixtures/negative-gitignore/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('no semicolon')