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

--match incorrectly flags test as .only, making them unskippable #1416

Closed
muyu66 opened this issue Jun 20, 2017 · 2 comments
Closed

--match incorrectly flags test as .only, making them unskippable #1416

muyu66 opened this issue Jun 20, 2017 · 2 comments
Labels
bug current functionality does not work as desired help wanted scope:test-interface

Comments

@muyu66
Copy link

muyu66 commented Jun 20, 2017

I meet a question that i can't resolve using AVA

I build a.js file from a.ts using "tsc && ava".

It is source code:

import test from 'ava';

test.before(t => {
..........
});

test.skip('test1111', t => {
..........
});

test('test22222', t => {
...........
});

But, the code throw a exception :

TAP version 13
/home/zhouyu/Web/framework/node_modules/.0.19.1@ava/lib/runner.js:119
            throw new TypeError(validationError);
            ^

TypeError: `only` tests cannot be skipped
    at Runner.addTest (/home/zhouyu/Web/framework/node_modules/.0.19.1@ava/lib/runner.js:119:10)
    at Function.Runner.chain.optionChain (/home/zhouyu/Web/framework/node_modules/.0.19.1@ava/lib/runner.js:99:10)
I am confused that my 'test1111' test isn't a ''only' test.

This is my package.json :

  "ava": {
    "files": [
      "build/test/*.js"
    ],
    "source": [
      "**/*.{js}"
    ],
    "match": [
      "*"
    ],
    "failFast": false,
    "tap": true
  }

My ava version is : "ava": "^0.19.1"

This is my usage problem, or, AVA bug?

Help me, thanks.

@ORESoftware
Copy link

interesting

@novemberborn novemberborn changed the title only tests cannot be skipped, but no use 'only' --match incorrectly flags test as .only, making them unskippable Jun 22, 2017
@novemberborn
Copy link
Member

The problem is the match option. Note that with * it doesn't need to be set, since it'll match anything.

The way match is implemented is we mark a test as exclusive when it matches:

metadata.exclusive = title !== null && matcher([title], this.match).length === 1;

Unfortunately we do the same when test.only() is used! We should set an additional property that tracks whether the test is exclusive because of test.only() or --match, and make .skip() only throw on test.only().

@novemberborn novemberborn added bug current functionality does not work as desired help wanted labels Jun 22, 2017
novemberborn added a commit that referenced this issue Feb 10, 2018
Fixes #1684. Fixes #1416. Refs #1158.

Properly support serial hooks. Hooks are divided into the following
categories:

* before
* beforeEach
* afterEach
* afterEach.always
* after
* after.always

For each category all hooks are run in the order they're declared in.
This is different from tests, where serial tests are run before
concurrent ones.

By default hooks run concurrently. However a serial hook is not run
before all preceding concurrent hooks have completed. Serial hooks are
never run concurrently.

Always hooks are now always run, even if --fail-fast is enabled.

Internally, TestCollection, Sequence and Concurrent have been removed.
This has led to a major refactor of Runner, and some smaller breaking
changes and bug fixes:

* Unnecessary validations have been removed
* Macros can be used with hooks
* A macro is recognized even if no additional arguments are given, so it
can modify the test (or hook) title
* --match now also matches todo tests
* Skipped and todo tests are shown first in the output
* --fail-fast prevents subsequent tests from running as long as the
failure occurs in a serial test
novemberborn added a commit that referenced this issue Feb 10, 2018
Fixes #1684. Fixes #1416. Refs #1158.

Properly support serial hooks. Hooks are divided into the following
categories:

* before
* beforeEach
* afterEach
* afterEach.always
* after
* after.always

For each category all hooks are run in the order they're declared in.
This is different from tests, where serial tests are run before
concurrent ones.

By default hooks run concurrently. However a serial hook is not run
before all preceding concurrent hooks have completed. Serial hooks are
never run concurrently.

Always hooks are now always run, even if --fail-fast is enabled.

Internally, TestCollection, Sequence and Concurrent have been removed.
This has led to a major refactor of Runner, and some smaller breaking
changes and bug fixes:

* Unnecessary validations have been removed
* Macros can be used with hooks
* A macro is recognized even if no additional arguments are given, so it
can modify the test (or hook) title
* --match now also matches todo tests
* Skipped and todo tests are shown first in the output
* --fail-fast prevents subsequent tests from running as long as the
failure occurs in a serial test
novemberborn added a commit that referenced this issue Feb 10, 2018
Fixes #1684. Fixes #1416. Refs #1158.

Properly support serial hooks. Hooks are divided into the following
categories:

* before
* beforeEach
* afterEach
* afterEach.always
* after
* after.always

For each category all hooks are run in the order they're declared in.
This is different from tests, where serial tests are run before
concurrent ones.

By default hooks run concurrently. However a serial hook is not run
before all preceding concurrent hooks have completed. Serial hooks are
never run concurrently.

Always hooks are now always run, even if --fail-fast is enabled.

Internally, TestCollection, Sequence and Concurrent have been removed.
This has led to a major refactor of Runner, and some smaller breaking
changes and bug fixes:

* Unnecessary validations have been removed
* Macros can be used with hooks
* A macro is recognized even if no additional arguments are given, so it
can modify the test (or hook) title
* --match now also matches todo tests
* Skipped and todo tests are shown first in the output
* --fail-fast prevents subsequent tests from running as long as the
failure occurs in a serial test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired help wanted scope:test-interface
Projects
None yet
Development

No branches or pull requests

4 participants