Skip to content

Commit

Permalink
build: always use boilerplate test file
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Oct 11, 2023
1 parent 010da21 commit 143818d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
21 changes: 2 additions & 19 deletions lib/node_modules/@stdlib/_tools/scripts/publish_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -1101,26 +1101,9 @@ function publish( pkg, clbk ) {
try {
command = 'mkdir -p test/dist';
shell( command, opts );
try {
shell( 'grep -rq proxyquire test/test.js', opts );

// Case: `proxyquire` usage in test file so we copy a boilerplate test file:
fs.copyFileSync( join( __dirname, 'templates', 'test_dist_test.js.txt' ), join( dist, 'test', 'dist', 'test.js' ) );
} catch ( error ) {
debug( 'Error: %s', error.message );

// Case: no `proxyquire` usage in test file so we can reuse the original test file:
command = 'cp test/test.js test/dist';
shell( command, opts );
command = 'sed -i "s/\'\\.\\/\\.\\.\\/lib\'/\'.\\/..\\/dist\'/g" test/dist/test.js';
shell( command, opts );
command = 'sed -i "s/require( \'.\\/\\.\\./require( \'.\\/..\\/../g" test/dist/test.js';
shell( command, opts );
command = 'sed -i "s/\'\\.\\/fixtures/\'.\\/..\\/fixtures/g" test/dist/test.js';
shell( command, opts );
}
fs.copyFileSync( join( __dirname, 'templates', 'test_dist_test.js.txt' ), join( dist, 'test', 'dist', 'test.js' ) );
} catch ( error ) {
debug( 'Encountered an error when attempting to copy test file(s) to `dist`: %s', error.message );
debug( 'Encountered an error when attempting to copy a boilerplate test file to `dist`: %s', error.message );
}

if ( flags[ 'skip-upload' ] ) {
Expand Down
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/_tools/scripts/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ function transformer( fileInfo, api ) {

root
.find( j.VariableDeclarator )
.filter( path => {
.filter( function onPath( path ) {

Check failure on line 94 in lib/node_modules/@stdlib/_tools/scripts/transform.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Using 'FunctionExpression' is not allowed
var node = path.node;
return node.init &&
node.init.type === 'CallExpression' &&
node.init.callee.name === 'require' &&
node.init.arguments[0].value === '@stdlib/string-format';
})
.forEach(path => {
formatVar = path.node.id.name;
.forEach( function onPath() {

Check failure on line 101 in lib/node_modules/@stdlib/_tools/scripts/transform.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Using 'FunctionExpression' is not allowed
formatVar = path.node.id.name;

Check failure on line 102 in lib/node_modules/@stdlib/_tools/scripts/transform.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

'path' is not defined
});

requires = root.find( j.CallExpression, {
Expand Down

0 comments on commit 143818d

Please sign in to comment.