Skip to content

Commit 43fa2df

Browse files
committed
fixup! test: add header download test
1 parent 5e6add6 commit 43fa2df

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

test/test-download.js

+8-12
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ test('download headers (actual)', function (t) {
119119
return t.skip('Skipping acutal download of headers due to test environment configuration')
120120
}
121121

122-
t.plan(19)
122+
t.plan(17)
123123

124124
const expectedDir = path.join(devDir, process.version.replace(/^v/, ''))
125125
rimraf(expectedDir, (err) => {
@@ -157,20 +157,16 @@ test('download headers (actual)', function (t) {
157157

158158
const lines = contents.split('\n')
159159

160-
// extract the 3 version parts from the defines and check them against our env version
161-
160+
// extract the 3 version parts from the defines to build a valid version string and
161+
// and check them against our current env version
162162
const version = ['major', 'minor', 'patch'].reduce((version, type) => {
163163
const re = new RegExp(`^#define\\sNODE_${type.toUpperCase()}_VERSION`)
164164
const line = lines.find((l) => re.test(l))
165-
if (line) {
166-
version[type] = parseInt(line.replace(/^[^0-9]+([0-9]+).*$/, '$1'), 10)
167-
}
168-
return version
169-
}, {})
170-
171-
t.strictEqual(version.major, semver.major(process.version))
172-
t.strictEqual(version.minor, semver.minor(process.version))
173-
t.strictEqual(version.patch, semver.patch(process.version))
165+
const i = line ? parseInt(line.replace(/^[^0-9]+([0-9]+).*$/, '$1'), 10) : 'ERROR'
166+
return `${version}${type !== 'major' ? '.' : 'v'}${i}`
167+
}, '')
168+
169+
t.strictEqual(version, process.version)
174170
})
175171
})
176172
})

0 commit comments

Comments
 (0)