xref: /third_party/node/test/parallel/test-vm-source-map-url.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst vm = require('vm');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cifunction checkSourceMapUrl(source, expectedSourceMapURL) {
81cb0ef41Sopenharmony_ci  const script = new vm.Script(source);
91cb0ef41Sopenharmony_ci  assert.strictEqual(script.sourceMapURL, expectedSourceMapURL);
101cb0ef41Sopenharmony_ci}
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci// No magic comment
131cb0ef41Sopenharmony_cicheckSourceMapUrl(`
141cb0ef41Sopenharmony_cifunction myFunc() {}
151cb0ef41Sopenharmony_ci`, undefined);
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci// Malformed magic comment
181cb0ef41Sopenharmony_cicheckSourceMapUrl(`
191cb0ef41Sopenharmony_cifunction myFunc() {}
201cb0ef41Sopenharmony_ci// sourceMappingURL=sourcemap.json
211cb0ef41Sopenharmony_ci`, undefined);
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci// Expected magic comment
241cb0ef41Sopenharmony_cicheckSourceMapUrl(`
251cb0ef41Sopenharmony_cifunction myFunc() {}
261cb0ef41Sopenharmony_ci//# sourceMappingURL=sourcemap.json
271cb0ef41Sopenharmony_ci`, 'sourcemap.json');
28

Indexes created Thu Nov 07 10:32:03 CST 2024