File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * @file Unit Tests - MODULES_REGEX
3+ * @module estree-util-unassert/utils/tests/unit/MODULES_REGEX
4+ */
5+
6+ import TEST_SUBJECT from '../modules-regex'
7+
8+ describe ( 'unit:utils/MODULES_REGEX' , ( ) => {
9+ beforeEach ( ( ) => {
10+ TEST_SUBJECT . lastIndex = 0
11+ } )
12+
13+ it ( 'should match "assert"' , ( ) => {
14+ expect ( TEST_SUBJECT . test ( 'assert' ) ) . to . be . true
15+ } )
16+
17+ it ( 'should match "devlop"' , ( ) => {
18+ expect ( TEST_SUBJECT . test ( 'devlop' ) ) . to . be . true
19+ } )
20+
21+ it ( 'should match "node:assert"' , ( ) => {
22+ expect ( TEST_SUBJECT . test ( 'node:assert' ) ) . to . be . true
23+ } )
24+
25+ it ( 'should match "node:assert/strict"' , ( ) => {
26+ expect ( TEST_SUBJECT . test ( 'node:assert/strict' ) ) . to . be . true
27+ } )
28+
29+ it ( 'should match "power-assert"' , ( ) => {
30+ expect ( TEST_SUBJECT . test ( 'power-assert' ) ) . to . be . true
31+ } )
32+
33+ it ( 'should match "uvu/assert"' , ( ) => {
34+ expect ( TEST_SUBJECT . test ( 'uvu/assert' ) ) . to . be . true
35+ } )
36+ } )
Original file line number Diff line number Diff line change 1+ /**
2+ * @file Entry Point - Utilities
3+ * @module estree-util-unassert/utils
4+ */
5+
6+ export { default as MODULES_REGEX } from './modules-regex'
Original file line number Diff line number Diff line change 1+ /**
2+ * @file Utilities - MODULES_REGEX
3+ * @module estree-util-unassert/utils/MODULES_REGEX
4+ */
5+
6+ /**
7+ * Default regular expression used to match assertion module ids.
8+ *
9+ * @const {RegExp} MODULES_REGEX
10+ */
11+ const MODULES_REGEX : RegExp =
12+ / ^ (?: (?: (?: p o w e r - ) | (?: u v u \/ ) ) ? a s s e r t | d e v l o p | (?: n o d e : ) ? a s s e r t (?: \/ s t r i c t ) ? ) $ /
13+
14+ export default MODULES_REGEX
You can’t perform that action at this time.
0 commit comments