Skip to content

Commit

Permalink
test,ios: patch some tests so they pass
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Oct 12, 2023
1 parent 00ea14a commit 35ac4ac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions test/parallel/test-http-response-setheaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ const assert = require('assert');
{
const server = http.createServer({ requireHostHeader: false }, common.mustCall((req, res) => {
res.writeHead(200); // Headers already sent
// nodejs-mobile patch: globalThis.Headers uses undici uses Wasm, bad on iOS
/*
const headers = new globalThis.Headers({ foo: '1' });
assert.throws(() => {
res.setHeaders(headers);
}, {
code: 'ERR_HTTP_HEADERS_SENT'
});
*/
res.end();
}));

Expand Down Expand Up @@ -70,6 +73,8 @@ const assert = require('assert');
}));
}

// nodejs-mobile patch: globalThis.Headers uses undici uses Wasm, bad on iOS
/*
{
const server = http.createServer({ requireHostHeader: false }, common.mustCall((req, res) => {
const headers = new globalThis.Headers({ foo: '1', bar: '2' });
Expand Down Expand Up @@ -109,6 +114,7 @@ const assert = require('assert');
});
}));
}
*/

{
const server = http.createServer({ requireHostHeader: false }, common.mustCall((req, res) => {
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-parse-args.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import assert from 'node:assert';
import { test } from 'node:test';
import { parseArgs } from 'node:util';

// nodejs-mobile patch: note that on iOS this test passes, but doesn't close/die

test('when short option used as flag then stored as flag', () => {
const args = ['-f'];
const expected = { values: { __proto__: null, f: true }, positionals: [] };
Expand Down
7 changes: 5 additions & 2 deletions test/parallel/test-process-getactiveresources.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ const assert = require('assert');

setTimeout(() => {}, 0);

// nodejs-mobile patch to add PipeWrap
assert.deepStrictEqual(process.getActiveResourcesInfo(), ['PipeWrap', 'Timeout']);
// nodejs-mobile patch to add PipeWrap for Android and TTYWrap for iOS
assert.deepStrictEqual(process.getActiveResourcesInfo(), [
process.platform === 'ios' ? 'TTYWrap' : 'PipeWrap',
'Timeout'
]);

0 comments on commit 35ac4ac

Please sign in to comment.