Skip to content

Commit

Permalink
[FEA] Add AsyncIterable switchMap (#340)
Browse files Browse the repository at this point in the history
* feat(asynciterable): add AsyncIterable switchMap operator

* fix lint and run prettier on all files

* fix typo

* refactor SwitchMapAsyncIterable into generic FlattenConcurrentAsyncIterable

* update typescript, jest, related dependencies

* feat(flatmap.ts): make flatMap enumerate inner sequences in parallel

BREAKING CHANGE: flatMap enumerates inner sequences in parallel

fix #244

* feat(flat.ts): make flat enumerate inner sequences in parallel

BREAKING CHANGE: flat enumerates inner sequences in parallel

* feat(concatmap.ts): add concatMap implementation
  • Loading branch information
trxcllnt authored Mar 21, 2022
1 parent 1807093 commit 7b7d493
Show file tree
Hide file tree
Showing 70 changed files with 838 additions and 576 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
"args": [
"--verbose",
"-runInBand",
"--no-cache",
"--runInBand",
"-c", "jestconfigs/jest.${input:TEST_TARGET}.config.js",
"${input:TEST_FILE}"
]
Expand Down
25 changes: 13 additions & 12 deletions gulp/argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,25 @@
// under the License.

const argv = require(`command-line-args`)([
{ name: `all`, type: Boolean },
{ name: 'verbose', alias: 'v', type: Boolean },
{ name: `target`, type: String, defaultValue: `` },
{ name: `module`, type: String, defaultValue: `` },
{ name: `coverage`, type: Boolean, defaultValue: false },
{ name: `targets`, alias: `t`, type: String, multiple: true, defaultValue: [] },
{ name: `modules`, alias: `m`, type: String, multiple: true, defaultValue: [] },
{ name: `all`, type: Boolean },
{ name: 'verbose', alias: 'v', type: Boolean },
{ name: `target`, type: String, defaultValue: `` },
{ name: `module`, type: String, defaultValue: `` },
{ name: `coverage`, type: Boolean, defaultValue: false },
{ name: `tests`, type: String, multiple: true, defaultValue: [`spec/*`] },
{ name: `targets`, alias: `t`, type: String, multiple: true, defaultValue: [] },
{ name: `modules`, alias: `m`, type: String, multiple: true, defaultValue: [] },
], { partial: true });

const { targets, modules } = argv;

if (argv.target === `src`) {
argv.target && !targets.length && targets.push(argv.target);
argv.target && !targets.length && targets.push(argv.target);
} else {
argv.target && !targets.length && targets.push(argv.target);
argv.module && !modules.length && modules.push(argv.module);
(argv.all || !targets.length) && targets.push(`all`);
(argv.all || !modules.length) && modules.push(`all`);
argv.target && !targets.length && targets.push(argv.target);
argv.module && !modules.length && modules.push(argv.module);
(argv.all || !targets.length) && targets.push(`all`);
(argv.all || !modules.length) && modules.push(`all`);
}

module.exports = { argv, targets, modules };
42 changes: 22 additions & 20 deletions gulp/test-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,31 @@ if (targetAndModuleCombinations.length > 1) {

const jest = path.join(path.parse(require.resolve(`jest`)).dir, `../bin/jest.js`);
const testOptions = {
stdio: [`ignore`, `inherit`, `inherit`],
env: {
...process.env,
// hide fs.promises/stream[Symbol.asyncIterator] warnings
NODE_NO_WARNINGS: `1`,
TS_JEST_DISABLE_VER_CHECKER: true
},
stdio: [`ignore`, `inherit`, `inherit`],
env: {
...process.env,
// hide fs.promises/stream[Symbol.asyncIterator] warnings
NODE_NO_WARNINGS: `1`,
TS_JEST_DISABLE_VER_CHECKER: true
},
};

const testTask = ((cache, execArgv, testOptions) => memoizeTask(cache, function test(target, format) {
const args = [...execArgv];
const opts = { ...testOptions };
if (argv.coverage) {
args.push(`-c`, `jest.coverage.config.js`, `--coverage`);
} else {
const cfgname = [target, format].filter(Boolean).join('.');
args.push(`-c`, `jestconfigs/jest.${cfgname}.config.js`, `spec/*`);
}
opts.env = { ...opts.env,
TEST_DOM_STREAMS: (target ==='src' || format === 'umd').toString(),
TEST_NODE_STREAMS: (target ==='src' || format !== 'umd').toString(),
};
return asyncDone(() => child_process.spawn(`node`, args, opts));
const args = [...execArgv];
const opts = { ...testOptions };
if (argv.coverage) {
args.push(`-c`, `jest.coverage.config.js`, `--coverage`);
} else {
const cfgname = [target, format].filter(Boolean).join('.');
// args.push(`--verbose`, `--no-cache`, `-i`);
args.push(`-c`, `jestconfigs/jest.${cfgname}.config.js`, ...argv.tests);
}
opts.env = {
...opts.env,
TEST_DOM_STREAMS: (target === 'src' || format === 'umd').toString(),
TEST_NODE_STREAMS: (target === 'src' || format !== 'umd').toString(),
};
return asyncDone(() => child_process.spawn(`node`, args, opts));
}))({}, [jest, ...jestArgv], testOptions);

module.exports = testTask;
Expand Down
Loading

0 comments on commit 7b7d493

Please sign in to comment.