test: use process.version for old NodeJS version

This commit is contained in:
microshine 2021-02-04 23:21:16 +03:00
parent a402f4ac95
commit 8713a49497
1 changed files with 26 additions and 23 deletions

View File

@ -1,8 +1,11 @@
import assert from "assert";
import process from "process";
import { WebcryptoTest } from "@peculiar/webcrypto-test";
import * as core from "webcrypto-core";
import { Crypto } from "../src";
const nodeMajorVersion = parseInt(/^v(\d+)/.exec(process.version)![1], 10);
const crypto = new Crypto();
WebcryptoTest.check(crypto as any, {});
@ -57,7 +60,7 @@ context("Crypto", () => {
assert.strictEqual((hmac.algorithm as globalThis.HmacKeyAlgorithm).length, 512);
});
context("EdDSA", () => {
(nodeMajorVersion < 14 ? context.skip : context)("EdDSA", () => {
context("generateKey", () => {
@ -88,7 +91,7 @@ context("Crypto", () => {
});
context("ECDH-ES", () => {
(nodeMajorVersion < 14 ? context.skip : context)("ECDH-ES", () => {
context("generateKey", () => {