Skip to content

Commit

Permalink
Convert test launcher to javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
davidje13 committed Oct 29, 2023
1 parent 2d3bf7d commit 5e2b3e9
Show file tree
Hide file tree
Showing 9 changed files with 443 additions and 286 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"install": "scripts/install.mjs --force",
"lint": "scripts/install.mjs && scripts/lint.mjs",
"start": "SKIP_E2E_DEPS=true scripts/install.mjs && scripts/start.mjs",
"test": "scripts/install.mjs && scripts/lint.mjs && scripts/test.sh",
"test": "scripts/install.mjs && scripts/lint.mjs && scripts/test.mjs",
"format": "npm --prefix=backend run format --quiet && npm --prefix=frontend run format --quiet && npm --prefix=e2e run format --quiet",
"test:backend": "npm --prefix=backend test --quiet --",
"test:frontend": "npm --prefix=frontend test --quiet --",
"test:frontend:watch": "npm --prefix=frontend test --quiet -- --watch",
"test:e2e": "scripts/install.mjs && scripts/e2e.sh"
"test:e2e": "scripts/install.mjs && scripts/test.mjs --only-e2e"
}
}
41 changes: 15 additions & 26 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
copy,
} from './helpers/io.mjs';
import { stat, rename, chmod } from 'node:fs/promises';
import { runTask, runTaskPrefixOutput } from './helpers/proc.mjs';
import { runMultipleTasks, runTask } from './helpers/proc.mjs';

const PARALLEL_BUILD = (process.env['PARALLEL_BUILD'] ?? 'true') === 'true';
const KEEP_DEPS = process.argv.slice(2).includes('--keep-deps');
Expand All @@ -24,39 +24,28 @@ const packages = [
const builddir = join(basedir, 'build');
const staticdir = join(builddir, 'static');

try {
await runTask('diff', [
await runTask({
command: 'diff',
args: [
join(basedir, 'frontend', 'src', 'shared', 'api-entities.ts'),
join(basedir, 'backend', 'src', 'shared', 'api-entities.ts'),
]);
} catch {
log('Shared api-entities.ts files do not match.');
process.exit(1);
}
],
outputMode: 'fail_atomic',
failureMessage: 'Shared api-entities.ts files do not match.',
});

async function buildPackage({ dir, format }) {
log(`Building ${dir}...`);
await runTaskPrefixOutput({
await runMultipleTasks(
packages.map(({ dir, format }) => ({
command: 'npm',
args: ['run', 'build', '--quiet'],
cwd: join(basedir, dir),
beginMessage: `Building ${dir}...`,
failureMessage: `Failed to build ${dir}.`,
outputPrefix: dir,
prefixFormat: format,
});
}

try {
if (PARALLEL_BUILD) {
await Promise.all(packages.map(buildPackage));
} else {
for (const pkg of packages) {
await buildPackage(pkg);
}
}
} catch {
log('Build failed.');
process.exit(1);
}
})),
{ parallel: PARALLEL_BUILD },
);

let preserveBuildModules = false;
const buildModules = join(builddir, 'node_modules');
Expand Down
132 changes: 0 additions & 132 deletions scripts/e2e.sh

This file was deleted.

Loading

0 comments on commit 5e2b3e9

Please sign in to comment.