Skip to content
Myr

parameters-args.js

This file

Path

test/methods/parameters-args.js

47 lines · 2.1 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

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

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

lines 3–12why, one step back
3import {
4 execa,5 execaSync,6 execaNode,7 $,8} from '../../index.js';9import {setFixtureDirectory} from '../helpers/fixtures-directory.js';1011setFixtureDirectory();12

TweaksSindre Sorhusbefore adoption698a1b8

lines 13–14why, one step back
13const testInvalidArguments = async execaMethod => {
14 assertThrows(() => {

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

lines 15–18why, one step back
15 execaMethod('echo', true);
16 }, {message: /Second argument must be either/});17};18

TweaksSindre Sorhusbefore adoption698a1b8

lines 19–23why, one step back
19test('execa()\'s second argument must be valid', () => testInvalidArguments(execa));
20test('execaSync()\'s second argument must be valid', () => testInvalidArguments(execaSync));21test('execaNode()\'s second argument must be valid', () => testInvalidArguments(execaNode));22test('$\'s second argument must be valid', () => testInvalidArguments($));23test('$.sync\'s second argument must be valid', () => testInvalidArguments($.sync));

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

line 24why, one step back
24

TweaksSindre Sorhusbefore adoption698a1b8

lines 25–26why, one step back
25const testInvalidArgumentsItems = async execaMethod => {
26 assertThrows(() => {

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

lines 27–30why, one step back
27 execaMethod('echo', [{}]);
28 }, {message: 'Second argument must be an array of strings: [object Object]'});29};30

TweaksSindre Sorhusbefore adoption698a1b8

lines 31–35why, one step back
31test('execa()\'s second argument must not be objects', () => testInvalidArgumentsItems(execa));
32test('execaSync()\'s second argument must not be objects', () => testInvalidArgumentsItems(execaSync));33test('execaNode()\'s second argument must not be objects', () => testInvalidArgumentsItems(execaNode));34test('$\'s second argument must not be objects', () => testInvalidArgumentsItems($));35test('$.sync\'s second argument must not be objects', () => testInvalidArgumentsItems($.sync));

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

line 36why, one step back
36

TweaksSindre Sorhusbefore adoption698a1b8

lines 37–38why, one step back
37const testNullByteArgument = async execaMethod => {
38 assertThrows(() => {

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

lines 39–42why, one step back
39 execaMethod('echo', ['a\0b']);
40 }, {message: /null bytes/});41};42

TweaksSindre Sorhusbefore adoption698a1b8

lines 43–47why, one step back
43test('execa()\'s second argument must not include \\0', () => testNullByteArgument(execa));
44test('execaSync()\'s second argument must not include \\0', () => testNullByteArgument(execaSync));45test('execaNode()\'s second argument must not include \\0', () => testNullByteArgument(execaNode));46test('$\'s second argument must not include \\0', () => testNullByteArgument($));47test('$.sync\'s second argument must not include \\0', () => testNullByteArgument($.sync));