2021-08-27 23:47:49 +00:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const { strictEqual } = require('assert');
|
|
|
|
|
|
|
|
async function test() {
|
|
|
|
{
|
|
|
|
const results = await Promise.allSettled([
|
2023-10-14 03:52:38 +00:00
|
|
|
import('../fixtures/empty.js', { with: { type: 'json' } }),
|
2021-08-27 23:47:49 +00:00
|
|
|
import('../fixtures/empty.js'),
|
|
|
|
]);
|
|
|
|
|
|
|
|
strictEqual(results[0].status, 'rejected');
|
|
|
|
strictEqual(results[1].status, 'fulfilled');
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
const results = await Promise.allSettled([
|
|
|
|
import('../fixtures/empty.js'),
|
2023-10-14 03:52:38 +00:00
|
|
|
import('../fixtures/empty.js', { with: { type: 'json' } }),
|
2021-08-27 23:47:49 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
strictEqual(results[0].status, 'fulfilled');
|
|
|
|
strictEqual(results[1].status, 'rejected');
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
const results = await Promise.allSettled([
|
2023-10-14 03:52:38 +00:00
|
|
|
import('../fixtures/empty.json', { with: { type: 'json' } }),
|
2021-08-27 23:47:49 +00:00
|
|
|
import('../fixtures/empty.json'),
|
|
|
|
]);
|
|
|
|
|
|
|
|
strictEqual(results[0].status, 'fulfilled');
|
|
|
|
strictEqual(results[1].status, 'rejected');
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
const results = await Promise.allSettled([
|
|
|
|
import('../fixtures/empty.json'),
|
2023-10-14 03:52:38 +00:00
|
|
|
import('../fixtures/empty.json', { with: { type: 'json' } }),
|
2021-08-27 23:47:49 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
strictEqual(results[0].status, 'rejected');
|
|
|
|
strictEqual(results[1].status, 'fulfilled');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test().then(common.mustCall());
|