repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
michalsnik/aos
https://github.com/michalsnik/aos/blob/329fb34f777034345f4d3f4def4dc3bcc300cc2e/cypress/integration/settings_anchor_spec.js
cypress/integration/settings_anchor_spec.js
describe('setting: anchor', function() { before(() => { cy.visit('/anchor.html'); cy.viewport(1280, 700); cy.initAOS({ offset: 0 }); }); it('Should properly animate elements according to anchor positions', () => { cy.get('.aos-animate').should('have.length', 0); cy.scrollTo(0, 50);...
javascript
MIT
329fb34f777034345f4d3f4def4dc3bcc300cc2e
2026-01-04T15:02:25.536486Z
false
michalsnik/aos
https://github.com/michalsnik/aos/blob/329fb34f777034345f4d3f4def4dc3bcc300cc2e/cypress/integration/settings_easing_spec.js
cypress/integration/settings_easing_spec.js
describe('setting: easing', function() { before(() => { cy.visit('/'); }); it('Should set default easing attribue on body', function() { cy.initAOS(); cy.get('body').should('have.attr', 'data-aos-easing', 'ease'); }); it('Should respect global easing setting and set attribue on body', function()...
javascript
MIT
329fb34f777034345f4d3f4def4dc3bcc300cc2e
2026-01-04T15:02:25.536486Z
false
michalsnik/aos
https://github.com/michalsnik/aos/blob/329fb34f777034345f4d3f4def4dc3bcc300cc2e/cypress/integration/settings_startEvent_spec.js
cypress/integration/settings_startEvent_spec.js
describe('setting: startEvent', function() { beforeEach(() => { cy.visit('/'); }); it('Should allow to initialize AOS on custom event', function() { cy.initAOS({ startEvent: 'customEvent' }); cy.get('.aos-init').should('have.length', 0); cy.dispatchEvent('customEvent'); cy.get('.ao...
javascript
MIT
329fb34f777034345f4d3f4def4dc3bcc300cc2e
2026-01-04T15:02:25.536486Z
false
michalsnik/aos
https://github.com/michalsnik/aos/blob/329fb34f777034345f4d3f4def4dc3bcc300cc2e/cypress/integration/settings_mirror.js
cypress/integration/settings_mirror.js
describe('setting: mirror', function() { before(() => { cy.visit('/'); cy.viewport(1280, 650); cy.initAOS({ mirror: true, offset: 50 }); }); it('Should animate in and out', function() { cy.get('.aos-animate').should('have.length', 6); cy.scrollTo(0, 50); cy.get('.aos-anim...
javascript
MIT
329fb34f777034345f4d3f4def4dc3bcc300cc2e
2026-01-04T15:02:25.536486Z
false
michalsnik/aos
https://github.com/michalsnik/aos/blob/329fb34f777034345f4d3f4def4dc3bcc300cc2e/cypress/plugins/index.js
cypress/plugins/index.js
module.exports = (on, config) => { on('before:browser:launch', (browser = {}, args) => { console.log(browser, args); // see what all is in here! if (browser.name === 'chrome') { args.push('--disable-gpu'); return args; } }); };
javascript
MIT
329fb34f777034345f4d3f4def4dc3bcc300cc2e
2026-01-04T15:02:25.536486Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/readme.js
__tests__/readme.js
"use strict" import { produce, applyPatches, immerable, produceWithPatches, enableMapSet, enablePatches, setAutoFreeze } from "../src/immer" enableMapSet() enablePatches() describe("readme example", () => { it("works", () => { const baseState = [ { todo: "Learn typescript", done: true }, { ...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/curry.js
__tests__/curry.js
"use strict" import { produce, setUseProxies, produceWithPatches, enablePatches } from "../src/immer" enablePatches() runTests("proxy", true) function runTests(name) { describe("curry - " + name, () => { it("should check arguments", () => { expect(() => produce()).toThrowErrorMatchingSnapshot() expect((...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/original.js
__tests__/original.js
"use strict" import {produce, original} from "../src/immer" const isProd = process.env.NODE_ENV === "production" describe("original", () => { const baseState = { a: [], b: {} } it("should return the original from the draft", () => { produce(baseState, draftState => { expect(original(draftState)).toBe(bas...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/isDraftable.js
__tests__/isDraftable.js
"use strict" import {isDraftable} from "../src/immer" test("non-plain object with undefined constructor doesn't error", () => { const obj = Object.create(Object.create(null)) expect(isDraftable(obj)).toBe(false) })
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/plugins.js
__tests__/plugins.js
import {produce, produceWithPatches, applyPatches} from "../src/immer" test("error when using Maps", () => { expect(() => { produce(new Map(), function() {}) }).toThrowErrorMatchingSnapshot() }) test("error when using patches - 1", () => { expect(() => { produce( {}, function() {}, function() {} ) ...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/base.js
__tests__/base.js
"use strict" import {vi} from "vitest" import { Immer, nothing, original, isDraft, immerable, enablePatches, enableMapSet, enableArrayMethods } from "../src/immer" import { each, shallowCopy, DRAFT_STATE, clearPlugin, PluginArrayMethods } from "../src/internal" import deepFreeze from "deep-freeze" import ...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
true
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/current.js
__tests__/current.js
import { setAutoFreeze, current, immerable, isDraft, produce, original, freeze, enableMapSet } from "../src/immer" enableMapSet() runTests("proxy", true) const isProd = process.env.NODE_ENV === "production" function runTests(name) { describe("current - " + name, () => { beforeAll(() => { setAutoFreeze...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/regressions.js
__tests__/regressions.js
"use strict" import { Immer, nothing, original, isDraft, immerable, enableMapSet } from "../src/immer" enableMapSet() runBaseTest("proxy (no freeze)", true, false) runBaseTest("proxy (autofreeze)", true, true) runBaseTest("es5 (no freeze)", false, false) runBaseTest("es5 (autofreeze)", false, true) function ru...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/map-set.js
__tests__/map-set.js
"use strict" import {vi} from "vitest" import { Immer, nothing, original, isDraft, immerable, enablePatches, enableMapSet } from "../src/immer" import {each, shallowCopy, isEnumerable, DRAFT_STATE} from "../src/utils/common" enableMapSet() enablePatches() vi.setConfig({ testTimeout: 1000 }) runBaseTest("prox...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/updateScenarios.js
__tests__/updateScenarios.js
import {describe, test, expect, beforeEach} from "vitest" import {produce} from "../src/immer" // Test configuration - smaller values for faster tests const TEST_CONFIG = { arraySize: 10, nestedArraySize: 2, multiUpdateCount: 5, reuseStateIterations: 5 } function createInitialState(arraySize = TEST_CONFIG.arraySi...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/null.js
__tests__/null.js
"use strict" import {produce} from "../src/immer" describe("null functionality", () => { const baseState = null it("should return the original without modifications", () => { const nextState = produce(baseState, () => {}) expect(nextState).toBe(baseState) }) })
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/patch.js
__tests__/patch.js
"use strict" import {vi} from "vitest" import { produce, applyPatches, produceWithPatches, isDraft, immerable, nothing, enablePatches, enableMapSet } from "../src/immer" enablePatches() enableMapSet() vi.setConfig({ testTimeout: 1000 }) const isProd = process.env.NODE_ENV === "production" function createPa...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/manual.js
__tests__/manual.js
"use strict" import {vi} from "vitest" import { setUseProxies, createDraft, finishDraft, produce, isDraft, enablePatches } from "../src/immer" enablePatches() const isProd = process.env.NODE_ENV === "production" runTests("proxy", true) function runTests(name) { describe("manual - " + name, () => { it("shou...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/__tests__/frozen.js
__tests__/frozen.js
"use strict" import { produce, setUseProxies, setAutoFreeze, freeze, enableMapSet } from "../src/immer" enableMapSet() const {isFrozen} = Object runTests("proxy", true) function runTests(name) { describe("auto freeze - " + name, () => { beforeAll(() => { setAutoFreeze(true) }) it("never freezes the ...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/perf-testing/rolldown.config.js
perf-testing/rolldown.config.js
export default { input: "immutability-benchmarks.mjs", output: { file: "dist/immutability-benchmarks.js", sourcemap: true }, platform: "node", define: { "process.env.NODE_ENV": JSON.stringify("production") }, external: ["bun:jsc", "@mitata/counters"], resolve: { alias: { immer10Perf: "../dist/immer.m...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/perf-testing/read-cpuprofile.js
perf-testing/read-cpuprofile.js
import fs from "fs" import {SourceMapConsumer} from "source-map" let profileName = process.argv[2] if (!profileName) { const cpuProfiles = fs.readdirSync(".").filter(f => f.endsWith(".cpuprofile")) const [lastProfile] = cpuProfiles.slice(-1) if (!lastProfile) { console.error("Usage: node read-cpuprofile.js <path...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/website/sidebars.js
website/sidebars.js
module.exports = { Immer: { Basics: [ "introduction", "installation", "produce", "curried-produce", "example-setstate", "update-patterns" ], "Advanced Features": [ "api", "map-set", "array-methods", "complex-objects", "current", "original", "patches", "freezing", "ret...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
immerjs/immer
https://github.com/immerjs/immer/blob/570c8009c40990fe5b0f742c5ae114c107a5024f/website/docusaurus.config.js
website/docusaurus.config.js
// See https://v2.docusaurus.io/docs/configuration for more information. module.exports = { title: "Immer", tagline: "Create the next immutable state by mutating the current one.", url: "https://immerjs.github.io/", baseUrl: process.env.NETLIFY_PREVIEW ? "/" : "/immer/", projectName: "immer", organizationName: "...
javascript
MIT
570c8009c40990fe5b0f742c5ae114c107a5024f
2026-01-04T15:01:58.604570Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/index.js
index.js
const { Argument } = require('./lib/argument.js'); const { Command } = require('./lib/command.js'); const { CommanderError, InvalidArgumentError } = require('./lib/error.js'); const { Help } = require('./lib/help.js'); const { Option } = require('./lib/option.js'); exports.program = new Command(); exports.createComma...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/.prettierrc.js
.prettierrc.js
const config = { singleQuote: true, overrides: [ { files: ['tsconfig*.json'], options: { parser: 'jsonc' }, }, ], }; module.exports = config;
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/jest.config.js
jest.config.js
const config = { testEnvironment: 'node', collectCoverage: true, transform: { '^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.ts.json' }], }, testPathIgnorePatterns: ['/node_modules/'], }; module.exports = config;
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/eslint.config.js
eslint.config.js
const globals = require('globals'); const esLintjs = require('@eslint/js'); const jest = require('eslint-plugin-jest'); const tseslint = require('typescript-eslint'); const prettier = require('eslint-config-prettier'); // Only run tseslint on the files that we have included for TypeScript. const tsconfigTsFiles = ['**...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.unknownOption.test.js
tests/command.unknownOption.test.js
const commander = require('../'); // Checking for detection of unknown options, including regression tests for some past issues. describe('unknownOption', () => { // Optional. Use internal knowledge to suppress output to keep test output clean. let writeErrorSpy; beforeAll(() => { writeErrorSpy = jest ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.flags.test.js
tests/options.flags.test.js
const commander = require('../'); // Test the various ways flags can be specified in the first parameter to `.option` test('when only short flag defined and not specified then value is undefined', () => { const program = new commander.Command(); program.option('-p', 'add pepper'); program.parse(['node', 'test']...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/deprecated.test.js
tests/deprecated.test.js
const commander = require('../'); // Test for backwards compatible behaviour of deprecated features that don't fit in elsewhere. // We keep deprecated features working (when not too difficult) to avoid breaking existing code // and reduce barriers to updating to latest version of Commander. describe('option with regu...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.addHelpText.test.js
tests/command.addHelpText.test.js
const commander = require('../'); // Using outputHelp to simplify testing. describe('program calls to addHelpText', () => { let writeSpy; beforeAll(() => { writeSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => {}); }); afterEach(() => { writeSpy.mockClear(); }); afterAll(() =>...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.addCommand.test.js
tests/command.addCommand.test.js
const commander = require('../'); // simple sanity check subcommand works test('when addCommand and specify subcommand then called', () => { const program = new commander.Command(); const leafAction = jest.fn(); const sub = new commander.Command(); sub.name('sub').action(leafAction); program.addCommand(sub);...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.registerClash.test.js
tests/command.registerClash.test.js
const { Command } = require('../'); test('when command name conflicts with existing name then throw', () => { expect(() => { const program = new Command(); program.command('one'); program.command('one'); }).toThrow('cannot add command'); }); test('when command name conflicts with existing alias then t...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.executableSubcommand.search.test.js
tests/command.executableSubcommand.search.test.js
const childProcess = require('child_process'); const fs = require('fs'); const path = require('path'); const commander = require('../'); // This file does in-process mocking. Bit clumsy but faster and less external clutter than using fixtures. // See also command.executableSubcommand.lookup.test.js for tests using fix...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.implies.test.js
tests/options.implies.test.js
const { Command, Option } = require('../'); describe('check priorities', () => { test('when source undefined and implied undefined then implied is undefined', () => { const program = new Command(); program .addOption(new Option('--foo').implies({ bar: 'implied' })) .option('--bar'); program.p...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.nested.test.js
tests/command.nested.test.js
const commander = require('../'); test('when call nested subcommand then runs', () => { const program = new commander.Command(); const leafAction = jest.fn(); program.command('sub1').command('sub2').action(leafAction); program.parse('node test.js sub1 sub2'.split(' ')); expect(leafAction).toHaveBeenCalled();...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/negatives.test.js
tests/negatives.test.js
const { Command } = require('../'); // boolean is whether is a consumable argument when negative numbers allowed const negativeNumbers = [ ['-.1', true], ['-123', true], ['-123.45', true], ['-1e3', true], ['-1e+3', true], ['-1e-3', true], ['-1.2e3', true], ['-1.2e+3', true], ['-1.2e-3', true], ['-1...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.custom-processing.test.js
tests/options.custom-processing.test.js
const commander = require('../'); function myParseInt(value, dummyPrevious) { // parseInt takes a string and a radix return parseInt(value, 10); } function increaseVerbosity(dummyValue, previous) { return previous + 1; } function collect(value, previous) { return previous.concat([value]); } function commaSe...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.description.test.js
tests/command.description.test.js
const commander = require('../'); test('when set description then get description', () => { const program = new commander.Command(); const description = 'abcdef'; program.description(description); expect(program.description()).toMatch(description); });
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/program.test.js
tests/program.test.js
const { program, Command, Option, Argument, Help, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, createCommand, createOption, createArgument, } = require('../index.js'); // Do some testing of the default export(s). // Similar tests to ts-imports.test.ts and esm-imports-test.js....
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.visibleCommands.test.js
tests/help.visibleCommands.test.js
const commander = require('../'); // These are tests of the Help class, not of the Command help. // There is some overlap with the higher level Command tests (which predate Help). describe('visibleCommands', () => { test('when no subcommands then empty array', () => { const program = new commander.Command(); ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.allowUnknownOption.test.js
tests/command.allowUnknownOption.test.js
const commander = require('../'); // Not testing output, just testing whether an error is detected. describe('allowUnknownOption', () => { // Optional. Use internal knowledge to suppress output to keep test output clean. let writeErrorSpy; beforeAll(() => { writeErrorSpy = jest .spyOn(process.stderr,...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.conflicts.test.js
tests/options.conflicts.test.js
const path = require('path'); const commander = require('../'); describe('command with conflicting options', () => { function makeProgram() { const actionMock = jest.fn(); const program = new commander.Command(); program .exitOverride() .configureOutput({ writeErr: () => {}, w...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.values.test.js
tests/options.values.test.js
const commander = require('../'); // Test the ways values can be specified for options. // See also references on "Utility Conventions" in command.parseOptions.test.js // options with required values can eat values starting with a dash, including just dash sometimes used as alias for stdin // // option with required ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.env.test.js
tests/options.env.test.js
const commander = require('../'); // treating optional same as required, treat as option taking value rather than as boolean describe.each(['-f, --foo <required-arg>', '-f, --foo [optional-arg]'])( 'option declared as: %s', (fooFlags) => { test('when env undefined and no cli then option undefined', () => { ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.addHelpOption.test.js
tests/command.addHelpOption.test.js
const { Command, Option } = require('../'); // More complete tests are in command.helpOption.test.js. describe('addHelpOption', () => { let writeSpy; let writeErrorSpy; beforeAll(() => { // Optional. Suppress expected output to keep test output clean. writeSpy = jest.spyOn(process.stdout, 'write').mock...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.name.test.js
tests/command.name.test.js
const path = require('path'); const commander = require('../'); test('when construct with name then name is set', () => { const program = new commander.Command('foo'); expect(program.name()).toBe('foo'); }); test('when set program name and parse then name is as assigned', () => { const program = new commander.C...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.configureHelp.test.js
tests/command.configureHelp.test.js
const commander = require('../'); test('when configure program then affects program helpInformation', () => { const program = new commander.Command(); program.configureHelp({ formatHelp: () => { return 'custom'; }, }); expect(program.helpInformation()).toEqual('custom'); }); test('when configure...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.style.test.js
tests/help.style.test.js
const { Command } = require('../'); function red(str) { // Use plain characters so not stripped in Jest failure messages. (Means displayWidth is bogus though.) return `RED ${str} DER`; } function stripRed(str) { return str.replace(/RED /g, '').replace(/ DER/g, ''); } function displayWidth(str) { // Not really ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.alias.test.js
tests/command.alias.test.js
const commander = require('../'); // Running alias commands is tested in command.executableSubcommand.lookup.test.js // Test various other behaviours for .alias test('when command has alias then appears in help', () => { const program = new commander.Command(); program.command('info [thing]').alias('i'); const ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.onCommand.test.js
tests/command.onCommand.test.js
const commander = require('../'); // The action handler used to be implemented using command events and listeners. // Now, this is mostly just for backwards compatibility. describe(".command('*')", () => { test('when action handler for subcommand then emit command:subcommand', () => { const mockListener = jest....
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.boxWrap.test.js
tests/help.boxWrap.test.js
const commander = require('../'); test('when empty string then return empty string', () => { const helper = new commander.Help(); const text = ''; const wrapped = helper.boxWrap(text, 50); expect(wrapped).toEqual(text); }); test('when string contains unix line breaks then return (unix) empty lines', () => { ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/useColor.test.js
tests/useColor.test.js
const { useColor } = require('../lib/command.js'); describe('internal useColor environment variable support', () => { let holdNoColor = process.env.NO_COLOR; let holdForceColor = process.env.FORCE_COLOR; let holdCliColorForce = process.env.CLICOLOR_FORCE; beforeEach(() => { delete process.env.NO_COLOR; ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.visibleArguments.test.js
tests/help.visibleArguments.test.js
const commander = require('../'); // These are tests of the Help class, not of the Command help. // There is some overlap with the higher level Command tests (which predate Help). describe('visibleArguments', () => { test('when no arguments then empty array', () => { const program = new commander.Command(); ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.executableSubcommand.inspect.test.js
tests/command.executableSubcommand.inspect.test.js
const childProcess = require('child_process'); const path = require('path'); const util = require('util'); const execFileAsync = util.promisify(childProcess.execFile); // Test the special handling for --inspect to increment fixed debug port numbers. // If we reuse port we can get conflicts because port not released f...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/commander.configureCommand.test.js
tests/commander.configureCommand.test.js
const commander = require('../'); // Mostly testing direct on program, limited check that (sub)command working same. // Default behaviours test('when default then options not stored on command', () => { const program = new commander.Command(); program.option('--foo <value>', 'description'); program.parse(['nod...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.optionTerm.test.js
tests/help.optionTerm.test.js
const commander = require('../'); // These are tests of the Help class, not of the Command help. // There is some overlap with the higher level Command tests (which predate Help). describe('optionTerm', () => { test('when -s flags then returns flags', () => { const flags = '-s'; const option = new commander...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.executableSubcommand.test.js
tests/command.executableSubcommand.test.js
const commander = require('../'); // Executable subcommand tests that didn't fit in elsewhere. // This is the default behaviour when no default command and no action handlers test('when no command specified and executable then display help', () => { // Optional. Suppress normal output to keep test output clean. c...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.preformatted.test.js
tests/help.preformatted.test.js
const { Help, Command } = require('../'); describe('preformatted', () => { test('when single line then false', () => { const helper = new Help(); expect(helper.preformatted('a b c')).toBe(false); }); test('when single line with leading whitespace then false', () => { const helper = new Help(); e...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.visibleOptions.test.js
tests/help.visibleOptions.test.js
const commander = require('../'); // These are tests of the Help class, not of the Command help. // There is some overlap with the higher level Command tests (which predate Help). describe('visibleOptions', () => { test('when no options then just help visible', () => { const program = new commander.Command(); ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.option-misuse.test.js
tests/command.option-misuse.test.js
const { Command, Option } = require('../'); // It is a reasonable and easy mistake to pass Option to .option(). Detect this // and offer advice. const expectedMessage = 'To add an Option object use addOption() instead of option() or requiredOption()'; test('when pass Option to .option() then throw', () => { cons...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.visibleGlobalOptions.test.js
tests/help.visibleGlobalOptions.test.js
const commander = require('../'); test('when default configuration then return empty array', () => { const program = new commander.Command(); program.option('--global'); const sub = program.command('sub'); const helper = sub.createHelp(); expect(helper.visibleGlobalOptions(program)).toEqual([]); }); test('w...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.helpCommand.test.js
tests/command.helpCommand.test.js
const commander = require('../'); describe('help command listed in helpInformation', () => { test('when program has no subcommands then no automatic help command', () => { const program = new commander.Command(); const helpInformation = program.helpInformation(); expect(helpInformation).not.toMatch(/help...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.createHelp.test.js
tests/command.createHelp.test.js
const commander = require('../'); test('when override createCommand then affects help', () => { class MyHelp extends commander.Help { formatHelp(cmd, helper) { return 'custom'; } } class MyCommand extends commander.Command { createHelp() { return Object.assign(new MyHelp(), this.configur...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.bool.small.combined.test.js
tests/options.bool.small.combined.test.js
const commander = require('../'); test('when when multiple short flags specified then all values are true', () => { const program = new commander.Command(); program .option('-p, --pepper', 'add pepper') .option('-c, --cheese', 'add cheese'); program.parse(['node', 'test', '-pc']); expect(program.opts...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.action.test.js
tests/command.action.test.js
const commander = require('../'); // Test some behaviours of .action not covered in more specific tests. test('when .action called then command passed to action', () => { const actionMock = jest.fn(); const program = new commander.Command(); const cmd = program.command('info').action(actionMock); program.pars...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/option.chain.test.js
tests/option.chain.test.js
const { Option } = require('../'); describe('Option methods that should return this for chaining', () => { test('when call .default() then returns this', () => { const option = new Option('-e,--example <value>'); const result = option.default(3); expect(result).toBe(option); }); test('when call .arg...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/option.bad-flags.test.js
tests/option.bad-flags.test.js
const { Option } = require('../'); // Check that unsupported flags throw. test.each([ { flags: '-a, -b' }, // too many short flags { flags: '-a, -b <value>' }, { flags: '-a, -b, --long' }, { flags: '--one, --two, --three' }, // too many long flags { flags: '-ws' }, // short flag with more than one character ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.opts.test.js
tests/options.opts.test.js
const commander = require('../'); // Test the `.opts()` way of accessing option values. // Basic coverage of the main option types (leaving out negatable flags and options with optional values). test('when .version used with storeOptionsAsProperties() then version in opts', () => { const program = new commander.Com...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.preset.test.js
tests/options.preset.test.js
const { Command, Option } = require('../'); test('when boolean option with string preset used then value is preset', () => { const program = new Command(); program.addOption(new Option('-d, --debug').preset('foo')); program.parse(['-d'], { from: 'user' }); expect(program.opts().debug).toBe('foo'); }); test('w...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.default.test.js
tests/command.default.test.js
const childProcess = require('child_process'); const commander = require('../'); const path = require('path'); const util = require('util'); const execFileAsync = util.promisify(childProcess.execFile); describe('default executable command', () => { // Calling node explicitly so pm works without file suffix cross-pl...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/createCommand.test.js
tests/createCommand.test.js
const commander = require('../'); test('when createCommand then unattached', () => { const program = new commander.Command(); const cmd = program.createCommand(); expect(program.commands.length).toBe(0); expect(cmd.parent).toBeFalsy(); // (actually null, but use weaker test for unattached) }); test('when subc...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.createOption.test.js
tests/command.createOption.test.js
const commander = require('../'); class MyOption extends commander.Option { constructor(flags, description) { super(flags, description); this.myProperty = 'MyOption'; } } class MyCommand extends commander.Command { createOption(flags, description) { return new MyOption(flags, description); } } te...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.executableSubcommand.signals.test.js
tests/command.executableSubcommand.signals.test.js
const childProcess = require('child_process'); const path = require('path'); const pmPath = path.join(__dirname, 'fixtures', 'pm'); // Disabling some tests on Windows as: // "Windows does not support sending signals" // https://nodejs.org/api/process.html#process_signal_events const describeOrSkipOnWindows = proce...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.parseOptions.test.js
tests/command.parseOptions.test.js
const childProcess = require('child_process'); const commander = require('../'); const path = require('path'); const util = require('util'); const execFileAsync = util.promisify(childProcess.execFile); // Combination of parse and parseOptions tests which are more about details // than high level behaviours which are ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.error.test.js
tests/command.error.test.js
const commander = require('../'); test('when error called with message then message displayed on stderr', () => { const exitSpy = jest.spyOn(process, 'exit').mockImplementation(() => {}); const stderrSpy = jest .spyOn(process.stderr, 'write') .mockImplementation(() => {}); const program = new commander....
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.getset.test.js
tests/options.getset.test.js
const commander = require('../'); describe.each([true, false])( 'storeOptionsAsProperties is %s', (storeOptionsAsProperties) => { test('when option specified on CLI then value returned by getOptionValue', () => { const program = new commander.Command(); program .storeOptionsAsProperties(sto...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.configureOutput.test.js
tests/command.configureOutput.test.js
const commander = require('../'); const process = require('node:process'); test('when default writeErr() then error on stderr', () => { const writeSpy = jest .spyOn(process.stderr, 'write') .mockImplementation(() => {}); const program = new commander.Command(); program.exitOverride(); try { progra...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.chain.test.js
tests/command.chain.test.js
const { Command, Option, Argument } = require('../'); // Testing the functions which should chain. // parse and parseAsync are tested in command.parse.test.js describe('Command methods that should return this for chaining', () => { test('when call .command() with description for stand-alone executable then returns ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.showGlobalOptions.test.js
tests/help.showGlobalOptions.test.js
const commander = require('../'); test('when default configuration then global options hidden', () => { const program = new commander.Command(); program.option('--global'); const sub = program.command('sub'); expect(sub.helpInformation()).not.toContain('global'); }); test('when showGlobalOptions:true then pro...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/argument.choices.test.js
tests/argument.choices.test.js
const commander = require('../'); test('when command argument in choices then argument set', () => { const program = new commander.Command(); let shade; program .exitOverride() .addArgument(new commander.Argument('<shade>').choices(['red', 'blue'])) .action((shadeParam) => { shade = shadeParam;...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.hook.test.js
tests/command.hook.test.js
const commander = require('../'); test('when hook event wrong then throw', () => { const program = new commander.Command(); expect(() => { program.hook('silly', () => {}); }).toThrow(); }); test('when no action then action hooks not called', () => { const hook = jest.fn(); const program = new commander....
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.bool.test.js
tests/options.bool.test.js
const commander = require('../'); // Test simple flag and negatable flag // boolean flag on program describe('boolean flag on program', () => { test('when boolean flag not specified then value is undefined', () => { const program = new commander.Command(); program.option('--pepper', 'add pepper'); progr...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/argument.variadic.test.js
tests/argument.variadic.test.js
const commander = require('../'); // Testing variadic arguments. Testing all the action arguments, but could test just variadicArg. describe('variadic argument', () => { test('when no extra arguments specified for program then variadic arg is empty array', () => { const actionMock = jest.fn(); const program...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.camelcase.test.js
tests/options.camelcase.test.js
const commander = require('../'); // Capitalise the letters of words after dashes, but otherwise preserve case test('when option defined with --word-word then option property is wordWord', () => { const program = new commander.Command(); program.option('--my-option', 'description'); program.parse(['node', 'test...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.twice.test.js
tests/options.twice.test.js
const { Command, Option } = require('../'); // Test that when option specified twice, second use wins. // Seems pretty obvious for boolean options, but there was a bug before Commander v9. test('when boolean option used twice then value is true', () => { const program = new Command(); program.option('-d, --debug'...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/args.literal.test.js
tests/args.literal.test.js
const commander = require('../'); // Utility Conventions: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 // // 12.2 Utility Syntax Guidelines, Guideline 10: // The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any fo...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.sortCommands.test.js
tests/help.sortCommands.test.js
const commander = require('../'); // These are tests of the Help class, not of the Command help. // There is some overlap with the higher level Command tests (which predate Help). describe('sortSubcommands', () => { test('when unsorted then commands in order added', () => { const program = new commander.Command...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.commandUsage.test.js
tests/help.commandUsage.test.js
const commander = require('../'); // These are tests of the Help class, not of the Command help. // There is some overlap with the higher level Command tests (which predate Help). describe('commandUsage', () => { test('when single program then "program [options]"', () => { const program = new commander.Command(...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.parse.test.js
tests/command.parse.test.js
const commander = require('../'); // Testing some Electron conventions but not directly using Electron to avoid overheads. // https://github.com/electron/electron/issues/4690#issuecomment-217435222 // https://www.electronjs.org/docs/api/process#processdefaultapp-readonly // (If mutating process.argv and process.execA...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.version.test.js
tests/options.version.test.js
const commander = require('../'); // Test .version. Using exitOverride to check behaviour (instead of mocking process.exit). describe('.version', () => { test('when no .version and specify --version then unknown option error', () => { const errorMessage = 'unknownOption'; const program = new commander.Comma...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.subcommandDescription.test.js
tests/help.subcommandDescription.test.js
const commander = require('../'); // These are tests of the Help class, not of the Command help. // There is some overlap with the higher level Command tests (which predate Help). describe('subcommandDescription', () => { test('when program has no summary or description then empty string', () => { const program...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.optsWithGlobals.test.js
tests/options.optsWithGlobals.test.js
const commander = require('../'); // Testing optsWithGlobals and getOptionValueSourceWithGlobals with focus on globals. describe('optsWithGlobals', () => { test('when variety of options used with program then opts is same as optsWithGlobals', () => { const program = new commander.Command(); program .o...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.asterisk.test.js
tests/command.asterisk.test.js
const commander = require('../'); // .command('*') is the old main/default command handler. It adds a listener // for 'command:*'. It has been somewhat replaced by the program action handler, // so most uses are probably old code. Current plan is keep the code backwards compatible // and put work in elsewhere for new ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.minWidthToWrap.test.js
tests/help.minWidthToWrap.test.js
const commander = require('../'); describe('Help.minWidthToWrap', () => { test('when enough width then wrap', () => { const program = new commander.Command('program'); program.description('x '.repeat(110)); program.configureOutput({ getOutHelpWidth: () => 100, // lots of room to wrap }); co...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/help.stripAnsi.test.js
tests/help.stripAnsi.test.js
const { stripColor } = require('../lib/help'); // https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters // Test the lowest level routine being used for SGR support. const ESC = '\u001b'; const CSI = ESC + '['; test('SGR only', () => { const str = `${CSI}4m`; expect(stripColor(...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.executableSubcommand.mock.test.js
tests/command.executableSubcommand.mock.test.js
const commander = require('../'); const childProcess = require('child_process'); const EventEmitter = require('events'); // Using mock to allow try/catch around what is otherwise out-of-stack error handling. // Injecting errors, these are not end-to-end tests. function makeSystemError(code) { // We can not make an ...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/helpGroup.test.js
tests/helpGroup.test.js
const { Command, Option } = require('../'); // Similar tests for Option.helpGroup() and Command.helpGroup(), // and for Command.optionsGroup() and Command.commandsGroup(). describe('Option.helpGroup', () => { test('when add one option with helpGroup then help contains group', () => { const program = new Command...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/options.dual-options.test.js
tests/options.dual-options.test.js
const { Option, DualOptions } = require('../lib/option.js'); const { Command } = require('../'); // This tests an internal helper class which is not currently exposed on the package. test('when positive option then stored in positiveOptions', () => { const program = new Command(); program.option('--one'); const...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false
tj/commander.js
https://github.com/tj/commander.js/blob/0692be58103e1ea8052d5d45ab11cc02e197eea5/tests/command.positionalOptions.test.js
tests/command.positionalOptions.test.js
const commander = require('../'); // The changes to parsing for positional options are subtle, and took extra care to work with // implicit help and default commands. Lots of tests. describe('program with passThrough', () => { function makeProgram() { const program = new commander.Command(); program.passThr...
javascript
MIT
0692be58103e1ea8052d5d45ab11cc02e197eea5
2026-01-04T15:02:25.844440Z
false