I have the following test command in package.json:
"test": "node --test --enable-source-maps --loader ts-node/esm lib/**/*.test.ts && node --test index.test.js"
It runs locally, but on CI it fails:
yarn run v1.22.21
$ node --test --enable-source-maps --loader ts-node/esm lib/**/*.test.ts && node --test index.test.js
Could not find '/home/runner/work/assert-raisins/assert-raisins/lib/**/*.test.ts'
It looks like ** isn't being expanded. I tried to insert shopt -s globstar just about anywhere, but to no avail.
Full workflow YAML:
name: Node.js CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
cache: 'npm'
- run: yarn
- name: Run tests
run: yarn test
NPM scripts use
shfrom yourPATHby default. On some systems (like macOS), this "sh" is actually justbashin disguise, but that does not appear to be the case in the Github Action Runner.shdoes not support globstar, unlikebash, so you'll need to change which shell NPM wants to use. This can be done by adding a.npmrcfile to your project, and setting thescript-shelloption tobash.