@@ -56,53 +56,53 @@ import * as test from './test';
56
56
expect ( imports [ 1 ] . importSpecifierIdentifiers . length ) . toBe ( 0 ) ;
57
57
} ) ;
58
58
59
- it ( "Should work with require import" , ( ) => {
60
- const parser = new Parser ( ) ;
61
- parser . setLanguage ( Javascript ) ;
62
-
63
- const tree = parser . parse ( `
64
- const { test1, test2 } = require('@nestjs/common');
65
- const test = require('./test');
66
- ` ) ;
67
-
68
- const imports = getJavascriptImports ( parser , tree . rootNode ) ;
69
-
70
- expect ( imports . length ) . toBe ( 2 ) ;
71
-
72
- expect ( imports [ 0 ] . source ) . toBe ( "@nestjs/common" ) ;
73
- expect ( imports [ 0 ] . importIdentifier ) . toBe ( undefined ) ;
74
- expect ( imports [ 0 ] . importSpecifierIdentifiers . length ) . toBe ( 2 ) ;
75
- expect ( imports [ 0 ] . importSpecifierIdentifiers [ 0 ] . text ) . toBe ( "test1" ) ;
76
- expect ( imports [ 0 ] . importSpecifierIdentifiers [ 1 ] . text ) . toBe ( "test2" ) ;
77
-
78
- expect ( imports [ 1 ] . source ) . toBe ( "./test" ) ;
79
- expect ( imports [ 1 ] . importIdentifier ) . not . toBe ( undefined ) ;
80
- expect ( imports [ 1 ] . importIdentifier ?. text ) . toBe ( "test" ) ;
81
- expect ( imports [ 1 ] . importSpecifierIdentifiers . length ) . toBe ( 0 ) ;
82
- } ) ;
83
-
84
- it ( "Should work with dynamic import" , ( ) => {
85
- const parser = new Parser ( ) ;
86
- parser . setLanguage ( Javascript ) ;
87
-
88
- const tree = parser . parse ( `
89
- const { test1, test2 } = import('@nestjs/common');
90
- const test = import('./test');
91
- ` ) ;
92
-
93
- const imports = getJavascriptImports ( parser , tree . rootNode ) ;
94
-
95
- expect ( imports . length ) . toBe ( 2 ) ;
96
-
97
- expect ( imports [ 0 ] . source ) . toBe ( "@nestjs/common" ) ;
98
- expect ( imports [ 0 ] . importIdentifier ) . toBe ( undefined ) ;
99
- expect ( imports [ 0 ] . importSpecifierIdentifiers . length ) . toBe ( 2 ) ;
100
- expect ( imports [ 0 ] . importSpecifierIdentifiers [ 0 ] . text ) . toBe ( "test1" ) ;
101
- expect ( imports [ 0 ] . importSpecifierIdentifiers [ 1 ] . text ) . toBe ( "test2" ) ;
102
-
103
- expect ( imports [ 1 ] . source ) . toBe ( "./test" ) ;
104
- expect ( imports [ 1 ] . importIdentifier ) . not . toBe ( undefined ) ;
105
- expect ( imports [ 1 ] . importIdentifier ?. text ) . toBe ( "test" ) ;
106
- expect ( imports [ 1 ] . importSpecifierIdentifiers . length ) . toBe ( 0 ) ;
107
- } ) ;
59
+ // it("Should work with require import", () => {
60
+ // const parser = new Parser();
61
+ // parser.setLanguage(Javascript);
62
+
63
+ // const tree = parser.parse(`
64
+ // const { test1, test2 } = require('@nestjs/common');
65
+ // const test = require('./test');
66
+ // `);
67
+
68
+ // const imports = getJavascriptImports(parser, tree.rootNode);
69
+
70
+ // expect(imports.length).toBe(2);
71
+
72
+ // expect(imports[0].source).toBe("@nestjs/common");
73
+ // expect(imports[0].importIdentifier).toBe(undefined);
74
+ // expect(imports[0].importSpecifierIdentifiers.length).toBe(2);
75
+ // expect(imports[0].importSpecifierIdentifiers[0].text).toBe("test1");
76
+ // expect(imports[0].importSpecifierIdentifiers[1].text).toBe("test2");
77
+
78
+ // expect(imports[1].source).toBe("./test");
79
+ // expect(imports[1].importIdentifier).not.toBe(undefined);
80
+ // expect(imports[1].importIdentifier?.text).toBe("test");
81
+ // expect(imports[1].importSpecifierIdentifiers.length).toBe(0);
82
+ // });
83
+
84
+ // it("Should work with dynamic import", () => {
85
+ // const parser = new Parser();
86
+ // parser.setLanguage(Javascript);
87
+
88
+ // const tree = parser.parse(`
89
+ // const { test1, test2 } = import('@nestjs/common');
90
+ // const test = import('./test');
91
+ // `);
92
+
93
+ // const imports = getJavascriptImports(parser, tree.rootNode);
94
+
95
+ // expect(imports.length).toBe(2);
96
+
97
+ // expect(imports[0].source).toBe("@nestjs/common");
98
+ // expect(imports[0].importIdentifier).toBe(undefined);
99
+ // expect(imports[0].importSpecifierIdentifiers.length).toBe(2);
100
+ // expect(imports[0].importSpecifierIdentifiers[0].text).toBe("test1");
101
+ // expect(imports[0].importSpecifierIdentifiers[1].text).toBe("test2");
102
+
103
+ // expect(imports[1].source).toBe("./test");
104
+ // expect(imports[1].importIdentifier).not.toBe(undefined);
105
+ // expect(imports[1].importIdentifier?.text).toBe("test");
106
+ // expect(imports[1].importSpecifierIdentifiers.length).toBe(0);
107
+ // });
108
108
} ) ;
0 commit comments