11cb0ef41Sopenharmony_ciimport '../common/index.mjs';
21cb0ef41Sopenharmony_ciimport * as fixtures from '../common/fixtures.mjs';
31cb0ef41Sopenharmony_ciimport * as snapshot from '../common/assertSnapshot.js';
41cb0ef41Sopenharmony_ciimport { describe, it } from 'node:test';
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_cifunction replaceNodeVersion(str) {
71cb0ef41Sopenharmony_ci  return str.replaceAll(process.version, '*');
81cb0ef41Sopenharmony_ci}
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cidescribe('vm output', { concurrency: true }, () => {
111cb0ef41Sopenharmony_ci  function normalize(str) {
121cb0ef41Sopenharmony_ci    return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '').replaceAll('//', '*').replaceAll(/\/(\w)/g, '*$1').replaceAll('*test*', '*').replaceAll(/node:vm:\d+:\d+/g, 'node:vm:*');
131cb0ef41Sopenharmony_ci  }
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci  const defaultTransform = snapshot
161cb0ef41Sopenharmony_ci    .transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, normalize, replaceNodeVersion);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci  const tests = [
191cb0ef41Sopenharmony_ci    { name: 'vm/vm_caught_custom_runtime_error.js' },
201cb0ef41Sopenharmony_ci    { name: 'vm/vm_display_runtime_error.js' },
211cb0ef41Sopenharmony_ci    { name: 'vm/vm_display_syntax_error.js' },
221cb0ef41Sopenharmony_ci    { name: 'vm/vm_dont_display_runtime_error.js' },
231cb0ef41Sopenharmony_ci    { name: 'vm/vm_dont_display_syntax_error.js' },
241cb0ef41Sopenharmony_ci  ];
251cb0ef41Sopenharmony_ci  for (const { name, transform } of tests) {
261cb0ef41Sopenharmony_ci    it(name, async () => {
271cb0ef41Sopenharmony_ci      await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform);
281cb0ef41Sopenharmony_ci    });
291cb0ef41Sopenharmony_ci  }
301cb0ef41Sopenharmony_ci});
31