11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst { spawnPromisified } = require('../common'); 41cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures.js'); 51cb0ef41Sopenharmony_ciconst assert = require('node:assert'); 61cb0ef41Sopenharmony_ciconst { execPath } = require('node:process'); 71cb0ef41Sopenharmony_ciconst { describe, it } = require('node:test'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci// In a "type": "module" package scope, files with unknown extensions should throw; 111cb0ef41Sopenharmony_ci// both when used as a main entry point and also when referenced via `import`. 121cb0ef41Sopenharmony_cidescribe('ESM: unknown specifiers', { concurrency: true }, () => { 131cb0ef41Sopenharmony_ci for ( 141cb0ef41Sopenharmony_ci const fixturePath of [ 151cb0ef41Sopenharmony_ci '/es-modules/package-type-module/extension.unknown', 161cb0ef41Sopenharmony_ci '/es-modules/package-type-module/imports-unknownext.mjs', 171cb0ef41Sopenharmony_ci ] 181cb0ef41Sopenharmony_ci ) { 191cb0ef41Sopenharmony_ci it('should throw', async () => { 201cb0ef41Sopenharmony_ci const entry = fixtures.path(fixturePath); 211cb0ef41Sopenharmony_ci const { code, signal, stderr, stdout } = await spawnPromisified(execPath, [entry]); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci assert.strictEqual(code, 1); 241cb0ef41Sopenharmony_ci assert.strictEqual(signal, null); 251cb0ef41Sopenharmony_ci assert.strictEqual(stdout, ''); 261cb0ef41Sopenharmony_ci assert.match(stderr, /ERR_UNKNOWN_FILE_EXTENSION/); 271cb0ef41Sopenharmony_ci }); 281cb0ef41Sopenharmony_ci } 291cb0ef41Sopenharmony_ci}); 30