(positionals, args)
| 28 | } |
| 29 | |
| 30 | export async function test(positionals, args) { |
| 31 | // Set flag for running tests in development mode, required for `act()`. |
| 32 | args['define:process.env.NODE_ENV'] = '"development"'; |
| 33 | |
| 34 | // Set flag for adding stubs used in tests. |
| 35 | args['define:globalThis.__TEST__'] = 'true'; |
| 36 | |
| 37 | await build(positionals, args); |
| 38 | |
| 39 | await cmd(`echo '{"type": "module"}' > ${args.outdir}/package.json`); |
| 40 | |
| 41 | // Ignore test/helpers/ folder for running tests. |
| 42 | positionals = positionals.filter((p) => !p.startsWith('test/helpers/')); |
| 43 | |
| 44 | for (let file of positionals) { |
| 45 | file = file.replace(/\.tsx?/, '.js'); |
| 46 | console.log(await cmd(`node --enable-source-maps dist${file}`)); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | async function cmd(command, opts = {}) { |
| 51 | command = command.trim().replace(/\s+/g, ' '); |
no test coverage detected
searching dependent graphs…