1// Flags: --experimental-loader ./test/fixtures/es-module-loaders/string-sources.mjs 2import { mustCall, mustNotCall } from '../common/index.mjs'; 3import assert from 'assert'; 4 5import('test:Array').then( 6 mustNotCall('Should not accept Arrays'), 7 mustCall((e) => { 8 assert.strictEqual(e.code, 'ERR_INVALID_RETURN_PROPERTY_VALUE'); 9 }) 10); 11import('test:ArrayBuffer').then( 12 mustCall(), 13 mustNotCall('Should accept ArrayBuffers'), 14); 15import('test:BigInt64Array').then( 16 mustCall(), 17 mustNotCall('Should accept BigInt64Array'), 18); 19import('test:BigUint64Array').then( 20 mustCall(), 21 mustNotCall('Should accept BigUint64Array'), 22); 23import('test:Float32Array').then( 24 mustCall(), 25 mustNotCall('Should accept Float32Array'), 26); 27import('test:Float64Array').then( 28 mustCall(), 29 mustNotCall('Should accept Float64Array'), 30); 31import('test:Int8Array').then( 32 mustCall(), 33 mustNotCall('Should accept Int8Array'), 34); 35import('test:Int16Array').then( 36 mustCall(), 37 mustNotCall('Should accept Int16Array'), 38); 39import('test:Int32Array').then( 40 mustCall(), 41 mustNotCall('Should accept Int32Array'), 42); 43import('test:null').then( 44 mustNotCall('Should not accept null'), 45 mustCall((e) => { 46 assert.strictEqual(e.code, 'ERR_INVALID_RETURN_PROPERTY_VALUE'); 47 }) 48); 49import('test:Object').then( 50 mustNotCall('Should not stringify or valueOf Objects'), 51 mustCall((e) => { 52 assert.strictEqual(e.code, 'ERR_INVALID_RETURN_PROPERTY_VALUE'); 53 }) 54); 55import('test:SharedArrayBuffer').then( 56 mustCall(), 57 mustNotCall('Should accept SharedArrayBuffers'), 58); 59import('test:string').then( 60 mustCall(), 61 mustNotCall('Should accept strings'), 62); 63import('test:String').then( 64 mustNotCall('Should not accept wrapper Strings'), 65 mustCall((e) => { 66 assert.strictEqual(e.code, 'ERR_INVALID_RETURN_PROPERTY_VALUE'); 67 }) 68); 69import('test:Uint8ClampedArray').then( 70 mustCall(), 71 mustNotCall('Should accept Uint8ClampedArray'), 72); 73import('test:Uint16Array').then( 74 mustCall(), 75 mustNotCall('Should accept Uint16Array'), 76); 77import('test:Uint32Array').then( 78 mustCall(), 79 mustNotCall('Should accept Uint32Array'), 80); 81import('test:Uint8Array').then( 82 mustCall(), 83 mustNotCall('Should accept Uint8Arrays'), 84); 85import('test:undefined').then( 86 mustNotCall('Should not accept undefined'), 87 mustCall((e) => { 88 assert.strictEqual(e.code, 'ERR_INVALID_RETURN_PROPERTY_VALUE'); 89 }) 90); 91