@@ -65,6 +65,42 @@ describe("packageJSONIntegrityHash", () => {
6565 }
6666 } ) ;
6767
68+ test ( "Given a script with an instance of 'node_modules/.bin/'" , ( ) => {
69+ for ( const arg of [ undefined , { isFromRemoteRegistry : true } ] ) {
70+ const { object } = packageJSONIntegrityHash ( {
71+ ...kMinimalPackageJSON ,
72+ scripts : {
73+ test : "node_modules/.bin/istanbul cover ./node_modules/tape/bin/tape ./test/integration/*.js"
74+ }
75+ } , arg ) ;
76+
77+ assert . strictEqual (
78+ object . scripts . test ,
79+ "istanbul cover ./node_modules/tape/bin/tape ./test/integration/*.js"
80+ ) ;
81+ }
82+ } ) ;
83+
84+ test ( "tarball script 'node_modules/.bin/x' and registry script 'x' should produce the same integrity" , ( ) => {
85+ const tarball = packageJSONIntegrityHash ( {
86+ ...kMinimalPackageJSON ,
87+ scripts : {
88+ test : "node_modules/.bin/mocha --reporter spec" ,
89+ pegjs : "node_modules/.bin/pegjs lib/parser/pbxproj.pegjs"
90+ }
91+ } ) ;
92+
93+ const registry = packageJSONIntegrityHash ( {
94+ ...kMinimalPackageJSON ,
95+ scripts : {
96+ test : "mocha --reporter spec" ,
97+ pegjs : "pegjs lib/parser/pbxproj.pegjs"
98+ }
99+ } ) ;
100+
101+ assert . strictEqual ( tarball . integrity , registry . integrity ) ;
102+ } ) ;
103+
68104 test ( "should include optional dependencies in the hash when there is some" , ( ) => {
69105 const packageJSONWithOptionalDeps = {
70106 ...kMinimalPackageJSON ,
0 commit comments