Registry / testing / test-match

test-match

JSON →
library1.2.1jsnpmunverified

A small utility for testing string matches against include and exclude patterns, using the current working directory for path resolution. Version 1.2.1 is current. No regular releases. Key differentiator: minimal API for matching against file/directory patterns with cwd support. Ships TypeScript types.

npm install test-match
INSTALL
IMPORT
SIG · TEST-MATCH
T
test-match
testingjavascriptv1.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

match
✓ import match from 'test-match'
✗ import { match } from 'test-match'
Default export only; named import will fail.
match
✓ const match = require('test-match')
✗ const { match } = require('test-match')
CommonJS require returns the default export directly.
match
✓ import match from 'test-match'
✗ const match = require('test-match').default
No .default needed in CommonJS; it's the direct result.

Show basic usage: create a matcher with include/exclude patterns and test strings.

import match from 'test-match'; const test = match({ include: 'react-*', exclude: 'react-native-*' }); console.log(test('react-dom')); // true console.log(test('react-native-aria')); // false
Debug
Known issues
breakingThis package has no known breaking changes in version 1.x.
fix
N/A
affects: 1.0.0 - 1.2.1
gotchaCommonJS require returns the default export directly, not an object with `default` property.
fix
Use `const match = require('test-match')`
affects: *
gotchaPatterns use minimatch syntax, not regex.
fix
Refer to minimatch documentation for valid glob patterns.
affects: *
Errors
Common errors & fixes
TypeError: test.match is not a function
Using named import instead of default import.
fix
Change `import { match } from 'test-match'` to `import match from 'test-match'`
Error: Cannot find module 'test-match'
Package not installed or wrong version.
fix
Run `npm install test-match@1.2.1`
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
test-match — npm install test-match · libregistry