Skip to content

Commit 6b6588e

Browse files
committed
[test] Refactor test commands.
1 parent 960c433 commit 6b6588e

File tree

9 files changed

+19
-14
lines changed

9 files changed

+19
-14
lines changed

.github/workflows/build.yml

-1
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,4 @@ jobs:
4040
- run: make test-dist-experiments
4141
- run: make test-dist-esm-parcel
4242
- run: make test-dist-esm-vite
43-
- run: make test-dist-not-imported-from-src
4443
- run: make clean

.github/workflows/test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ jobs:
3232
- run: npm install
3333
- run: make test-spec
3434
- run: make lint
35-
- run: make test-import-restrictions
35+
- run: make test-src-internal-import-restrictions
36+
- run: make test-src-does-not-import-dist
3637
- run: make test-tsc
3738
- run: make format
3839
- run: make clean

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://github.com/lgarron/Makefile-scripts
33

44
# Note: the first command becomes the default `make` target.
5-
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
5+
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
66

77
.PHONY: $(NPM_COMMANDS)
88
$(NPM_COMMANDS):

package.json

+11-6
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,24 @@
121121
"dev": "npm run initial-setup && node ./script/build/main.js sites dev",
122122
"link": "npm run build && npm link",
123123
"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",
124-
"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",
124+
"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\"",
125+
"test-fast": "npm run build-esm && npm run build-sites && npm run build-bin && npm run test-spec",
126+
"test-full": "npm run test-src && npm run test-build && npm run test-dist",
127+
"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",
128+
"test-spec": "npx web-test-runner",
129+
"test-spec-watch": "npx web-test-runner --watch",
130+
"test-src-internal-import-restrictions": "node ./script/test/src/internal-import-restrictions/main.js",
131+
"test-src-does-not-import-dist": "node ./script/test/src/does-not-import-dist/main.js",
132+
"test-tsc": "npm run build-types && npx tsc --project ./tsconfig.json",
133+
"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",
134+
"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",
125135
"test-dist-esm-node-import": "node script/test/dist/esm/node-import/main.mjs",
126136
"test-dist-esm-scramble-all-events": "node script/test/dist/esm/scramble-all-events/main.mjs",
127137
"test-dist-esm-parcel": "node ./script/test/dist/esm/parcel/main.js",
128138
"test-dist-esm-vite": "node ./script/test/dist/esm/vite/main.js",
129139
"test-dist-esm-perf": "node script/test/dist/esm/perf/*.mjs",
130140
"test-dist-esm-plain-esbuild-compat": "node script/test/dist/esm/plain-esbuild-compat/main.js",
131141
"test-dist-experiments": "node ./script/test/dist/experiments/main.js",
132-
"test-dist-not-imported-from-src": "node ./script/test/dist/not-imported-from-src/main.js",
133-
"test-import-restrictions": "node ./script/test/import-restrictions/main.js",
134-
"test-spec": "npx web-test-runner",
135-
"test-spec-watch": "npx web-test-runner --watch",
136-
"test-tsc": "npm run build-types && npx tsc --project ./tsconfig.json",
137142
"format": "npx eslint --fix --ext=js,ts src script; npx prettier --write src script",
138143
"setup": "npm install",
139144
"initial-setup": "node ./script/initial-setup/main.js",

script/test/import-restrictions/main.js script/test/src/internal-import-restrictions/main.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { resolve } from "path";
33
import { existsSync } from "fs";
44

55
import { targetInfos } from "./target-infos.js";
6-
import { execPromise } from "../../lib/execPromise.js";
6+
import { execPromise } from "../../../lib/execPromise.js";
77

88
const TARGET_INFOS_PATH = resolve(
99
new URL(".", import.meta.url).pathname,
@@ -15,18 +15,18 @@ const CUBING_PRIVATE_SUFFIX = "/cubing-private";
1515
// Note that we have to use an extra `..` to back out of the file name
1616
const PATH_TO_SRC_CUBING = resolve(
1717
new URL(".", import.meta.url).pathname,
18-
"../../../src/cubing",
18+
"../../../../src/cubing",
1919
);
2020
const PATH_TO_SRC_CUBING_VENDOR = resolve(
2121
new URL(".", import.meta.url).pathname,
22-
"../../../src/cubing/vendor",
22+
"../../../../src/cubing/vendor",
2323
);
2424

2525
class Target {
2626
constructor(name, targetInfo) {
2727
this.name = name;
2828
// this.outdir = `./${this.name}`
29-
this.outdir = `./dist/test-import-restrictions/${this.name}`;
29+
this.outdir = `./dist/test-src-internal-import-restrictions/${this.name}`;
3030

3131
this.deps = targetInfo.deps;
3232

src/bin/import-restrictions-mermaid-diagram.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { targetInfos } from "../../script/test/import-restrictions/target-infos";
1+
import { targetInfos } from "../../script/test/src/internal-import-restrictions/target-infos";
22

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

0 commit comments

Comments
 (0)