Move test:unit into its own script (#254)

This commit is contained in:
Philip Peterson 2026-05-03 05:32:42 -07:00 committed by GitHub
parent d057ccc6e9
commit a2828969c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 35 additions and 2 deletions

View file

@ -14,7 +14,7 @@
"build": "cross-env NODE_ENV=production webpack && tsc -b -v && cross-env BABEL_ENV=production babel target/renderer/bundle.js --out-file target/renderer/bundle.js --no-comments --minified",
"lint": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.json",
"test": "yarn run lint && yarn run test:unit",
"test:unit": "tsc -b app/tsconfig.json && node --eval \"const{cpSync,mkdirSync}=require('fs');const{basename}=require('path');mkdirSync('dist/tmp/root/app',{recursive:true});cpSync('target','dist/tmp/root/app',{recursive:true,filter:function(s){const b=basename(s);if(b==='node_modules'||b==='renderer')return false;return true;}})\" && cross-env DEBUG=ava:watcher AVA_IMPORT_FROM_PROJECT_NO_STUB=1 ava --no-cache",
"test:unit": "zx test-unit.mjs",
"test:unit:watch": "yarn run test:unit -- --watch",
"test:e2e": "cross-env DEBUG=ava:watcher AVA_IMPORT_FROM_PROJECT_NO_STUB=1 ava --no-cache --config ava-e2e.config.js",
"postinstall": "yarn run v8-snapshot && webpack --config-name hyper-app && yarn run install-app-deps-with-retry && yarn run rebuild-node-pty && cpy --cwd=target node_modules \"../../app/\" && husky && yarn run generate-schema",
@ -146,7 +146,8 @@
"ts-node": "10.9.2",
"typescript": "5.7.2",
"uuaw": "^1.2.2",
"webpack": "5.96.1"
"webpack": "5.96.1",
"zx": "^8.8.5"
},
"electronmon": {
"patterns": [

27
test-unit.mjs Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env zx
import { cpSync, mkdirSync } from 'fs';
import { basename } from 'path';
$.prefix = 'set -e;';
await $`tsc -b app/tsconfig.json`.pipe(process.stdout);
await mkdirSync('dist/tmp/root/app', { recursive: true });
await cpSync(
'target',
'dist/tmp/root/app',
{
recursive: true,
filter: function (s) {
const b = basename(s);
if (b === 'node_modules' || b === 'renderer') {
return false;
}
return true;
}
}
)
await $`cross-env DEBUG=ava:watcher AVA_IMPORT_FROM_PROJECT_NO_STUB=1 ava --no-cache`.pipe(process.stdout);

View file

@ -7830,3 +7830,8 @@ yoctocolors@^2.1.1:
version "2.1.2"
resolved "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.2.tgz#d795f54d173494e7d8db93150cec0ed7f678c83a"
integrity sha512-CzhO+pFNo8ajLM2d2IW/R93ipy99LWjtwblvC1RsoSUMZgyLbYFr221TnSNT7GjGdYui6P459mw9JH/g/zW2ug==
zx@^8.8.5:
version "8.8.5"
resolved "https://registry.npmjs.org/zx/-/zx-8.8.5.tgz#d092d8c0017aa7c5a276fda88ff19e4b1d91cc64"
integrity sha512-SNgDF5L0gfN7FwVOdEFguY3orU5AkfFZm9B5YSHog/UDHv+lvmd82ZAsOenOkQixigwH2+yyH198AwNdKhj+RA==