6
6
*/
7
7
8
8
import { extractor } from '../dependencyExtractor' ;
9
- import isRegExpSupported from '../isRegExpSupported' ;
10
-
11
- const COMMENT_NO_NEG_LB = isRegExpSupported ( '(?<!\\.\\s*)' ) ? '' : '//' ;
12
9
13
10
describe ( 'dependencyExtractor' , ( ) => {
14
11
it ( 'should not extract dependencies inside comments' , ( ) => {
@@ -65,8 +62,8 @@ describe('dependencyExtractor', () => {
65
62
}, depDefault from 'dep4';
66
63
67
64
// Bad
68
- ${ COMMENT_NO_NEG_LB } foo . import ('inv1');
69
- ${ COMMENT_NO_NEG_LB } foo . export ('inv2');
65
+ foo . import ('inv1');
66
+ foo . export ('inv2');
70
67
` ;
71
68
expect ( extractor . extract ( code ) ) . toEqual (
72
69
new Set ( [ 'dep1' , 'dep2' , 'dep3' , 'dep4' ] ) ,
@@ -114,8 +111,8 @@ describe('dependencyExtractor', () => {
114
111
}, depDefault from 'dep4';
115
112
116
113
// Bad
117
- ${ COMMENT_NO_NEG_LB } foo . export ('inv1');
118
- ${ COMMENT_NO_NEG_LB } foo . export ('inv2');
114
+ foo . export ('inv1');
115
+ foo . export ('inv2');
119
116
` ;
120
117
expect ( extractor . extract ( code ) ) . toEqual (
121
118
new Set ( [ 'dep1' , 'dep2' , 'dep3' , 'dep4' ] ) ,
@@ -137,8 +134,8 @@ describe('dependencyExtractor', () => {
137
134
}, depDefault from 'dep4';
138
135
139
136
// Bad
140
- ${ COMMENT_NO_NEG_LB } foo . export ('inv1');
141
- ${ COMMENT_NO_NEG_LB } foo . export ('inv2');
137
+ foo . export ('inv1');
138
+ foo . export ('inv2');
142
139
` ;
143
140
expect ( extractor . extract ( code ) ) . toEqual (
144
141
new Set ( [ 'dep1' , 'dep2' , 'dep3' , 'dep4' ] ) ,
@@ -164,7 +161,7 @@ describe('dependencyExtractor', () => {
164
161
if (await import(\`dep3\`)) {}
165
162
166
163
// Bad
167
- ${ COMMENT_NO_NEG_LB } await foo . import('inv1')
164
+ await foo . import('inv1')
168
165
await ximport('inv2');
169
166
importx('inv3');
170
167
import('inv4', 'inv5');
@@ -182,7 +179,7 @@ describe('dependencyExtractor', () => {
182
179
if (require(\`dep3\`).cond) {}
183
180
184
181
// Bad
185
- ${ COMMENT_NO_NEG_LB } foo . require('inv1')
182
+ foo . require('inv1')
186
183
xrequire('inv2');
187
184
requirex('inv3');
188
185
require('inv4', 'inv5');
@@ -202,7 +199,7 @@ describe('dependencyExtractor', () => {
202
199
.requireActual('dep4');
203
200
204
201
// Bad
205
- ${ COMMENT_NO_NEG_LB } foo . jest.requireActual('inv1')
202
+ foo . jest.requireActual('inv1')
206
203
xjest.requireActual('inv2');
207
204
jest.requireActualx('inv3');
208
205
jest.requireActual('inv4', 'inv5');
@@ -224,7 +221,7 @@ describe('dependencyExtractor', () => {
224
221
.requireMock('dep4');
225
222
226
223
// Bad
227
- ${ COMMENT_NO_NEG_LB } foo . jest.requireMock('inv1')
224
+ foo . jest.requireMock('inv1')
228
225
xjest.requireMock('inv2');
229
226
jest.requireMockx('inv3');
230
227
jest.requireMock('inv4', 'inv5');
@@ -246,7 +243,7 @@ describe('dependencyExtractor', () => {
246
243
.requireMock('dep4');
247
244
248
245
// Bad
249
- ${ COMMENT_NO_NEG_LB } foo . jest.genMockFromModule('inv1')
246
+ foo . jest.genMockFromModule('inv1')
250
247
xjest.genMockFromModule('inv2');
251
248
jest.genMockFromModulex('inv3');
252
249
jest.genMockFromModule('inv4', 'inv5');
@@ -268,7 +265,7 @@ describe('dependencyExtractor', () => {
268
265
.requireMock('dep4');
269
266
270
267
// Bad
271
- ${ COMMENT_NO_NEG_LB } foo . jest.createMockFromModule('inv1')
268
+ foo . jest.createMockFromModule('inv1')
272
269
xjest.createMockFromModule('inv2');
273
270
jest.createMockFromModulex('inv3');
274
271
jest.createMockFromModule('inv4', 'inv5');
0 commit comments