Skip to content
Myr

parameters-options.js

This file

Path

test/methods/parameters-options.js

73 lines · 4.7 KiB · JavaScript

Last changed by

TweaksSindre Sorhusbefore adoption698a1b8

History of this file

Take it

The walk stopped after 200 commits: lines older than 08eb743 point at it.

TweaksSindre Sorhusbefore adoption698a1b8

line 1why, one step back
1import assert from 'node:assert/strict';

Upgrade dependencies (#1138)ehmickybefore adoptionabd9fd0

line 2why, one step back
2import path from 'node:path';

TweaksSindre Sorhusbefore adoption698a1b8

lines 3–4why, one step back
3import test from 'node:test';
4import {assertThrows} from '../helpers/assert.js';

Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743

lines 5–14why, one step back
5import {
6 execa,7 execaSync,8 execaNode,9 $,10} from '../../index.js';11import {setFixtureDirectory, FIXTURES_DIRECTORY} from '../helpers/fixtures-directory.js';1213setFixtureDirectory();14

Upgrade dependencies (#1138)ehmickybefore adoptionabd9fd0

line 15why, one step back
15const NOOP_PATH = path.join(FIXTURES_DIRECTORY, 'noop.js');

Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743

line 16why, one step back
16

TweaksSindre Sorhusbefore adoption698a1b8

line 17why, one step back
17const testSerializeArgument = async (commandArgument, execaMethod) => {

Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743

line 18why, one step back
18 const {stdout} = await execaMethod(NOOP_PATH, [commandArgument]);

TweaksSindre Sorhusbefore adoption698a1b8

line 19why, one step back
19 assert.equal(stdout, String(commandArgument));

Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743

lines 20–21why, one step back
20};
21

TweaksSindre Sorhusbefore adoption698a1b8

lines 22–61why, one step back
22test('execa()\'s arguments can be numbers', () => testSerializeArgument(1, execa));
23test('execa()\'s arguments can be booleans', () => testSerializeArgument(true, execa));24test('execa()\'s arguments can be NaN', () => testSerializeArgument(NaN, execa));25test('execa()\'s arguments can be Infinity', () => testSerializeArgument(Infinity, execa));26test('execa()\'s arguments can be null', () => testSerializeArgument(null, execa));27test('execa()\'s arguments can be undefined', () => testSerializeArgument(undefined, execa));28test('execa()\'s arguments can be bigints', () => testSerializeArgument(1n, execa));29test('execa()\'s arguments can be symbols', () => testSerializeArgument(Symbol('test'), execa));30test('execaSync()\'s arguments can be numbers', () => testSerializeArgument(1, execaSync));31test('execaSync()\'s arguments can be booleans', () => testSerializeArgument(true, execaSync));32test('execaSync()\'s arguments can be NaN', () => testSerializeArgument(NaN, execaSync));33test('execaSync()\'s arguments can be Infinity', () => testSerializeArgument(Infinity, execaSync));34test('execaSync()\'s arguments can be null', () => testSerializeArgument(null, execaSync));35test('execaSync()\'s arguments can be undefined', () => testSerializeArgument(undefined, execaSync));36test('execaSync()\'s arguments can be bigints', () => testSerializeArgument(1n, execaSync));37test('execaSync()\'s arguments can be symbols', () => testSerializeArgument(Symbol('test'), execaSync));38test('execaNode()\'s arguments can be numbers', () => testSerializeArgument(1, execaNode));39test('execaNode()\'s arguments can be booleans', () => testSerializeArgument(true, execaNode));40test('execaNode()\'s arguments can be NaN', () => testSerializeArgument(NaN, execaNode));41test('execaNode()\'s arguments can be Infinity', () => testSerializeArgument(Infinity, execaNode));42test('execaNode()\'s arguments can be null', () => testSerializeArgument(null, execaNode));43test('execaNode()\'s arguments can be undefined', () => testSerializeArgument(undefined, execaNode));44test('execaNode()\'s arguments can be bigints', () => testSerializeArgument(1n, execaNode));45test('execaNode()\'s arguments can be symbols', () => testSerializeArgument(Symbol('test'), execaNode));46test('$\'s arguments can be numbers', () => testSerializeArgument(1, $));47test('$\'s arguments can be booleans', () => testSerializeArgument(true, $));48test('$\'s arguments can be NaN', () => testSerializeArgument(NaN, $));49test('$\'s arguments can be Infinity', () => testSerializeArgument(Infinity, $));50test('$\'s arguments can be null', () => testSerializeArgument(null, $));51test('$\'s arguments can be undefined', () => testSerializeArgument(undefined, $));52test('$\'s arguments can be bigints', () => testSerializeArgument(1n, $));53test('$\'s arguments can be symbols', () => testSerializeArgument(Symbol('test'), $));54test('$.sync\'s arguments can be numbers', () => testSerializeArgument(1, $.sync));55test('$.sync\'s arguments can be booleans', () => testSerializeArgument(true, $.sync));56test('$.sync\'s arguments can be NaN', () => testSerializeArgument(NaN, $.sync));57test('$.sync\'s arguments can be Infinity', () => testSerializeArgument(Infinity, $.sync));58test('$.sync\'s arguments can be null', () => testSerializeArgument(null, $.sync));59test('$.sync\'s arguments can be undefined', () => testSerializeArgument(undefined, $.sync));60test('$.sync\'s arguments can be bigints', () => testSerializeArgument(1n, $.sync));61test('$.sync\'s arguments can be symbols', () => testSerializeArgument(Symbol('test'), $.sync));

Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743

line 62why, one step back
62

TweaksSindre Sorhusbefore adoption698a1b8

lines 63–64why, one step back
63const testInvalidOptions = async execaMethod => {
64 assertThrows(() => {

Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743

lines 65–68why, one step back
65 execaMethod('echo', [], new Map());
66 }, {message: /Last argument must be an options object/});67};68

TweaksSindre Sorhusbefore adoption698a1b8

lines 69–73why, one step back
69test('execa()\'s third argument must be a plain object', () => testInvalidOptions(execa));
70test('execaSync()\'s third argument must be a plain object', () => testInvalidOptions(execaSync));71test('execaNode()\'s third argument must be a plain object', () => testInvalidOptions(execaNode));72test('$\'s third argument must be a plain object', () => testInvalidOptions($));73test('$.sync\'s third argument must be a plain object', () => testInvalidOptions($.sync));