Skip to content

Commit

Permalink
[test] Refactor test commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Aug 11, 2022
1 parent 960c433 commit 6b6588e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ jobs:
- run: make test-dist-experiments
- run: make test-dist-esm-parcel
- run: make test-dist-esm-vite
- run: make test-dist-not-imported-from-src
- run: make clean
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
- run: npm install
- run: make test-spec
- run: make lint
- run: make test-import-restrictions
- run: make test-src-internal-import-restrictions
- run: make test-src-does-not-import-dist
- run: make test-tsc
- run: make format
- run: make clean
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/lgarron/Makefile-scripts

# Note: the first command becomes the default `make` target.
NPM_COMMANDS = build build-esm build-bundle-global build-types build-bin build-sites build-site-twizzle build-site-experiments build-site-typedoc build-search-worker generate-js generate-js-parsers generate-js-svg dev link clean test test-dist-esm-node-import test-dist-esm-scramble-all-events test-dist-esm-parcel test-dist-esm-vite test-dist-esm-perf test-dist-esm-plain-esbuild-compat test-dist-experiments test-dist-not-imported-from-src test-import-restrictions test-spec test-spec-watch test-tsc format setup initial-setup lint prepack postpublish
NPM_COMMANDS = build build-esm build-bundle-global build-types build-bin build-sites build-site-twizzle build-site-experiments build-site-typedoc build-search-worker generate-js generate-js-parsers generate-js-svg dev link clean test test-fast test-full test-src test-spec test-spec-watch test-src-internal-import-restrictions test-src-does-not-import-dist test-tsc test-build test-dist test-dist-esm-node-import test-dist-esm-scramble-all-events test-dist-esm-parcel test-dist-esm-vite test-dist-esm-perf test-dist-esm-plain-esbuild-compat test-dist-experiments format setup initial-setup lint prepack postpublish

.PHONY: $(NPM_COMMANDS)
$(NPM_COMMANDS):
Expand Down
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,24 @@
"dev": "npm run initial-setup && node ./script/build/main.js sites dev",
"link": "npm run build && npm link",
"clean": "rm -rf dist .temp coverage src/cubing/search/search-worker-inside-generated* ./alg ./bluetooth ./kpuzzle ./notation ./protocol ./puzzle-geometry ./puzzles ./scramble ./search ./stream ./twisty",
"test": "npm run test-spec && npm run lint && npm run test-import-restrictions && npm run test-tsc # keep test.yml & build.yml in sync with this",
"test": "echo \"Run one of the following:\n\n make test-src\n make test-build\n make test-dist\n\n make test-full (run all of the above)\n make test-fast (run all fast-ish tests)\n\"",
"test-fast": "npm run build-esm && npm run build-sites && npm run build-bin && npm run test-spec",
"test-full": "npm run test-src && npm run test-build && npm run test-dist",
"test-src": "npm run test-spec && npm run test-src-internal-import-restrictions && npm run test-src-does-not-import-dist && npm run lint && npm run test-tsc # keep test.yml & build.yml in sync with this",
"test-spec": "npx web-test-runner",
"test-spec-watch": "npx web-test-runner --watch",
"test-src-internal-import-restrictions": "node ./script/test/src/internal-import-restrictions/main.js",
"test-src-does-not-import-dist": "node ./script/test/src/does-not-import-dist/main.js",
"test-tsc": "npm run build-types && npx tsc --project ./tsconfig.json",
"test-build": "npm run build-esm && npm run build-sites && npm run build-bin && npm run build-bundle-global && npm run build-types && npm run build-site-typedoc",
"test-dist": "npm run build-esm && npm run build-sites && npm run test-dist-esm-node-import && npm run test-dist-esm-scramble-all-events && npm run test-dist-esm-parcel && npm run test-dist-esm-vite && npm run test-dist-esm-perf && npm run test-dist-esm-plain-esbuild-compat && npm run test-dist-experiments",
"test-dist-esm-node-import": "node script/test/dist/esm/node-import/main.mjs",
"test-dist-esm-scramble-all-events": "node script/test/dist/esm/scramble-all-events/main.mjs",
"test-dist-esm-parcel": "node ./script/test/dist/esm/parcel/main.js",
"test-dist-esm-vite": "node ./script/test/dist/esm/vite/main.js",
"test-dist-esm-perf": "node script/test/dist/esm/perf/*.mjs",
"test-dist-esm-plain-esbuild-compat": "node script/test/dist/esm/plain-esbuild-compat/main.js",
"test-dist-experiments": "node ./script/test/dist/experiments/main.js",
"test-dist-not-imported-from-src": "node ./script/test/dist/not-imported-from-src/main.js",
"test-import-restrictions": "node ./script/test/import-restrictions/main.js",
"test-spec": "npx web-test-runner",
"test-spec-watch": "npx web-test-runner --watch",
"test-tsc": "npm run build-types && npx tsc --project ./tsconfig.json",
"format": "npx eslint --fix --ext=js,ts src script; npx prettier --write src script",
"setup": "npm install",
"initial-setup": "node ./script/initial-setup/main.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolve } from "path";
import { existsSync } from "fs";

import { targetInfos } from "./target-infos.js";
import { execPromise } from "../../lib/execPromise.js";
import { execPromise } from "../../../lib/execPromise.js";

const TARGET_INFOS_PATH = resolve(
new URL(".", import.meta.url).pathname,
Expand All @@ -15,18 +15,18 @@ const CUBING_PRIVATE_SUFFIX = "/cubing-private";
// Note that we have to use an extra `..` to back out of the file name
const PATH_TO_SRC_CUBING = resolve(
new URL(".", import.meta.url).pathname,
"../../../src/cubing",
"../../../../src/cubing",
);
const PATH_TO_SRC_CUBING_VENDOR = resolve(
new URL(".", import.meta.url).pathname,
"../../../src/cubing/vendor",
"../../../../src/cubing/vendor",
);

class Target {
constructor(name, targetInfo) {
this.name = name;
// this.outdir = `./${this.name}`
this.outdir = `./dist/test-import-restrictions/${this.name}`;
this.outdir = `./dist/test-src-internal-import-restrictions/${this.name}`;

this.deps = targetInfo.deps;

Expand Down
2 changes: 1 addition & 1 deletion src/bin/import-restrictions-mermaid-diagram.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { targetInfos } from "../../script/test/import-restrictions/target-infos";
import { targetInfos } from "../../script/test/src/internal-import-restrictions/target-infos";

console.log("graph BT");
for (const [target, targetInfo] of Object.entries(targetInfos)) {
Expand Down

0 comments on commit 6b6588e

Please sign in to comment.