release-it 19.0.0-next.4 → 19.0.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/version.js CHANGED
@@ -4,20 +4,20 @@ import Version from '../lib/plugin/version/Version.js';
4
4
  import { factory, runTasks } from './util/index.js';
5
5
 
6
6
  describe('version', () => {
7
- test('isValidVersion', () => {
8
- const v = factory(Version);
7
+ test('isValidVersion', async () => {
8
+ const v = await factory(Version);
9
9
  assert.equal(v.isValid('1.0.0'), true);
10
10
  assert.equal(v.isValid(1.0), false);
11
11
  });
12
12
 
13
- test('isPreRelease', () => {
14
- const v = factory(Version);
13
+ test('isPreRelease', async () => {
14
+ const v = await factory(Version);
15
15
  assert.equal(v.isPreRelease('1.0.0-beta.0'), true);
16
16
  assert.equal(v.isPreRelease('1.0.0'), false);
17
17
  });
18
18
 
19
19
  test('should return the same version in both interactive and ci mode', async () => {
20
- const v = factory(Version);
20
+ const v = await factory(Version);
21
21
  const options = { latestVersion: '2.0.0-beta.1', increment: null, preReleaseId: 'rc', isPreRelease: true };
22
22
  const resultInteractiveMode = await v.getIncrementedVersion(options);
23
23
  assert.equal(resultInteractiveMode, '2.0.0-rc.0');
@@ -25,8 +25,8 @@ describe('version', () => {
25
25
  assert.equal(resultInteractiveMode, resultCiMode);
26
26
  });
27
27
 
28
- test('should increment latest version', () => {
29
- const v = factory(Version);
28
+ test('should increment latest version', async () => {
29
+ const v = await factory(Version);
30
30
  const latestVersion = '1.0.0';
31
31
  assert.equal(v.incrementVersion({ latestVersion, increment: false }), '1.0.0');
32
32
  assert.equal(v.incrementVersion({ latestVersion, increment: 'foo' }), undefined);
@@ -38,15 +38,15 @@ describe('version', () => {
38
38
  assert.equal(v.incrementVersion({ latestVersion, increment: '2.0.0-beta.1' }), '2.0.0-beta.1');
39
39
  });
40
40
 
41
- test('should not increment latest version in interactive mode', () => {
42
- const v = factory(Version, { options: { ci: false } });
41
+ test('should not increment latest version in interactive mode', async () => {
42
+ const v = await factory(Version, { options: { ci: false } });
43
43
  const latestVersion = '1.0.0';
44
44
  assert.equal(v.incrementVersion({ latestVersion, increment: null }), undefined);
45
45
  assert.equal(v.incrementVersion({ latestVersion, increment: false }), '1.0.0');
46
46
  });
47
47
 
48
- test('should always set increment version in CI mode', () => {
49
- const v = factory(Version, { options: { ci: true } });
48
+ test('should always set increment version in CI mode', async () => {
49
+ const v = await factory(Version, { options: { ci: true } });
50
50
  const latestVersion = '1.0.0';
51
51
  assert.equal(v.getIncrementedVersionCI({ latestVersion, increment: false }), '1.0.0');
52
52
  assert.equal(v.getIncrementedVersionCI({ latestVersion, increment: null }), '1.0.1');
@@ -54,44 +54,44 @@ describe('version', () => {
54
54
  assert.equal(v.getIncrementedVersionCI({ latestVersion, increment: 'major' }), '2.0.0');
55
55
  });
56
56
 
57
- test('should increment latest version (coerce)', () => {
58
- const v = factory(Version);
57
+ test('should increment latest version (coerce)', async () => {
58
+ const v = await factory(Version);
59
59
  assert.equal(v.incrementVersion({ increment: '1.2' }), '1.2.0');
60
60
  assert.equal(v.incrementVersion({ increment: '1' }), '1.0.0');
61
61
  assert.equal(v.incrementVersion({ increment: 'v1.2.0.0' }), '1.2.0');
62
62
  });
63
63
 
64
- test('should increment version (pre-release continuation)', () => {
65
- const v = factory(Version);
64
+ test('should increment version (pre-release continuation)', async () => {
65
+ const v = await factory(Version);
66
66
  assert.equal(v.incrementVersion({ latestVersion: '1.2.3-alpha.0', increment: 'prepatch' }), '1.2.4-0');
67
67
  });
68
68
 
69
- test('should increment version (prepatch)', () => {
70
- const v = factory(Version);
69
+ test('should increment version (prepatch)', async () => {
70
+ const v = await factory(Version);
71
71
  assert.equal(
72
72
  v.incrementVersion({ latestVersion: '1.2.3', increment: 'prepatch', preReleaseId: 'alpha' }),
73
73
  '1.2.4-alpha.0'
74
74
  );
75
75
  });
76
76
 
77
- test('should increment version (normalized)', () => {
78
- const v = factory(Version);
77
+ test('should increment version (normalized)', async () => {
78
+ const v = await factory(Version);
79
79
  assert.equal(
80
80
  v.incrementVersion({ latestVersion: '1.2.3', increment: 'patch', preReleaseId: 'alpha', isPreRelease: true }),
81
81
  '1.2.4-alpha.0'
82
82
  );
83
83
  });
84
84
 
85
- test('should increment version (prepatch on prerelease version)', () => {
86
- const v = factory(Version);
85
+ test('should increment version (prepatch on prerelease version)', async () => {
86
+ const v = await factory(Version);
87
87
  assert.equal(
88
88
  v.incrementVersion({ latestVersion: '1.2.3-alpha.5', increment: 'prepatch', preReleaseId: 'next' }),
89
89
  '1.2.4-next.0'
90
90
  );
91
91
  });
92
92
 
93
- test('should increment version (normalized on prerelease version)', () => {
94
- const v = factory(Version);
93
+ test('should increment version (normalized on prerelease version)', async () => {
94
+ const v = await factory(Version);
95
95
  assert.equal(
96
96
  v.incrementVersion({
97
97
  latestVersion: '1.2.3-alpha.5',
@@ -103,29 +103,29 @@ describe('version', () => {
103
103
  );
104
104
  });
105
105
 
106
- test('should increment version (prerelease)', () => {
107
- const v = factory(Version);
106
+ test('should increment version (prerelease)', async () => {
107
+ const v = await factory(Version);
108
108
  assert.equal(
109
109
  v.incrementVersion({ latestVersion: '1.2.3', increment: 'prerelease', preReleaseId: 'alpha' }),
110
110
  '1.2.4-alpha.0'
111
111
  );
112
112
  });
113
113
 
114
- test('should increment version (prerelease cont.)', () => {
115
- const v = factory(Version);
114
+ test('should increment version (prerelease cont.)', async () => {
115
+ const v = await factory(Version);
116
116
  assert.equal(v.incrementVersion({ latestVersion: '1.2.3-alpha.0', increment: 'prerelease' }), '1.2.3-alpha.1');
117
117
  });
118
118
 
119
- test('should increment version (preReleaseId continuation)', () => {
120
- const v = factory(Version);
119
+ test('should increment version (preReleaseId continuation)', async () => {
120
+ const v = await factory(Version);
121
121
  assert.equal(
122
122
  v.incrementVersion({ latestVersion: '1.2.3-alpha.0', increment: 'prerelease', preReleaseId: 'alpha' }),
123
123
  '1.2.3-alpha.1'
124
124
  );
125
125
  });
126
126
 
127
- test('should increment version (prepatch/preReleaseId continuation)', () => {
128
- const v = factory(Version);
127
+ test('should increment version (prepatch/preReleaseId continuation)', async () => {
128
+ const v = await factory(Version);
129
129
  const options = {
130
130
  latestVersion: '1.2.3-beta.0',
131
131
  increment: 'prerelease',
@@ -135,26 +135,26 @@ describe('version', () => {
135
135
  assert.equal(v.incrementVersion(options), '1.2.3-beta.1');
136
136
  });
137
137
 
138
- test('should increment version (preReleaseId w/o preRelease)', () => {
139
- const v = factory(Version);
138
+ test('should increment version (preReleaseId w/o preRelease)', async () => {
139
+ const v = await factory(Version);
140
140
  assert.equal(
141
141
  v.incrementVersion({ latestVersion: '1.2.3-alpha.0', increment: 'patch', preReleaseId: 'alpha' }),
142
142
  '1.2.3'
143
143
  );
144
144
  });
145
145
 
146
- test('should increment version (non-numeric prepatch continuation)', () => {
147
- const v = factory(Version);
146
+ test('should increment version (non-numeric prepatch continuation)', async () => {
147
+ const v = await factory(Version);
148
148
  assert.equal(v.incrementVersion({ latestVersion: '1.2.3-alpha', increment: 'prerelease' }), '1.2.3-alpha.0');
149
149
  });
150
150
 
151
- test('should increment version (patch release after pre-release)', () => {
152
- const v = factory(Version);
151
+ test('should increment version (patch release after pre-release)', async () => {
152
+ const v = await factory(Version);
153
153
  assert.equal(v.incrementVersion({ latestVersion: '1.2.3-alpha.1', increment: 'patch' }), '1.2.3');
154
154
  });
155
155
 
156
- test('should increment version and start at base 1', () => {
157
- const v = factory(Version);
156
+ test('should increment version and start at base 1', async () => {
157
+ const v = await factory(Version);
158
158
  assert.equal(
159
159
  v.incrementVersion({
160
160
  latestVersion: '1.3.0',
@@ -167,8 +167,8 @@ describe('version', () => {
167
167
  );
168
168
  });
169
169
 
170
- test('should increment prerelease version and ignore prelease base 1', () => {
171
- const v = factory(Version);
170
+ test('should increment prerelease version and ignore prelease base 1', async () => {
171
+ const v = await factory(Version);
172
172
  assert.equal(
173
173
  v.incrementVersion({
174
174
  latestVersion: '1.2.3-alpha.5',
@@ -183,7 +183,7 @@ describe('version', () => {
183
183
 
184
184
  test('should run tasks without errors', async t => {
185
185
  const options = { version: { increment: 'minor' } };
186
- const v = factory(Version, { options });
186
+ const v = await factory(Version, { options });
187
187
  const getIncrement = t.mock.method(v, 'getIncrement');
188
188
  const getIncrementedVersionCI = t.mock.method(v, 'getIncrementedVersionCI');
189
189
  const incrementVersion = t.mock.method(v, 'incrementVersion');