11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst { pathToFileURL } = require('url');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciassert.rejects(
81cb0ef41Sopenharmony_ci  import('data:text/javascript,require;'),
91cb0ef41Sopenharmony_ci  /require is not defined in ES module scope, you can use import instead$/
101cb0ef41Sopenharmony_ci).then(common.mustCall());
111cb0ef41Sopenharmony_ciassert.rejects(
121cb0ef41Sopenharmony_ci  import('data:text/javascript,exports={};'),
131cb0ef41Sopenharmony_ci  /exports is not defined in ES module scope$/
141cb0ef41Sopenharmony_ci).then(common.mustCall());
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciassert.rejects(
171cb0ef41Sopenharmony_ci  import('data:text/javascript,require_custom;'),
181cb0ef41Sopenharmony_ci  /^(?!in ES module scope)(?!use import instead).*$/
191cb0ef41Sopenharmony_ci).then(common.mustCall());
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ciconst pkgUrl = pathToFileURL(fixtures.path('/es-modules/package-type-module/'));
221cb0ef41Sopenharmony_ciassert.rejects(
231cb0ef41Sopenharmony_ci  import(new URL('./cjs.js', pkgUrl)),
241cb0ef41Sopenharmony_ci  /use the '\.cjs' file extension/
251cb0ef41Sopenharmony_ci).then(common.mustCall());
261cb0ef41Sopenharmony_ciassert.rejects(
271cb0ef41Sopenharmony_ci  import(new URL('./cjs.js#target', pkgUrl)),
281cb0ef41Sopenharmony_ci  /use the '\.cjs' file extension/
291cb0ef41Sopenharmony_ci).then(common.mustCall());
301cb0ef41Sopenharmony_ciassert.rejects(
311cb0ef41Sopenharmony_ci  import(new URL('./cjs.js?foo=bar', pkgUrl)),
321cb0ef41Sopenharmony_ci  /use the '\.cjs' file extension/
331cb0ef41Sopenharmony_ci).then(common.mustCall());
341cb0ef41Sopenharmony_ciassert.rejects(
351cb0ef41Sopenharmony_ci  import(new URL('./cjs.js?foo=bar#target', pkgUrl)),
361cb0ef41Sopenharmony_ci  /use the '\.cjs' file extension/
371cb0ef41Sopenharmony_ci).then(common.mustCall());
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ciassert.rejects(
401cb0ef41Sopenharmony_ci  import('data:text/javascript,require;//.js'),
411cb0ef41Sopenharmony_ci  /^(?!use the '\.cjs' file extension).*$/
421cb0ef41Sopenharmony_ci).then(common.mustCall());
43