generated from MatrixAI/TypeScript-Demo-Lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
npm test
now needs windows support for NODE_OPTIONS
- Loading branch information
1 parent
5d14578
commit b060681
Showing
2 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env node | ||
|
||
import os from 'node:os'; | ||
import path from 'node:path'; | ||
import url from 'node:url'; | ||
import process from 'node:process'; | ||
import childProcess from 'node:child_process'; | ||
|
||
const projectPath = path.dirname( | ||
path.dirname(url.fileURLToPath(import.meta.url)), | ||
); | ||
|
||
const platform = os.platform(); | ||
|
||
/* eslint-disable no-console */ | ||
async function main() { | ||
const tscArgs = [`-p`, path.join(projectPath, 'tsconfig.build.json')]; | ||
console.error('Running tsc:'); | ||
console.error(['tsc', ...tscArgs].join(' ')); | ||
childProcess.execFileSync('tsc', tscArgs, { | ||
stdio: ['inherit', 'inherit', 'inherit'], | ||
windowsHide: true, | ||
encoding: 'utf-8', | ||
shell: platform === 'win32' ? true : false, | ||
}); | ||
const jestArgs = []; | ||
console.error('Running jest:'); | ||
console.error(['jest', ...jestArgs].join(' ')); | ||
childProcess.execFileSync('jest', jestArgs, { | ||
env: { | ||
...process.env, | ||
NODE_OPTIONS: '--experimental-vm-modules', | ||
}, | ||
stdio: ['inherit', 'inherit', 'inherit'], | ||
windowsHide: true, | ||
encoding: 'utf-8', | ||
shell: platform === 'win32' ? true : false, | ||
}); | ||
} | ||
/* eslint-enable no-console */ | ||
|
||
if (import.meta.url.startsWith('file:')) { | ||
const modulePath = url.fileURLToPath(import.meta.url); | ||
if (process.argv[1] === modulePath) { | ||
void main(); | ||
} | ||
} |