Skip to content

Commit 59c2292

Browse files
committed
Meta tweaks
1 parent 3fe447d commit 59c2292

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
language: node_js
22
node_js:
3+
- '10'
34
- '8'

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
'use strict';
22
module.exports = () => /(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/ig;
3-

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@
2424
"versions",
2525
"regex",
2626
"regexp",
27-
"re",
2827
"match",
2928
"matching",
3029
"semantic"
3130
],
3231
"devDependencies": {
33-
"ava": "*",
34-
"xo": "*"
32+
"ava": "^1.4.1",
33+
"xo": "^0.24.0"
3534
}
3635
}

test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'ava';
2-
import m from '.';
2+
import semverRegex from '.';
33

4-
const fixture = [
4+
const fixtures = [
55
'0.0.0',
66
'0.10.0',
77
'v1.0.0',
@@ -16,26 +16,26 @@ const fixture = [
1616
];
1717

1818
test('matches semver versions on test', t => {
19-
for (const el of fixture) {
20-
t.regex(el, m());
19+
for (const fixture of fixtures) {
20+
t.regex(fixture, semverRegex());
2121
}
2222

23-
t.notRegex('0.88', m());
24-
t.notRegex('1.0.08', m());
25-
t.notRegex('1.08.0', m());
26-
t.notRegex('01.8.0', m());
23+
t.notRegex('0.88', semverRegex());
24+
t.notRegex('1.0.08', semverRegex());
25+
t.notRegex('1.08.0', semverRegex());
26+
t.notRegex('01.8.0', semverRegex());
2727
});
2828

2929
test('returns semver on match', t => {
30-
t.deepEqual('0.0.0'.match(m()), ['0.0.0']);
31-
t.deepEqual('foo 0.0.0 bar 0.1.1'.match(m()), ['0.0.0', '0.1.1']);
30+
t.deepEqual('0.0.0'.match(semverRegex()), ['0.0.0']);
31+
t.deepEqual('foo 0.0.0 bar 0.1.1'.match(semverRegex()), ['0.0.0', '0.1.1']);
3232
});
3333

3434
test('#7, does not return tag prefix', t => {
35-
t.deepEqual('v0.0.0'.match(m()), ['0.0.0']);
35+
t.deepEqual('v0.0.0'.match(semverRegex()), ['0.0.0']);
3636
});
3737

38-
test('#14, does not match substrings of longer semver-similar strings, respect semver2.0.0 clause 9', t => {
38+
test('#14, does not match sub-strings of longer semver-similar strings, respect semver@2.0.0 clause 9', t => {
3939
const invalidStrings = [
4040
'1',
4141
'1.2',
@@ -80,6 +80,6 @@ test('#14, does not match substrings of longer semver-similar strings, respect s
8080
];
8181

8282
for (const string of invalidStrings) {
83-
t.notRegex(string, m());
83+
t.notRegex(string, semverRegex());
8484
}
8585
});

0 commit comments

Comments
 (0)