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 mainPath = fixtures.path('policy', 'crypto-hash-tampering', 'main.js'); 141cb0ef41Sopenharmony_ciconst policyPath = fixtures.path( 151cb0ef41Sopenharmony_ci 'policy', 161cb0ef41Sopenharmony_ci 'crypto-hash-tampering', 171cb0ef41Sopenharmony_ci 'policy.json'); 181cb0ef41Sopenharmony_ciconst { status, stderr } = 191cb0ef41Sopenharmony_ci spawnSync(process.execPath, ['--experimental-policy', policyPath, mainPath], { encoding: 'utf8' }); 201cb0ef41Sopenharmony_ciassert.strictEqual(status, 1); 211cb0ef41Sopenharmony_ciassert(stderr.includes('sha384-Bnp/T8gFNzT9mHj2G/AeuMH8LcAQ4mljw15nxBNl5yaGM7VgbMzDT7O4+dXZTJJn')); 22