@@ -7,7 +7,8 @@ const fs = require('fs');
77const path = require ( 'path' ) ;
88const rewire = require ( 'rewire' ) ;
99const sinon = require ( 'sinon' ) ;
10- const ast = require ( './fixtures/exampleAST' ) ;
10+ const ast = require ( './fixtures/exampleAST.js' ) ;
11+
1112const precinct = rewire ( '../index.js' ) ;
1213
1314function read ( filename ) {
@@ -163,7 +164,7 @@ describe('node-precinct', () => {
163164
164165 describe ( 'paperwork' , ( ) => {
165166 it ( 'grabs dependencies of jsx files' , ( ) => {
166- const result = precinct . paperwork ( ` ${ __dirname } /fixtures/module.jsx` ) ;
167+ const result = precinct . paperwork ( path . join ( __dirname , ' /fixtures/module.jsx' ) ) ;
167168 const expected = [ './es6NoImport' ] ;
168169
169170 assert . deepEqual ( result , expected ) ;
@@ -186,10 +187,10 @@ describe('node-precinct', () => {
186187 } ) ;
187188
188189 it ( 'returns the dependencies for the given filepath' , ( ) => {
189- assert . notEqual ( precinct . paperwork ( ` ${ __dirname } /fixtures/es6.js` ) . length , 0 ) ;
190- assert . notEqual ( precinct . paperwork ( ` ${ __dirname } /fixtures/styles.scss` ) . length , 0 ) ;
191- assert . notEqual ( precinct . paperwork ( ` ${ __dirname } /fixtures/typescript.ts` ) . length , 0 ) ;
192- assert . notEqual ( precinct . paperwork ( ` ${ __dirname } /fixtures/styles.css` ) . length , 0 ) ;
190+ assert . notEqual ( precinct . paperwork ( path . join ( __dirname , ' /fixtures/es6.js' ) ) . length , 0 ) ;
191+ assert . notEqual ( precinct . paperwork ( path . join ( __dirname , ' /fixtures/styles.scss' ) ) . length , 0 ) ;
192+ assert . notEqual ( precinct . paperwork ( path . join ( __dirname , ' /fixtures/typescript.ts' ) ) . length , 0 ) ;
193+ assert . notEqual ( precinct . paperwork ( path . join ( __dirname , ' /fixtures/styles.css' ) ) . length , 0 ) ;
193194 } ) ;
194195
195196 it ( 'throws if the file cannot be found' , ( ) => {
@@ -199,21 +200,21 @@ describe('node-precinct', () => {
199200 } ) ;
200201
201202 it ( 'filters out core modules if options.includeCore is false' , ( ) => {
202- const deps = precinct . paperwork ( ` ${ __dirname } /fixtures/coreModules.js` , {
203+ const deps = precinct . paperwork ( path . join ( __dirname , ' /fixtures/coreModules.js' ) , {
203204 includeCore : false
204205 } ) ;
205206
206207 assert . equal ( deps . length , 0 ) ;
207208 } ) ;
208209
209210 it ( 'handles cjs files as commonjs' , ( ) => {
210- const deps = precinct . paperwork ( ` ${ __dirname } /fixtures/commonjs.cjs` ) ;
211+ const deps = precinct . paperwork ( path . join ( __dirname , ' /fixtures/commonjs.cjs' ) ) ;
211212 assert . equal ( deps . includes ( './a' ) , true ) ;
212213 assert . equal ( deps . includes ( './b' ) , true ) ;
213214 } ) ;
214215
215216 it ( 'does not filter out core modules by default' , ( ) => {
216- const deps = precinct . paperwork ( ` ${ __dirname } /fixtures/coreModules.js` ) ;
217+ const deps = precinct . paperwork ( path . join ( __dirname , ' /fixtures/coreModules.js' ) ) ;
217218 assert . notEqual ( deps . length , 0 ) ;
218219 } ) ;
219220
@@ -226,7 +227,7 @@ describe('node-precinct', () => {
226227 }
227228 } ;
228229
229- precinct . paperwork ( ` ${ __dirname } /fixtures/amd.js` , {
230+ precinct . paperwork ( path . join ( __dirname , ' /fixtures/amd.js' ) , {
230231 includeCore : false ,
231232 amd : config . amd
232233 } ) ;
@@ -240,7 +241,7 @@ describe('node-precinct', () => {
240241 const stub = sinon . stub ( ) . returns ( [ ] ) ;
241242 const revert = precinct . __set__ ( 'precinct' , stub ) ;
242243
243- precinct . paperwork ( ` ${ __dirname } /fixtures/amd.js` , {
244+ precinct . paperwork ( path . join ( __dirname , ' /fixtures/amd.js' ) , {
244245 amd : {
245246 skipLazyLoaded : true
246247 }
@@ -349,12 +350,12 @@ describe('node-precinct', () => {
349350 assert . deepEqual ( deps , [ 'streams' ] ) ;
350351 } ) ;
351352
352- it ( " understands quirks around some modules only being addressable via node: prefix" , ( ) => {
353+ it ( ' understands quirks around some modules only being addressable via node: prefix' , ( ) => {
353354 const deps = precinct . paperwork ( path . join ( __dirname , 'fixtures' , 'requiretest.js' ) , {
354355 includeCore : false
355356 } ) ;
356357 assert . deepEqual ( deps , [ 'test' ] ) ;
357- } )
358+ } ) ;
358359 } ) ;
359360
360361 describe ( 'that uses dynamic imports' , ( ) => {
0 commit comments