11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciif (!common.hasCrypto) 51cb0ef41Sopenharmony_ci common.skip('missing crypto'); 61cb0ef41Sopenharmony_cicommon.requireNoPackageJSONAbove(); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst assert = require('assert'); 111cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process'); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst encodings = ['buffer', 'utf8', 'utf16le', 'latin1', 'base64', 'hex']; 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_cifor (const encoding of encodings) { 161cb0ef41Sopenharmony_ci const dep = fixtures.path('policy', 'crypto-default-encoding', 'parent.js'); 171cb0ef41Sopenharmony_ci const depPolicy = fixtures.path( 181cb0ef41Sopenharmony_ci 'policy', 191cb0ef41Sopenharmony_ci 'crypto-default-encoding', 201cb0ef41Sopenharmony_ci 'policy.json'); 211cb0ef41Sopenharmony_ci const { status } = spawnSync( 221cb0ef41Sopenharmony_ci process.execPath, 231cb0ef41Sopenharmony_ci [ 241cb0ef41Sopenharmony_ci '--experimental-policy', depPolicy, dep, 251cb0ef41Sopenharmony_ci ], 261cb0ef41Sopenharmony_ci { 271cb0ef41Sopenharmony_ci env: { 281cb0ef41Sopenharmony_ci ...process.env, 291cb0ef41Sopenharmony_ci DEFAULT_ENCODING: encoding 301cb0ef41Sopenharmony_ci } 311cb0ef41Sopenharmony_ci } 321cb0ef41Sopenharmony_ci ); 331cb0ef41Sopenharmony_ci assert.strictEqual(status, 0); 341cb0ef41Sopenharmony_ci} 35