Add node versions 6, 10 and 14 to the unit tests (#465)

* add 6 10 14 node versions

* remove node 6

* try running matrix

* add node 6

* try test with g

* try both

* try with save dev

* try 7

* try with changed make.js

* change test string

* try another date

* try another date

* fix typo

* change string according to ver

* fix typo

* fix string

* reduce duplication of commands

* add comment for a different strings

Co-authored-by: Ilya Kuleshov <v-ikuleshov@microsoft.com>
This commit is contained in:
kuleshovilya 2021-09-13 10:39:12 +03:00 коммит произвёл GitHub
Родитель 010b234dcb
Коммит 08377d0f3f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 29 добавлений и 5 удалений

Просмотреть файл

@ -1,8 +1,21 @@
strategy:
matrix:
'Node 6':
versionSpec: '6.x'
'Node 8':
versionSpec: '8.x'
'Node 10':
versionSpec: '10.x'
'Node 12':
versionSpec: '12.x'
'Node 14':
versionSpec: '14.x'
steps:
- task: NodeTool@0
inputs:
versionSpec: "8.x"
displayName: Install node 8
versionSpec: $(versionSpec)
displayName: Install node
# install dependencies
- script: npm install

12
make.js
Просмотреть файл

@ -1,6 +1,7 @@
require('shelljs/make');
var path = require('path');
var fs = require('fs');
var semver = require('semver');
var rp = function(relPath) {
return path.join(__dirname, relPath);
@ -41,8 +42,15 @@ target.build = function() {
target.units = function() {
target.build();
pushd('test');
var nodeVer = process.versions.node;
//check for node version, since installation strategy is different for node versions less than 8
if(semver.lt(nodeVer,'8.0.0')){
pushd('_build');
}
else{
pushd('test');
}
run('npm install ../_build');
popd();

Просмотреть файл

@ -6,6 +6,7 @@ import vsom = require('../../_build/VsoClient');
import WebApi = require('../../_build/WebApi');
import * as rm from '../../_build/node_modules/typed-rest-client/RestClient';
import { ApiResourceLocation } from '../../_build/interfaces/common/VsoBaseInterfaces';
import semver = require('semver');
describe('VSOClient Units', function () {
let rest: rm.RestClient;
@ -180,7 +181,9 @@ describe('VSOClient Units', function () {
//Assert
assert.equal(res.apiVersion, '1');
assert.equal(res.requestUrl, 'https://dev.azure.com/testTemplate?min=Wed%2C%2019%20Oct%200208%2000%3A00%3A00%20GMT');
//Use different strings for Node 6 and 8, because of a varied response string
var expectedURL = semver.lt(process.versions.node, '8.0.0') ? 'https://dev.azure.com/testTemplate?min=Wed%2C%2019%20Oct%20%20208%2000%3A00%3A00%20GMT' : 'https://dev.azure.com/testTemplate?min=Wed%2C%2019%20Oct%200208%2000%3A00%3A00%20GMT';
assert.equal(res.requestUrl, expectedURL);
});
it('gets versioning data after an initialization promise', async () => {