Skip to content

Commit

Permalink
convert all "only" tests to unexpected
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Hiller <boneskull@boneskull.com>
  • Loading branch information
boneskull committed Apr 21, 2018
1 parent 15c921e commit a5949bb
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 77 deletions.
52 changes: 26 additions & 26 deletions test/only/bdd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,77 @@

describe('should only run .only test in this bdd suite', function () {
it('should not run this test', function () {
expect(0).to.equal(1, 'this test should have been skipped');
expect(0, 'to be', 1, 'this test should have been skipped');
});
it.only('should run this test', function () {
expect(0).to.equal(0, 'this .only test should run');
expect(0, 'to be', 0, 'this .only test should run');
});
it('should run this test, not (includes the title of the .only test)', function () {
expect(0).to.equal(1, 'this test should have been skipped');
expect(0, 'to be', 1, 'this test should have been skipped');
});
});

describe('should not run this suite', function () {
it('should not run this test', function () {
expect(true).to.equal(false);
expect(true, 'to be', false);
});

it('should not run this test', function () {
expect(true).to.equal(false);
expect(true, 'to be', false);
});

it('should not run this test', function () {
expect(true).to.equal(false);
expect(true, 'to be', false);
});
});

describe.only('should run all tests in this bdd suite', function () {
it('should run this test #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

it('should run this test #2', function () {
expect(1).to.equal(1);
expect(1, 'to be', 1);
});

it('should run this test #3', function () {
expect('foo').to.equal('foo');
expect('foo', 'to be', 'foo');
});
});

describe('should run only suites that marked as `only`', function () {
describe.only('should run all this tdd suite', function () {
it('should run this test #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

it('should run this test #2', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});
});

describe('should not run this suite', function () {
it('should run this test', function () {
expect(true).to.equal(false);
expect(true, 'to be', false);
});
});
});

// Nested situation
describe('should not run parent tests', function () {
it('should not run this test', function () {
expect(true).to.equal(false);
expect(true, 'to be', false);
});
describe('and not the child tests too', function () {
it('should not run this test', function () {
expect(true).to.equal(false);
expect(true, 'to be', false);
});
describe.only('but run all the tests in this suite', function () {
it('should run this test #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});
it('should run this test #2', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});
});
});
Expand All @@ -81,47 +81,47 @@ describe('should not run parent tests', function () {
// mark test as `only` override the suite behavior
describe.only('should run only tests that marked as `only`', function () {
it('should not run this test #1', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

it.only('should run this test #2', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

it('should not run this test #3', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

it.only('should run this test #4', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});
});

describe.only('Should run only test cases that mark as only', function () {
it.only('should runt his test', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

it('should not run this test', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

describe('should not run this suite', function () {
it('should not run this test', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});
});
});

// Root Suite
it.only('#Root-Suite, should run this test-case #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

it.only('#Root-Suite, should run this test-case #2', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

it('#Root-Suite, should not run this test', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});
6 changes: 3 additions & 3 deletions test/only/global/bdd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

// Root-only test cases
it.only('#Root-Suite, should run this bdd test-case #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

it('#Root-Suite, should not run this bdd test-case #2', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

it('#Root-Suite, should not run this bdd test-case #3', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});
6 changes: 3 additions & 3 deletions test/only/global/qunit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

// Root-only test cases
test.only('#Root-Suite, should run this qunit test-case #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

test('#Root-Suite, should not run this qunit test-case #2', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

test('#Root-Suite, should not run this qunit test-case #3', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});
6 changes: 3 additions & 3 deletions test/only/global/tdd.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

// Root-only test cases
test.only('#Root-Suite, should run this tdd test-case #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

test('#Root-Suite, should not run this tdd test-case #2', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

test('#Root-Suite, should not run this tdd test-case #3', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});
32 changes: 16 additions & 16 deletions test/only/qunit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,74 @@

// Root Suite
test.only('#Root-Suite, should run this test-case #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

test.only('#Root-Suite, should run this test-case #2', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

test('#Root-Suite, should not run this test', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

suite('should only run .only test in this qunit suite');

test('should not run this test', function () {
expect(0).to.equal(1, 'this test should have been skipped');
expect(0, 'to be', 1, 'this test should have been skipped');
});
test.only('should run this test', function () {
expect(0).to.equal(0, 'this .only test should run');
expect(0, 'to be', 0, 'this .only test should run');
});
test('should run this test, not (includes the title of the .only test)', function () {
expect(0).to.equal(1, 'this test should have been skipped');
expect(0, 'to be', 1, 'this test should have been skipped');
});

// Mark suite
suite.only('should run all tests in this suite');

test('should run this test #1', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

test('should run this test #2', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

test('should run this test #3', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

// Unmark this suite
suite('should not run any of this suite\'s tests');

test('should not run this test', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

test('should not run this test', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

test('should not run this test', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

// Mark test as `only` override the suite behavior
suite.only('should run only tests that marked as `only`');

test('should not run this test #1', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

test.only('should not run this test #2', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

test('should not run this test #3', function () {
expect(false).to.equal(true);
expect(false, 'to be', true);
});

test.only('should not run this test #4', function () {
expect(true).to.equal(true);
expect(true, 'to be', true);
});

0 comments on commit a5949bb

Please sign in to comment.