-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: moved from jest to node:test
- Loading branch information
1 parent
a5600bb
commit 142bbd5
Showing
57 changed files
with
1,583 additions
and
2,570 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,45 @@ | ||
import path from 'node:path'; | ||
import { spawn } from 'node:child_process'; | ||
|
||
/** | ||
* Run given path for the given library | ||
* @param {object} options - The options object | ||
* @param {string} options.library - The library to test | ||
* @param {string} options.path - The path to the file that needs to be run | ||
* @returns {Promise<void>} | ||
*/ | ||
const run = async ({ library, file: filePath }) => { | ||
console.log(`Running ${filePath} from ${library}`); | ||
|
||
// Resolve paths in a cross-platform way | ||
const mainFolder = path.join(process.cwd(), 'lib', library); | ||
|
||
const spwn = spawn( | ||
`node ${filePath}`, | ||
[], | ||
{ | ||
stdio: 'inherit', | ||
// Set cwd to the project root | ||
cwd: mainFolder, | ||
shell: true, | ||
}, | ||
); | ||
|
||
spwn.on('exit', (code) => { | ||
if (code !== 0) { | ||
console.error(`Failed to run ${filePath} from ${library}`); | ||
process.exit(1); | ||
} | ||
}); | ||
|
||
spwn.on('error', (error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
|
||
spwn.on('close', () => { | ||
console.log(`finished running ${filePath} from ${library}`); | ||
}); | ||
}; | ||
|
||
export default run; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.