From 690a863aaae16cba328d36b523558ded2a2c38e7 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 25 Sep 2019 11:10:36 -0400 Subject: [PATCH] test: simplify force-context-aware test PR-URL: https://github.com/nodejs/node/pull/29705 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: David Carlier Reviewed-By: James M Snell Reviewed-By: Shelley Vohr Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater --- test/addons/force-context-aware/index.js | 4 ---- test/addons/force-context-aware/test.js | 13 ++++--------- 2 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 test/addons/force-context-aware/index.js diff --git a/test/addons/force-context-aware/index.js b/test/addons/force-context-aware/index.js deleted file mode 100644 index 17b9a0ad1ef969..00000000000000 --- a/test/addons/force-context-aware/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -const common = require('../../common'); - -require(`./build/${common.buildType}/binding`); diff --git a/test/addons/force-context-aware/test.js b/test/addons/force-context-aware/test.js index d5264463a79997..cc2ed940d9223d 100644 --- a/test/addons/force-context-aware/test.js +++ b/test/addons/force-context-aware/test.js @@ -1,13 +1,8 @@ +// Flags: --force-context-aware 'use strict'; const common = require('../../common'); -const childProcess = require('child_process'); const assert = require('assert'); -const path = require('path'); -const mod = path.join('test', 'addons', 'force-context-aware', 'index.js'); - -const execString = `"${process.execPath}" --force-context-aware ./${mod}`; -childProcess.exec(execString, common.mustCall((err) => { - const errMsg = 'Loading non context-aware native modules has been disabled'; - assert.strictEqual(err.message.includes(errMsg), true); -})); +assert.throws(() => { + require(`./build/${common.buildType}/binding`); +}, /^Error: Loading non context-aware native modules has been disabled$/);