11cb0ef41Sopenharmony_ci// Flags: --experimental-vm-modules 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst { SourceTextModule } = require('vm'); 71cb0ef41Sopenharmony_ciconst { inspect } = require('util'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci(async () => { 101cb0ef41Sopenharmony_ci const m = new SourceTextModule('export const a = 1; export var b = 2'); 111cb0ef41Sopenharmony_ci await m.link(() => 0); 121cb0ef41Sopenharmony_ci assert.strictEqual( 131cb0ef41Sopenharmony_ci inspect(m.namespace), 141cb0ef41Sopenharmony_ci '[Module: null prototype] { a: <uninitialized>, b: undefined }'); 151cb0ef41Sopenharmony_ci await m.evaluate(); 161cb0ef41Sopenharmony_ci assert.strictEqual( 171cb0ef41Sopenharmony_ci inspect(m.namespace), 181cb0ef41Sopenharmony_ci '[Module: null prototype] { a: 1, b: 2 }' 191cb0ef41Sopenharmony_ci ); 201cb0ef41Sopenharmony_ci})().then(common.mustCall()); 21