Skip to content

Commit d19a342

Browse files
committed
fix: multiple feature tag bug
1 parent 6bbc9e2 commit d19a342

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

bin/run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,12 @@ function filterByFeatureInclude(test) {
217217
if (!featuresInclude) {
218218
return true;
219219
}
220-
return featuresInclude.filter(feature => (test.attrs.features || []).includes(feature)).length > 0;
220+
return featuresInclude.some(feature => (test.attrs.features || []).includes(feature));
221221
}
222222

223223
function filterByFeatureExclude(test) {
224224
if (!featuresExclude) {
225225
return true;
226226
}
227-
return featuresExclude.filter(feature => !(test.attrs.features || []).includes(feature)).length > 0;
227+
return !featuresExclude.some(feature => (test.attrs.features || []).includes(feature));
228228
}

test/collateral/test/error.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Fails by calling $ERROR
33
expected:
44
pass: false
55
message: failure message
6+
features: [C]
67
---*/
78

89
$ERROR('failure message');

test/collateral/test/negativeMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ description: Should report the expected error indicated by the "negative" frontm
33
negative: ExpectedError
44
expected:
55
pass: false
6-
features: [B]
6+
features: [B,C]
77
---*/

test/collateral/test/noStrict.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ description: Should not test in strict mode
33
flags: [noStrict]
44
expected:
55
pass: true
6+
features: [A,B,C]
67
---*/
78
x = 5;

test/collateral/test/rawNoStrict.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Should not test in strict mode
33
flags: [raw]
44
expected:
55
pass: true
6+
features: [C]
67
---*/
78
var seemsStrict;
89
try {

test/collateral/test/rawStrict.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Should not test in strict mode (but allow strict mode to be enabled
33
flags: [raw]
44
expected:
55
pass: true
6+
features: [C]
67
---*/
78
'use strict';
89
var seemsStrict;

test/test.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,28 +138,28 @@ const tests = [
138138
'--features-include=A',
139139
'collateral/test/**/*.js',
140140
],
141-
{ cwd: 'test', recordsCount: 6 },
141+
{ cwd: 'test', recordsCount: 7 },
142142
],
143143
[
144144
[
145145
'--features-exclude=B',
146146
'collateral/test/**/*.js',
147147
],
148-
{ cwd: 'test', recordsCount: 14 },
148+
{ cwd: 'test', recordsCount: 13 },
149149
],
150150
[
151151
[
152152
'--features-include=A,B',
153153
'collateral/test/**/*.js',
154154
],
155-
{ cwd: 'test', recordsCount: 8 },
155+
{ cwd: 'test', recordsCount: 9 },
156156
],
157157
[
158158
[
159159
'--features-exclude=A,B',
160160
'collateral/test/**/*.js',
161161
],
162-
{ cwd: 'test', recordsCount: 16 },
162+
{ cwd: 'test', recordsCount: 9 },
163163
],
164164
[
165165
[
@@ -169,6 +169,14 @@ const tests = [
169169
],
170170
{ cwd: 'test', recordsCount: 4 },
171171
],
172+
[
173+
[
174+
'--features-include=A,B,C',
175+
'--features-exclude=C',
176+
'collateral/test/**/*.js',
177+
],
178+
{ cwd: 'test', recordsCount: 6 },
179+
],
172180
].reduce((accum, a) => {
173181
let b = a.slice();
174182

@@ -204,7 +212,7 @@ function validate({ args, records, exitCode, options }) {
204212

205213
if (options.reporter === 'json') {
206214
if (options.recordsCount) {
207-
tap.test('--features-include/exclude', assert => {
215+
tap.test(`\`${args.join(' ')}\`: ${options.recordsCount} test records found`, assert => {
208216
assert.equal(records.length, options.recordsCount, 'records.length matches expected records count');
209217
assert.end();
210218
});

0 commit comments

Comments
 (0)