@@ -40,9 +40,11 @@ def nodesource_unsupported(nodejs_version)
4040
4141 include_examples 'cleanup'
4242
43+ # Debian 12 contains NodeJS 18, when we test 16 and 18, we need to force the nodesource version
44+ # as Debians versions *can* be newer
4345 repo_priority =
44- if fact ( 'os.family' ) == 'Debian'
45- '990 '
46+ if %w[ 16 18 20 ] . include? ( nodejs_version ) && fact ( 'os.family' ) == 'Debian' && %w[ 12 13 ] . include? ( fact ( 'os.release.major' ) )
47+ '1000 '
4648 else
4749 'undef'
4850 end
@@ -187,10 +189,7 @@ class { 'nodejs':
187189 it_behaves_like 'an idempotent resource' do
188190 let ( :manifest ) do
189191 <<-PUPPET
190- class { 'nodejs':
191- nodejs_dev_package_ensure => installed,
192- npm_package_ensure => installed,
193- }
192+ class { 'nodejs': }
194193 nodejs::npm::global_config_entry { '//path.to.registry/:_authToken':
195194 ensure => present,
196195 value => 'cGFzc3dvcmQ=',
@@ -202,7 +201,7 @@ class { 'nodejs':
202201
203202 describe 'npm config' do
204203 it 'contains the global_config_entry secret' do
205- npm_output = shell ( 'cat $(/usr/bin/npm config get globalconfig)' )
204+ npm_output = shell ( 'CONF= $(/usr/bin/npm config get globalconfig); echo "$(<$CONF)" ' )
206205 expect ( npm_output . stdout ) . to match '//path.to.registry/:_authToken="cGFzc3dvcmQ="'
207206 end
208207 end
@@ -216,10 +215,7 @@ class { 'nodejs':
216215 it_behaves_like 'an idempotent resource' do
217216 let ( :manifest ) do
218217 <<-PUPPET
219- class { 'nodejs':
220- nodejs_dev_package_ensure => installed,
221- npm_package_ensure => installed,
222- }
218+ class { 'nodejs': }
223219 nodejs::npm::global_config_entry { '//path.to.registry/:_authToken':
224220 ensure => present,
225221 value => 'cGFzc3dvcmQ',
@@ -231,8 +227,8 @@ class { 'nodejs':
231227
232228 describe 'npm config' do
233229 it 'contains the global_config_entry secret' do
234- npm_output = shell ( 'cat $(/usr/bin/npm config get globalconfig)' )
235- expect ( npm_output . stdout ) . to match '//path.to.registry/:_authToken=cGFzc3dvcmQ'
230+ npm_output = shell ( 'CONF= $(/usr/bin/npm config get globalconfig); echo "$(<$CONF)" ' )
231+ expect ( npm_output . stdout ) . to match 'x //path.to.registry/:_authToken=cGFzc3dvcmQ'
236232 end
237233 end
238234 end
0 commit comments