From ae95f77d681b6310bca1f6fb908d8406c78e0e23 Mon Sep 17 00:00:00 2001 From: Aleksei Kuzmin Date: Wed, 19 Sep 2018 12:54:58 +0200 Subject: [PATCH] test: minor improvements to the Node spec - reformat some parts - better failures reporting with `expect` - skip some tests instead of marking them as passed --- spec/node-spec.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/spec/node-spec.js b/spec/node-spec.js index 0112df2c09ae..bc9df5bdff93 100644 --- a/spec/node-spec.js +++ b/spec/node-spec.js @@ -1,5 +1,6 @@ const assert = require('assert') const ChildProcess = require('child_process') +const { expect } = require('chai') const fs = require('fs') const path = require('path') const os = require('os') @@ -206,10 +207,10 @@ describe('node feature', () => { }) describe('inspector', () => { - let child + let child = null afterEach(() => { - if (child != null) child.kill() + if (child !== null) child.kill() }) it('supports starting the v8 inspector with --inspect/--inspect-brk', (done) => { @@ -356,8 +357,7 @@ describe('node feature', () => { it('should have isTTY defined on Mac and Linux', function () { if (isCI || process.platform === 'win32') { - // FIXME(alexeykuzmin): Skip the test. - // this.skip() + this.skip() return } @@ -366,8 +366,7 @@ describe('node feature', () => { it('should have isTTY undefined on Windows', function () { if (isCI || process.platform !== 'win32') { - // FIXME(alexeykuzmin): Skip the test. - // this.skip() + this.skip() return } @@ -393,17 +392,23 @@ describe('node feature', () => { }) }) - describe('vm.createContext', () => { + describe('vm.runInNewContext', () => { it('should not crash', () => { require('vm').runInNewContext('') }) }) it('includes the electron version in process.versions', () => { - assert(/^\d+\.\d+\.\d+(\S*)?$/.test(process.versions.electron)) + expect(process.versions) + .to.have.own.property('electron') + .that.is.a('string') + .and.matches(/^\d+\.\d+\.\d+(\S*)?$/) }) it('includes the chrome version in process.versions', () => { - assert(/^\d+\.\d+\.\d+\.\d+$/.test(process.versions.chrome)) + expect(process.versions) + .to.have.own.property('chrome') + .that.is.a('string') + .and.matches(/^\d+\.\d+\.\d+\.\d+$/) }) })