diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index c30cc1a4..00000000 --- a/babel.config.js +++ /dev/null @@ -1,6 +0,0 @@ -// This file is only used by jest.runner.config.js, when running the -// test-runner. The tool itself uses typescript's compilation instead. -module.exports = { - presets: [['@exercism/babel-preset-javascript', { corejs: '3.44' }]], - plugins: [], -} diff --git a/bin/run.sh b/bin/run.sh index e1a8079f..1937b59d 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -77,9 +77,8 @@ OUTPUT="${OUTPUT%/}/" set -euo pipefail ROOT="$(realpath $(dirname "$0")/..)" -REPORTER="$ROOT/dist/reporter.js" -SETUP="$ROOT/dist/jest/setup.js" -CONFIG="$ROOT/jest.runner.config.js" +REPORTER="$ROOT/dist/reporter.mjs" +SETUP="$ROOT/dist/setup.mjs" echo " " echo "╔═════════════════════════════════════════════════════════════╗" @@ -95,9 +94,9 @@ echo "✔️ Using base-root: $ROOT" echo "✔️ Using setup-env: $SETUP" if test -f "$REPORTER"; then - echo "✔️ reporter.js found, test runner was built" + echo "✔️ reporter.mjs found, test runner was built" else - >&2 echo "❌ Expected reporter.js to exist." + >&2 echo "❌ Expected reporter.mjs to exist." >&2 echo "❌ Did you forget to 'corepack pnpm build' first?" >&2 echo "" >&2 echo "👁️ The following files exist in the dist folder (build output):" @@ -153,59 +152,6 @@ if test -f "${OUTPUT}.npmrc"; then mv "${OUTPUT}.npmrc" "${OUTPUT}.npmrc.💥.bak" || true fi; -COREPACK_ROOT_DIR=$(pwd) - -if [[ "${OUTPUT}" =~ "$ROOT" ]]; then - echo "" - echo "The output directory seems to be placed inside the test " - echo "runner root. This means the CLI tools we run will use the " - echo "configuration files as given by the test-runner for running " - echo "the tests, which is what we want. No need to turn the output " - echo "directory into a standalone package." - echo "" - - if test -f "${OUTPUT}pnpm-lock.yaml"; then - echo "✔️ renaming pnpm-lock in output to prevent pnpm from " - echo " interpreting this directory as a standalone package." - mv "${OUTPUT}pnpm-lock.yaml" "${OUTPUT}pnpm-lock.yaml.💥.bak" || true - fi; - - echo "" -else - echo "" - echo "The output directory is likely not placed inside the test " - echo "runner root. This means the CLI tools need configuration " - echo "files as given and understood by the test-runner for running " - echo "the tests. Will now turn the output directory into a " - echo "standalone package." - echo "" - - COREPACK_ROOT_DIR="${OUTPUT}" - - echo "✔️ pnpm cache from root to output" - # cd $ROOT && corepack pnpm deploy --filter @exercism/javascript-test-runner --ignore-scripts "${OUTPUT}deploy" - # mv "${OUTPUT}deploy/node_modules" "${OUTPUT}" - # Link to the installed packages instead of copying them. The folder holds - # about 26,000 files, so copying it took over a second with a warm disk - # cache and over 15 seconds with a cold one. Node resolves the link to the - # real folder, so packages load from the image as before. - ln -s "${ROOT}/node_modules" "${OUTPUT}node_modules" - - echo "✔️ .pnpm-lock.yaml from root to output" - cp "${ROOT}/pnpm-lock.yaml" "${OUTPUT}pnpm-lock.yaml" - - echo "✔️ babel.config.js from root to output" - cp "${ROOT}/babel.config.js" "${OUTPUT}babel.config.js" - - echo "✔️ package.json from root to output" - cp "${ROOT}/package.json" "${OUTPUT}package.json" - - echo "✔️ .npmrc from root to output" - cp "${ROOT}/.npmrc" "${OUTPUT}.npmrc" - - echo "" -fi - # Put together the path to the test results file result_file="${OUTPUT}results.json" echo "The results of this run will be written to 'results.json'." @@ -224,6 +170,9 @@ if test -f $configuration_file; then echo "" cat $configuration_file | jq -c '.files.test[]' | xargs -L 1 "$ROOT/bin/prepare.sh" ${OUTPUT} + + # Every exercise has one test file. + test_file=$(jq -r '.files.test[0]' "${configuration_file}") else if test -f $local_configuration_file; then echo "There is a configuration file in the .exercism local " @@ -234,6 +183,9 @@ else echo "" cat $local_configuration_file | jq -c '.files.test[]' | xargs -L 1 "$ROOT/bin/prepare.sh" ${OUTPUT} + + # Every exercise has one test file. + test_file=$(jq -r '.files.test[0]' "${local_configuration_file}") else test_file="${SLUG}.spec.js" @@ -254,7 +206,6 @@ else # Restore configuration files if test -f "${OUTPUT}babel.config.js.💥.bak"; then echo "✔️ restoring babel.config.js in output" - unlink "${OUTPUT}babel.config.js" mv "${OUTPUT}babel.config.js.💥.bak" "${OUTPUT}babel.config.js" || true fi; @@ -296,52 +247,6 @@ else fi fi -echo "" -echo "╔═════════════════════════════════════════════════════════════╗" -echo " 🔧 Preparing test project " -echo "╚═════════════════════════════════════════════════════════════╝" -echo "" - - -if test -f "${OUTPUT}package.json"; then - echo "✔️ standalone package found at ${OUTPUT}package.json" - echo "" - - if test -d "${OUTPUT}node_modules/.pnpm"; then - # echo "Found .pnpm hoisted packages" - # ls -aln1 "${OUTPUT}node_modules" - # echo "" - echo "Found .pnpm hoisted binaries" - else - echo ".pnpm hoisted packages not found" - cd "${COREPACK_ROOT_DIR}" && corepack pnpm install --offline --frozen-lockfile - fi -fi; - -# Call jest directly. Going through `corepack pnpm` started two extra -# Node processes (corepack, then pnpm) before jest itself. -bin_jest="${COREPACK_ROOT_DIR%/}/node_modules/.bin/jest" - -echo "👁️ ${COREPACK_ROOT_DIR} as corepack root" - -if [[ -f "${bin_jest}" ]]; then - echo "✔️ jest executable found using ${bin_jest}" - - if [[ -x "${bin_jest}" ]]; then - echo "✔️ jest executable is executable for $(whoami)" - else - echo "💥 jest executable not executable for $(whoami)" - - ls -l "${bin_jest}" - - exit -1 - fi -else - echo "💥 jest executable missing at ${bin_jest}" - exit -1 -fi; - - # Disable auto exit set +e @@ -351,37 +256,43 @@ echo " ➤ Execution (tests: does the solution work?) " echo "╚═════════════════════════════════════════════════════════════╝" echo "" -# Run tests. If Jest finds no test files, the reporter writes the "no tests" -# error to results.json. Checking for that here would mean starting Jest a -# second time (with --listTests) just to list the test files. -echo "⚙️ corepack pnpm jest <...>" -echo "" - -cd "${COREPACK_ROOT_DIR}" && "${bin_jest}" "${OUTPUT}*" \ - --bail 1 \ - --ci \ - --colors \ - --config ${CONFIG} \ - --noStackTrace \ - --outputFile="${result_file}" \ - --passWithNoTests \ - --reporters "${REPORTER}" \ - --roots "${OUTPUT}" \ - --setupFilesAfterEnv ${SETUP} \ - --verbose false \ - --detectOpenHandles \ - --testLocationInResults - -# Convert exit(1) (jest worked, but there are failing tests) to exit(0) -test_exit=$? +if test -f "${OUTPUT}${test_file}"; then + echo "⚙️ node --test ${test_file}" + echo "" -if [ $test_exit -eq 1 ]; then - echo "❌ not all tests (*.spec.js) passed." -elif grep -q "not subjected to any type or execution tests" "${result_file}"; then - # Jest found no test files, and the reporter wrote the "no tests" error. - echo "❌ no jest tests (*.spec.js) discovered." + # Run the tests with Node's built-in test runner. setup.mjs provides the + # Jest API the tests use, and reporter.mjs writes results.json. + # + # --test-isolation=none runs the test file in this process, instead of + # starting another one, and lets the reporter read the console messages. + # --test-force-exit stops the process once the tests have finished, even + # if the solution leaves a timer running. + # --experimental-test-module-mocks enables jest.mock (see setup.mts). + cd "${OUTPUT}" && TEST_FILE="${OUTPUT}${test_file}" RESULTS_FILE="${result_file}" node \ + --import "${SETUP}" \ + --experimental-test-module-mocks \ + --disable-warning=ExperimentalWarning \ + --test \ + --test-isolation=none \ + --test-force-exit \ + --test-reporter="${REPORTER}" \ + "${OUTPUT}${test_file}" + + # Convert exit(1) (the tests ran, but some failed) to exit(0) + test_exit=$? + + if [ $test_exit -eq 1 ]; then + echo "❌ not all tests (*.spec.js) passed." + else + echo "✅ all tests (*.spec.js) passed." + fi; else - echo "✅ all tests (*.spec.js) passed." + # The test file named in the configuration file is missing. + # Version 3 output can't have an empty list of tests, so this uses the + # version 1 format, which has no tests key. + test_exit=0 + echo "{ \"version\": 1, \"status\": \"error\", \"message\": \"The submitted code was not subjected to any type or execution tests. At least one test was expected.\" }" > "${result_file}" + echo "❌ no tests (*.spec.js) discovered." fi; echo "" @@ -392,7 +303,6 @@ echo "" # Restore configuration files if test -f "${OUTPUT}babel.config.js.💥.bak"; then echo "✔️ restoring babel.config.js in output" - unlink "${OUTPUT}babel.config.js" mv "${OUTPUT}babel.config.js.💥.bak" "${OUTPUT}babel.config.js" || true fi; diff --git a/eslint.config.mjs b/eslint.config.mjs index 06fbe466..355f39a2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -13,8 +13,6 @@ export default [ 'dist/**/*', 'test/fixtures/**/*', 'test_exercises/**/*', - 'babel.config.js', - 'jest.runner.config.js', ], }, ] diff --git a/jest.runner.config.js b/jest.runner.config.js deleted file mode 100644 index 101c492e..00000000 --- a/jest.runner.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - verbose: true, - modulePathIgnorePatterns: ['package.json'], - transform: { - '^.+\\.[t|j]sx?$': 'babel-jest', - }, - reporters: [], -} diff --git a/package.json b/package.json index 81a9948d..3f6b244e 100644 --- a/package.json +++ b/package.json @@ -27,21 +27,15 @@ "test:bare": "corepack pnpm node test/smoke.test.mjs && corepack pnpm node test/skip.test.mjs && corepack pnpm node test/log.test.mjs && corepack pnpm node test/taskid.test.mjs" }, "dependencies": { - "@exercism/babel-preset-javascript": "^0.7.0", - "@jest/console": "^30.4.0", - "@jest/reporters": "^30.4.0", - "@jest/test-result": "^30.4.0", - "@jest/types": "^30.4.0", + "@jest/console": "^30.5.2", "acorn": "^8.15.0", - "babel-jest": "^30.4.0", "chalk": "^6.0.0", - "core-js": "^3.44.0", - "jest": "^30.4.0", + "expect": "^30.5.2", + "jest-mock": "^30.5.2", "shelljs": "^0.10.0" }, "devDependencies": { "@exercism/eslint-config-tooling": "^0.9.0", - "@jest/globals": "^30.4.0", "@tsconfig/node22": "^22.0.2", "@types/node": "^22.16.5", "@types/shelljs": "^0.10.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9ec1202a..c0c85908 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,36 +8,21 @@ importers: .: dependencies: - '@exercism/babel-preset-javascript': - specifier: ^0.7.0 - version: 0.7.0 '@jest/console': - specifier: ^30.4.0 + specifier: ^30.5.2 version: 30.5.2 - '@jest/reporters': - specifier: ^30.4.0 - version: 30.5.2 - '@jest/test-result': - specifier: ^30.4.0 - version: 30.5.2 - '@jest/types': - specifier: ^30.4.0 - version: 30.5.1 acorn: specifier: ^8.15.0 version: 8.15.0 - babel-jest: - specifier: ^30.4.0 - version: 30.5.2(@babel/core@7.29.7) chalk: specifier: ^6.0.0 version: 6.0.1 - core-js: - specifier: ^3.44.0 - version: 3.44.0 - jest: - specifier: ^30.4.0 - version: 30.5.2(@types/node@22.16.5) + expect: + specifier: ^30.5.2 + version: 30.5.2 + jest-mock: + specifier: ^30.5.2 + version: 30.5.2 shelljs: specifier: ^0.10.0 version: 0.10.0 @@ -45,9 +30,6 @@ importers: '@exercism/eslint-config-tooling': specifier: ^0.9.0 version: 0.9.0(@exercism/babel-preset-typescript@0.7.0)(@typescript-eslint/eslint-plugin@8.37.0(@typescript-eslint/parser@8.37.0(eslint@9.31.0)(typescript@5.7.3))(eslint@9.31.0)(typescript@5.7.3))(eslint@9.31.0)(jest@30.5.2(@types/node@22.16.5))(typescript@5.7.3) - '@jest/globals': - specifier: ^30.4.0 - version: 30.5.0 '@tsconfig/node22': specifier: ^22.0.2 version: 22.0.6 @@ -88,10 +70,6 @@ packages: resolution: {integrity: sha512-2W76mhjrpQFO1lK5e8IvGYB2D0YZ7S2R1Z2BjO2ZUYuW+amcpK/z60U6ZZmzskwoa7sJ6XohP/Wg8H5KxXI/IA==} engines: {node: '>=6.9.0'} - '@babel/generator@7.29.8': - resolution: {integrity: sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==} - engines: {node: '>=6.9.0'} - '@babel/helper-annotate-as-pure@7.29.7': resolution: {integrity: sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw==} engines: {node: '>=6.9.0'} @@ -106,12 +84,6 @@ packages: peerDependencies: '@babel/core': ^7.0.0 - '@babel/helper-create-class-features-plugin@7.29.7': - resolution: {integrity: sha512-IY3ZD9Tmooqr3TUhc3DUWxiuo8xx1DWLhd5M7hQ+ZWJamqM2BbalrBJb2MisSLoYorOj75U03qULCxQTY9r3hg==} - engines: {node: '>=6.9.0'} - peerDependencies: - '@babel/core': ^7.0.0 - '@babel/helper-create-regexp-features-plugin@7.29.7': resolution: {integrity: sha512-907Uymvqgg1dwUA+7IGwFAOSYzQOuzPXKNJ1yxzwPffzkYFg2q2eHi1fIOs6sXkG9NbIUMunnUlkYsfRFNvomg==} engines: {node: '>=6.9.0'} @@ -169,10 +141,6 @@ packages: resolution: {integrity: sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==} engines: {node: '>=6.9.0'} - '@babel/helper-string-parser@7.29.7': - resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==} - engines: {node: '>=6.9.0'} - '@babel/helper-validator-identifier@7.29.7': resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==} engines: {node: '>=6.9.0'} @@ -201,16 +169,6 @@ packages: engines: {node: '>=6.0.0'} hasBin: true - '@babel/parser@7.29.8': - resolution: {integrity: sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==} - engines: {node: '>=6.0.0'} - hasBin: true - - '@babel/parser@7.29.9': - resolution: {integrity: sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==} - engines: {node: '>=6.0.0'} - hasBin: true - '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.29.7': resolution: {integrity: sha512-j8SrR0zLZrRsC09DlszEx8FpMiwukKffYXMK0d5LmOglO7vGG6sz/BR/20yHqWH+Lnn31JTt2PE3hIWNgM2J6w==} engines: {node: '>=6.9.0'} @@ -699,18 +657,10 @@ packages: resolution: {integrity: sha512-MscXe/NAZcOkYEsRajHZFt3ynsb22PUi6CTrp5U7+RYycR9By84mn9mFN54YgfITiqK4hFx3Ju3tZSyzfpS5ew==} engines: {node: '>=6.9.0'} - '@babel/traverse@7.29.8': - resolution: {integrity: sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==} - engines: {node: '>=6.9.0'} - '@babel/types@7.29.11': resolution: {integrity: sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==} engines: {node: '>=6.9.0'} - '@babel/types@7.29.8': - resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==} - engines: {node: '>=6.9.0'} - '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} @@ -762,9 +712,6 @@ packages: resolution: {integrity: sha512-Ul5l+lHEcw3L5+k8POx6r74mxEYKG5kOb6Xpy2gCRW6zweT6TEhAf8vhxGgjhqrd/VO/Dirhsb+1hNpD1ue9hw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@exercism/babel-preset-javascript@0.7.0': - resolution: {integrity: sha512-232BssiG6xczvgnXdZkIW0UoWM1Cz9Hj7BAjgrQT01Qh3tETzQ95ofeSFL+gyJWScI7JhZuCQ4a+ybqYtQxTqg==} - '@exercism/babel-preset-typescript@0.7.0': resolution: {integrity: sha512-IHAc11nmiq/GVo2/Fps5HkMjXDOEux9BFQ36kQt3OOl78+1rDH3P+iJCsQ3xfWURBAODH/6m/YPw/0Wy4h+ZAw==} @@ -824,34 +771,18 @@ packages: resolution: {integrity: sha512-OsqBjHXCn8cadasoAZBP6nWYvMsRhpMzGXTpxJ5aO04NlbdhIz+FVe3q49l0AwVhsz/cEmIpBes6gAFl1/dWQg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/environment@30.5.0': - resolution: {integrity: sha512-HUaqexIauIh69IQ4NTuPDEUCB8g8T4TOPSIzQOS18mwI/KEHKQk1j013K2o6ra031szZE2t5jGmVx3xbzdjgKA==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/environment@30.5.2': resolution: {integrity: sha512-nwFPOUMbmsjNNRCpnJpB9HbSZu4C07wDDds++5j+j1MezzPLxMPDdbdUVjr2o4RULDOValnDd70taPFI1EtxAg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/expect-utils@30.5.0': - resolution: {integrity: sha512-5j0ztPxSy3McUJihjkDdCyCfjvT2hxykFTWsgEBZKB8qsw9ALdCiGTpTRH5gnf/d+qI4SflYUJ0dWNbzjQCWbA==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/expect-utils@30.5.2': resolution: {integrity: sha512-d/HOLSrJUlBIl6n3LzOa7cjW3xdePm5H5gQw2lixZ/0h157l9sw3mLblzFqnPcTbhDzhRQdBOX3A3KcG73nm5Q==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/expect@30.5.0': - resolution: {integrity: sha512-jEmgmgJEobJ3zEhDOGp1VAJ6JkoVelpS8uZ1ae1Ul/5lP78UKJKmmU0lciJwd6JdnqOXHaaS/QCKwbf1dHI9MA==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/expect@30.5.2': resolution: {integrity: sha512-2E+1Pg6jJxbRjLNLpciC71iri/3qsKJL222/aXJEFwC0VdUSvfS+JZQQLEVjUYYc8t8pQu2MGE3cF2+bNTYRsg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/fake-timers@30.5.0': - resolution: {integrity: sha512-sg8xIbYwe5GdB/vT3/0qrDIpO7Ov9mazHi++M95uynmDKEZ70G1r169AWct73H07VrTZhrz1SJEfLtjYv8tE3A==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/fake-timers@30.5.2': resolution: {integrity: sha512-GKk0h0tKT5SpDPxDhPg3r9mm5s8/YCBzVNMOGdRiQXwUiMsjU10mVPlMaQstH6/cu50vOb8N9oQUMETHuwwxKw==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -860,10 +791,6 @@ packages: resolution: {integrity: sha512-9/2VUPitAjmBzbvDvqrxmvB7BzWsBW0WmkkojX1ODuxX1NLGxx9gfaZpHB0z8DtJ9uhGNmZG/VXBhf8uO0OV8Q==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/globals@30.5.0': - resolution: {integrity: sha512-h7eJx534czwL8lQMYB0hwLT4/HquO8EX/RtYL7RNUHyUyWWVciYjoudN4Ns5JmNvn2/jh0Vm9UstZjEzJJ5EsQ==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/globals@30.5.2': resolution: {integrity: sha512-62zfS+dL+M5aTNHXCNLyqD+j4oqxTIzDYrZbpqMP8Yn+gvlAGyzC6BSPNb1ZmFOakV1RtFYX/O3FCQXSWmQdgg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -885,10 +812,6 @@ packages: resolution: {integrity: sha512-/hunigyNpc4RCjC0VaW3f5RCUZVM2+WQ65qP7z083Gmvac7or2LI50XVNOtE4YPgBpV0yxYiAgorAPGniCoJmg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/snapshot-utils@30.5.0': - resolution: {integrity: sha512-iWQtIsi2dRsO2oWzVceOeynuRJiYTW8gsDVp5wFQ02ipHluQsNgBpasWSHiawVxukIlsGLdCtCSbIEK7fPtpvQ==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/snapshot-utils@30.5.1': resolution: {integrity: sha512-V3wnxNtiVmw5PPVg433Cn3VdXnsOeu/ofLw3KC04Bn2y1wIlU5kozXQn48rhrgj/02LrCVtntTEF1yBha0XSUw==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -905,18 +828,10 @@ packages: resolution: {integrity: sha512-bmij8jZyYAC47ExT2GeP7PcrlwSNS+Bp3KeRuBH88gpcxqDv6fljN8PemS4J/lLZ79xb6mpaennQTTq0zUAVVg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/transform@30.5.0': - resolution: {integrity: sha512-n1cYhoByyULEIXi64wbT4Lq91qeT1E6bwpM//sprFXhw955qaiHTdAmy1c1rNFGB6fCf1J+nxDUSf3RGwgZP5A==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/transform@30.5.2': resolution: {integrity: sha512-LBGwmaE886C41jDZ65eqR1YbXM7642MK3ZhTowZd5+xDlrDLuf4ePuDdDmVSvcr8NTVJ3MqxLkMbUCzuigUaoQ==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/types@30.5.0': - resolution: {integrity: sha512-s1N+79S4Yp9ZgklCauZXi+YPJdCdtStNYQT32stuD6EeQaIBGHoUfyj2P0YWy8RmuQfaJboO+ulxEvEheR/POQ==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - '@jest/types@30.5.1': resolution: {integrity: sha512-LvVYn83nnXPl+Rg98nvcFgjx6nRMTArhSn6RAX/w3ELn54S8A42TYZvsCMdGUqTM8S0wyXbtlQdU6Hi6dykj9g==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -1516,12 +1431,6 @@ packages: core-js@3.43.0: resolution: {integrity: sha512-N6wEbTTZSYOY2rYAn85CuvWWkCK6QweMn7/4Nr3w+gDBeBhk/x4EJeY6FPo4QzDoJZxVTv8U7CMvgWk6pOHHqA==} - core-js@3.44.0: - resolution: {integrity: sha512-aFCtd4l6GvAXwVEh3XbbVqJGHDJt0OZRa+5ePGx3LLwi12WfexqQxcsohb2wgsa/92xtl19Hd66G/L+TaAxDMw==} - - core-js@3.45.1: - resolution: {integrity: sha512-L4NPsJlCfZsPeXukyzHFlg/i7IIVwHSItR0wg0FLNqYClJ4MQYTYLbC7EkjKYRLZF2iof2MUgN0EGy7MdQFChg==} - core-js@3.49.0: resolution: {integrity: sha512-es1U2+YTtzpwkxVLwAFdSpaIMyQaq0PBgm3YD1W3Qpsn1NAmO3KSgZfu+oGSWVu6NvLHoHCV/aYcsE5wiB7ALg==} @@ -1738,10 +1647,6 @@ packages: resolution: {integrity: sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ==} engines: {node: '>= 0.8.0'} - expect@30.5.0: - resolution: {integrity: sha512-8fiMWcEjPU7B9nErC4FtFcCzf2tC6I75Qf7m8wzBAWC2taZmcno3yAFEjIQL34SwoGZNgPf63UDiJLyh4SMPaw==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - expect@30.5.2: resolution: {integrity: sha512-0LNuMvs8/5mRYhnCR4k+lGV7fqPMs6Bnksda4S3zsCUmdxBpAn4zU4NNzXdq1pMKe/H4W5t/zVIDSJ/H3e0vDA==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -2150,10 +2055,6 @@ packages: ts-node: optional: true - jest-diff@30.5.0: - resolution: {integrity: sha512-QjCfDMwdPFvLxTQmS4/Dswx3PUCiqmSXVLGljMC3SU7YG1qHVoR6b86IH/O2G9k9OMyKXz2vS2Q60VnAozNDwA==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-diff@30.5.2: resolution: {integrity: sha512-rBtHnI6BWTiWj3lM7fOLVfChx7R9B0u9VV3PRHawKs79x6ZjW1QoSrKenaigNGWlvhtoi2BqvDbABDie+Os3xQ==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -2170,10 +2071,6 @@ packages: resolution: {integrity: sha512-Ciz4KgTGIbojxSKpuFImgWJj5EyqfE8xMq9NxWmOXnQywHHS03H9Mv+vaCB29J5pr3JBrY27WbRV18rBdjh8Dg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-haste-map@30.5.0: - resolution: {integrity: sha512-0FStogBslBVOEqTOJr4oXMtFitmrWp9WscG6Gbns88i0YAuMXijCT2G5VMfg/HCR4QAnL+OF2C2ednag+HlDuA==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-haste-map@30.5.1: resolution: {integrity: sha512-VIFgt67jW480YDxKfEv9IYQKrFpYt7bOCMn3VsnjK7AK9qo7p6acpnA1DHwsVOULE3dTaYew/6JaTD/d0VDHoQ==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -2182,26 +2079,14 @@ packages: resolution: {integrity: sha512-gt4GT2aWgEoCNTcBe4rqS74xTIUJxi+UD9SNSu9aOk5LmTEd6fS5KSTmAKAfitCCktQHNN+upUuL6EkBfFbMDQ==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-matcher-utils@30.5.0: - resolution: {integrity: sha512-EfaYMC9f9ds7fahB/LYFTgd1Z2RS9Vpm2e46gazij0onkpoQG7Daq+MLm8/gQVqWwRVjL/RNDggbFx9MsrJEmQ==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-matcher-utils@30.5.2: resolution: {integrity: sha512-lFkB365PTIHOhPzwrb9T6gvlDnPpOZ7/c3ewOKKB7bzztqjVrtlyRL2MkyfJXpyY2u2SKw001JKrTx14fBUFcQ==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-message-util@30.5.0: - resolution: {integrity: sha512-dBYMhplGfspKaCnVk9TUy1cZnknWubpuPNEputjz0YJk1G/92R45rn45BvbPMPMtC5LVcIdxJGPOaOSQTiuzJw==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-message-util@30.5.1: resolution: {integrity: sha512-UdQlLdd9wL/Ys7xRErckqwD6wPlSZYueosSWuHc1r2ztGLwlgPvtSJq2+BPEgaEY13WLvfFbmhTj8pba0Sd1jg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-mock@30.5.0: - resolution: {integrity: sha512-bP5MHZpkYrV7xpV+yvhl36DPcXoEmTR57Un5EACcdVpMY7mpkDefCBq+V4mhcjE/3rwUajT6OTrcJTN7EwN1BA==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-mock@30.5.2: resolution: {integrity: sha512-KTHb37Fhj8xY8qPFvTFaFJHcdsumQp+ExsUlgoX232Agmc706gagBs53+CYvulV7MVQo9AgXOUxsqzzVBoJlrA==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -2226,18 +2111,10 @@ packages: resolution: {integrity: sha512-0paUAHBlheai10A3XSy9Xh+YBG0IROy+/qzcDPzQ/nbbXrznQzeWy5qniICWK6d3W3scaRQCVAbXdcK0ibBq4w==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-snapshot@30.5.0: - resolution: {integrity: sha512-pZWETdcqmKve9MDTE/AX6RaeAbRhzKhhAXGozAW8Pg2FfOSdUrQ/7D+VdwE3fLQsqjpITXJVQvYVZoMEzrUl0Q==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-snapshot@30.5.2: resolution: {integrity: sha512-jKIdes25AnAH73dOCi2qE6J6vHJ6L2vyBS11M89kT50DVJcLTf2AOjvcc+2vVaN8lUbY5v2R83aqXo3Ro9fqYA==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-util@30.5.0: - resolution: {integrity: sha512-lzU4aGUWaS+2X/B0CmgheDasfnsVlRfZh/rNQxB9b9s8cSYUq5BcqdQA95ld+KqJXBUVVt1sqnMQ2T3OxIalmg==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-util@30.5.1: resolution: {integrity: sha512-yKuxmNy2rSbTXw+3SIPanJo+nV4/BS1p26v44IYBFMsswSQySfMMcPHErnOncda7i9HEz0q605rIhSTBVgrZTg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -2250,10 +2127,6 @@ packages: resolution: {integrity: sha512-rqRgg4R11GA9m1UsEZwQeixHsgZReCn6TOHAHtIH33yXrIvoX0OGPA20Yzzjkz7X40fZvcRSxEpQppYPcWzmcQ==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-worker@30.5.0: - resolution: {integrity: sha512-7kFk/607EoynNHLJa20daivkElM+c9PrCLduYy6AlMkYrXbh5TmVtW1BLXE05Y8baAFsJHMoC3xs2QRRTotwLw==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - jest-worker@30.5.1: resolution: {integrity: sha512-Cbxh5v7AoLuFRmFJSM4/aHdQ68rjXvUWr716EE0Dh3I7T+T/3FgFKhOERGXHcU2Meftq9+9zxPM3TSNyI9D+HA==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -2555,10 +2428,6 @@ packages: engines: {node: '>=14'} hasBin: true - pretty-format@30.5.0: - resolution: {integrity: sha512-mzNzBErpHwM0zpmWS7ExOv62yhQhvd546nUuFqVR0dmnJB59tfrw9sjDF0DJknwsr59OXP0buwJ7PaKguczHSg==} - engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} - pretty-format@30.5.1: resolution: {integrity: sha512-byhRAPguVKMQIj4kjJwJ5lAskVhfuiSdiYl/aLTWpgkGEmic2jYhJh1yE9ih8Ox44Xg9ccCT11/S6QrzSJuNrg==} engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} @@ -2971,14 +2840,14 @@ snapshots: '@babel/core@7.29.7': dependencies: '@babel/code-frame': 7.29.7 - '@babel/generator': 7.29.8 + '@babel/generator': 7.29.12 '@babel/helper-compilation-targets': 7.29.7 '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) '@babel/helpers': 7.29.7 - '@babel/parser': 7.29.8 + '@babel/parser': 7.29.12 '@babel/template': 7.29.7 - '@babel/traverse': 7.29.8 - '@babel/types': 7.29.8 + '@babel/traverse': 7.29.12 + '@babel/types': 7.29.11 '@jridgewell/remapping': 2.3.5 convert-source-map: 2.0.0 debug: 4.4.3 @@ -2996,14 +2865,6 @@ snapshots: '@jridgewell/trace-mapping': 0.3.31 jsesc: 3.1.0 - '@babel/generator@7.29.8': - dependencies: - '@babel/parser': 7.29.8 - '@babel/types': 7.29.8 - '@jridgewell/gen-mapping': 0.3.13 - '@jridgewell/trace-mapping': 0.3.31 - jsesc: 3.1.0 - '@babel/helper-annotate-as-pure@7.29.7': dependencies: '@babel/types': 7.29.11 @@ -3029,19 +2890,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/helper-create-class-features-plugin@7.29.7(@babel/core@7.29.7)': - dependencies: - '@babel/core': 7.29.7 - '@babel/helper-annotate-as-pure': 7.29.7 - '@babel/helper-member-expression-to-functions': 7.29.7 - '@babel/helper-optimise-call-expression': 7.29.7 - '@babel/helper-replace-supers': 7.29.7(@babel/core@7.29.7) - '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 - '@babel/traverse': 7.29.8 - semver: 6.3.1 - transitivePeerDependencies: - - supports-color - '@babel/helper-create-regexp-features-plugin@7.29.7(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 @@ -3064,15 +2912,15 @@ snapshots: '@babel/helper-member-expression-to-functions@7.29.7': dependencies: - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 '@babel/types': 7.29.11 transitivePeerDependencies: - supports-color '@babel/helper-module-imports@7.29.7': dependencies: - '@babel/traverse': 7.29.8 - '@babel/types': 7.29.8 + '@babel/traverse': 7.29.12 + '@babel/types': 7.29.11 transitivePeerDependencies: - supports-color @@ -3081,7 +2929,7 @@ snapshots: '@babel/core': 7.29.7 '@babel/helper-module-imports': 7.29.7 '@babel/helper-validator-identifier': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3096,7 +2944,7 @@ snapshots: '@babel/core': 7.29.7 '@babel/helper-annotate-as-pure': 7.29.7 '@babel/helper-wrap-function': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3105,21 +2953,19 @@ snapshots: '@babel/core': 7.29.7 '@babel/helper-member-expression-to-functions': 7.29.7 '@babel/helper-optimise-call-expression': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color '@babel/helper-skip-transparent-expression-wrappers@7.29.7': dependencies: - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 '@babel/types': 7.29.11 transitivePeerDependencies: - supports-color '@babel/helper-string-parser@7.29.11': {} - '@babel/helper-string-parser@7.29.7': {} - '@babel/helper-validator-identifier@7.29.7': {} '@babel/helper-validator-option@7.29.7': {} @@ -3127,7 +2973,7 @@ snapshots: '@babel/helper-wrap-function@7.29.7': dependencies: '@babel/template': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 '@babel/types': 7.29.11 transitivePeerDependencies: - supports-color @@ -3135,7 +2981,7 @@ snapshots: '@babel/helpers@7.29.7': dependencies: '@babel/template': 7.29.7 - '@babel/types': 7.29.8 + '@babel/types': 7.29.11 '@babel/node@7.29.7(@babel/core@7.29.7)': dependencies: @@ -3151,19 +2997,11 @@ snapshots: dependencies: '@babel/types': 7.29.11 - '@babel/parser@7.29.8': - dependencies: - '@babel/types': 7.29.8 - - '@babel/parser@7.29.9': - dependencies: - '@babel/types': 7.29.11 - '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.29.7(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3198,7 +3036,7 @@ snapshots: dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3210,21 +3048,25 @@ snapshots: dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-import-assertions@7.29.7(@babel/core@7.29.7)': dependencies: @@ -3240,11 +3082,13 @@ snapshots: dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7)': dependencies: @@ -3255,41 +3099,49 @@ snapshots: dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 + optional: true '@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7)': dependencies: @@ -3312,7 +3164,7 @@ snapshots: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 '@babel/helper-remap-async-to-generator': 7.29.7(@babel/core@7.29.7) - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3338,7 +3190,7 @@ snapshots: '@babel/plugin-transform-class-properties@7.29.7(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 - '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.29.7) + '@babel/helper-create-class-features-plugin': 7.29.12(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.29.7 transitivePeerDependencies: - supports-color @@ -3346,7 +3198,7 @@ snapshots: '@babel/plugin-transform-class-static-block@7.29.7(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 - '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.29.7) + '@babel/helper-create-class-features-plugin': 7.29.12(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.29.7 transitivePeerDependencies: - supports-color @@ -3359,7 +3211,7 @@ snapshots: '@babel/helper-globals': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 '@babel/helper-replace-supers': 7.29.7(@babel/core@7.29.7) - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3373,7 +3225,7 @@ snapshots: dependencies: '@babel/core': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3430,7 +3282,7 @@ snapshots: '@babel/core': 7.29.7 '@babel/helper-compilation-targets': 7.29.7 '@babel/helper-plugin-utils': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3476,7 +3328,7 @@ snapshots: '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.29.7 '@babel/helper-validator-identifier': 7.29.7 - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3516,7 +3368,7 @@ snapshots: '@babel/helper-plugin-utils': 7.29.7 '@babel/plugin-transform-destructuring': 7.29.7(@babel/core@7.29.7) '@babel/plugin-transform-parameters': 7.29.7(@babel/core@7.29.7) - '@babel/traverse': 7.29.8 + '@babel/traverse': 7.29.12 transitivePeerDependencies: - supports-color @@ -3549,7 +3401,7 @@ snapshots: '@babel/plugin-transform-private-methods@7.29.7(@babel/core@7.29.7)': dependencies: '@babel/core': 7.29.7 - '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.29.7) + '@babel/helper-create-class-features-plugin': 7.29.12(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.29.7 transitivePeerDependencies: - supports-color @@ -3558,7 +3410,7 @@ snapshots: dependencies: '@babel/core': 7.29.7 '@babel/helper-annotate-as-pure': 7.29.7 - '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.29.7) + '@babel/helper-create-class-features-plugin': 7.29.12(@babel/core@7.29.7) '@babel/helper-plugin-utils': 7.29.7 transitivePeerDependencies: - supports-color @@ -3753,8 +3605,8 @@ snapshots: '@babel/template@7.29.7': dependencies: '@babel/code-frame': 7.29.7 - '@babel/parser': 7.29.8 - '@babel/types': 7.29.8 + '@babel/parser': 7.29.12 + '@babel/types': 7.29.11 '@babel/traverse@7.29.12': dependencies: @@ -3768,29 +3620,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/traverse@7.29.8': - dependencies: - '@babel/code-frame': 7.29.7 - '@babel/generator': 7.29.8 - '@babel/helper-globals': 7.29.7 - '@babel/parser': 7.29.8 - '@babel/template': 7.29.7 - '@babel/types': 7.29.8 - debug: 4.4.3 - transitivePeerDependencies: - - supports-color - '@babel/types@7.29.11': dependencies: '@babel/helper-string-parser': 7.29.11 '@babel/helper-validator-identifier': 7.29.7 - '@babel/types@7.29.8': - dependencies: - '@babel/helper-string-parser': 7.29.7 - '@babel/helper-validator-identifier': 7.29.7 - - '@bcoe/v8-coverage@0.2.3': {} + '@bcoe/v8-coverage@0.2.3': + optional: true '@eslint-community/eslint-utils@4.4.0(eslint@9.31.0)': dependencies: @@ -3843,15 +3679,6 @@ snapshots: '@eslint/core': 0.15.1 levn: 0.4.1 - '@exercism/babel-preset-javascript@0.7.0': - dependencies: - '@babel/core': 7.29.7 - '@babel/node': 7.29.7(@babel/core@7.29.7) - '@babel/preset-env': 7.29.7(@babel/core@7.29.7) - core-js: 3.45.1 - transitivePeerDependencies: - - supports-color - '@exercism/babel-preset-typescript@0.7.0': dependencies: '@babel/core': 7.29.7 @@ -3898,6 +3725,7 @@ snapshots: strip-ansi-cjs: strip-ansi@6.0.1 wrap-ansi: 8.1.0 wrap-ansi-cjs: wrap-ansi@7.0.0 + optional: true '@istanbuljs/load-nyc-config@1.1.0': dependencies: @@ -3906,8 +3734,10 @@ snapshots: get-package-type: 0.1.0 js-yaml: 3.15.2 resolve-from: 5.0.0 + optional: true - '@istanbuljs/schema@0.1.6': {} + '@istanbuljs/schema@0.1.6': + optional: true '@jest/console@30.5.2': dependencies: @@ -3953,53 +3783,29 @@ snapshots: - esbuild-register - supports-color - ts-node + optional: true '@jest/diff-sequences@30.5.0': {} - '@jest/environment@30.5.0': - dependencies: - '@jest/fake-timers': 30.5.0 - '@jest/types': 30.5.0 - '@types/node': 22.16.5 - jest-mock: 30.5.0 - '@jest/environment@30.5.2': dependencies: '@jest/fake-timers': 30.5.2 '@jest/types': 30.5.1 '@types/node': 22.16.5 jest-mock: 30.5.2 - - '@jest/expect-utils@30.5.0': - dependencies: - '@jest/get-type': 30.5.0 + optional: true '@jest/expect-utils@30.5.2': dependencies: '@jest/get-type': 30.5.0 - '@jest/expect@30.5.0': - dependencies: - expect: 30.5.0 - jest-snapshot: 30.5.0 - transitivePeerDependencies: - - supports-color - '@jest/expect@30.5.2': dependencies: expect: 30.5.2 jest-snapshot: 30.5.2 transitivePeerDependencies: - supports-color - - '@jest/fake-timers@30.5.0': - dependencies: - '@jest/types': 30.5.0 - '@sinonjs/fake-timers': 15.4.0 - '@types/node': 22.16.5 - jest-message-util: 30.5.0 - jest-mock: 30.5.0 - jest-util: 30.5.0 + optional: true '@jest/fake-timers@30.5.2': dependencies: @@ -4009,18 +3815,10 @@ snapshots: jest-message-util: 30.5.1 jest-mock: 30.5.2 jest-util: 30.5.1 + optional: true '@jest/get-type@30.5.0': {} - '@jest/globals@30.5.0': - dependencies: - '@jest/environment': 30.5.0 - '@jest/expect': 30.5.0 - '@jest/types': 30.5.0 - jest-mock: 30.5.0 - transitivePeerDependencies: - - supports-color - '@jest/globals@30.5.2': dependencies: '@jest/environment': 30.5.2 @@ -4029,6 +3827,7 @@ snapshots: jest-mock: 30.5.2 transitivePeerDependencies: - supports-color + optional: true '@jest/pattern@30.5.0': dependencies: @@ -4062,24 +3861,19 @@ snapshots: v8-to-istanbul: 9.3.0 transitivePeerDependencies: - supports-color + optional: true '@jest/schemas@30.5.0': dependencies: '@sinclair/typebox': 0.34.52 - '@jest/snapshot-utils@30.5.0': - dependencies: - '@jest/types': 30.5.0 - chalk: 4.1.2 - graceful-fs: 4.2.11 - natural-compare: 1.4.0 - '@jest/snapshot-utils@30.5.1': dependencies: '@jest/types': 30.5.1 chalk: 4.1.2 graceful-fs: 4.2.11 natural-compare: 1.4.0 + optional: true '@jest/source-map@30.5.2': dependencies: @@ -4087,6 +3881,7 @@ snapshots: callsites: 3.1.0 convert-source-map: 2.0.0 graceful-fs: 4.2.11 + optional: true '@jest/test-result@30.5.2': dependencies: @@ -4094,6 +3889,7 @@ snapshots: '@jest/types': 30.5.1 '@types/istanbul-lib-coverage': 2.0.6 collect-v8-coverage: 1.0.3 + optional: true '@jest/test-sequencer@30.5.2': dependencies: @@ -4101,25 +3897,7 @@ snapshots: graceful-fs: 4.2.11 jest-haste-map: 30.5.1 slash: 3.0.0 - - '@jest/transform@30.5.0': - dependencies: - '@babel/core': 7.29.7 - '@jest/types': 30.5.0 - '@jridgewell/trace-mapping': 0.3.31 - babel-plugin-istanbul: 8.0.0 - chalk: 4.1.2 - convert-source-map: 2.0.0 - fast-json-stable-stringify: 2.1.0 - graceful-fs: 4.2.11 - jest-haste-map: 30.5.0 - jest-regex-util: 30.5.0 - jest-util: 30.5.0 - pirates: 4.0.7 - slash: 3.0.0 - write-file-atomic: 5.0.1 - transitivePeerDependencies: - - supports-color + optional: true '@jest/transform@30.5.2': dependencies: @@ -4139,16 +3917,7 @@ snapshots: write-file-atomic: 5.0.1 transitivePeerDependencies: - supports-color - - '@jest/types@30.5.0': - dependencies: - '@jest/pattern': 30.5.0 - '@jest/schemas': 30.5.0 - '@types/istanbul-lib-coverage': 2.0.6 - '@types/istanbul-reports': 3.0.4 - '@types/node': 22.16.5 - '@types/yargs': 17.0.35 - chalk: 4.1.2 + optional: true '@jest/types@30.5.1': dependencies: @@ -4246,21 +4015,25 @@ snapshots: '@parcel/watcher-linux-x64-musl': 2.6.0 '@parcel/watcher-win32-arm64': 2.6.0 '@parcel/watcher-win32-x64': 2.6.0 + optional: true '@pkgjs/parseargs@0.11.0': optional: true - '@pkgr/core@0.3.6': {} + '@pkgr/core@0.3.6': + optional: true '@sinclair/typebox@0.34.52': {} '@sinonjs/commons@3.0.1': dependencies: type-detect: 4.0.8 + optional: true '@sinonjs/fake-timers@15.4.0': dependencies: '@sinonjs/commons': 3.0.1 + optional: true '@tsconfig/node22@22.0.6': {} @@ -4271,19 +4044,23 @@ snapshots: '@types/babel__generator': 7.27.0 '@types/babel__template': 7.4.4 '@types/babel__traverse': 7.28.0 + optional: true '@types/babel__generator@7.27.0': dependencies: '@babel/types': 7.29.11 + optional: true '@types/babel__template@7.4.4': dependencies: '@babel/parser': 7.29.12 '@babel/types': 7.29.11 + optional: true '@types/babel__traverse@7.28.0': dependencies: '@babel/types': 7.29.11 + optional: true '@types/estree@1.0.8': {} @@ -4447,7 +4224,8 @@ snapshots: '@typescript-eslint/types': 8.37.0 eslint-visitor-keys: 4.2.1 - '@ungap/structured-clone@1.4.0': {} + '@ungap/structured-clone@1.4.0': + optional: true '@unrs/resolver-binding-android-arm-eabi@1.13.0': optional: true @@ -4528,10 +4306,13 @@ snapshots: ansi-escapes@4.3.2: dependencies: type-fest: 0.21.3 + optional: true - ansi-regex@5.0.1: {} + ansi-regex@5.0.1: + optional: true - ansi-regex@6.5.0: {} + ansi-regex@6.5.0: + optional: true ansi-styles@4.3.0: dependencies: @@ -4539,16 +4320,19 @@ snapshots: ansi-styles@5.2.0: {} - ansi-styles@6.2.3: {} + ansi-styles@6.2.3: + optional: true anymatch@3.1.3: dependencies: normalize-path: 3.0.0 picomatch: 2.3.2 + optional: true argparse@1.0.10: dependencies: sprintf-js: 1.0.3 + optional: true argparse@2.0.1: {} @@ -4598,6 +4382,7 @@ snapshots: slash: 3.0.0 transitivePeerDependencies: - supports-color + optional: true babel-plugin-istanbul@8.0.0: dependencies: @@ -4608,10 +4393,12 @@ snapshots: test-exclude: 7.0.2 transitivePeerDependencies: - supports-color + optional: true babel-plugin-jest-hoist@30.5.0: dependencies: '@types/babel__core': 7.20.5 + optional: true babel-plugin-polyfill-corejs2@0.4.17(@babel/core@7.29.7): dependencies: @@ -4655,12 +4442,14 @@ snapshots: '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.29.7) '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.29.7) '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.29.7) + optional: true babel-preset-jest@30.5.0(@babel/core@7.29.7): dependencies: '@babel/core': 7.29.7 babel-plugin-jest-hoist: 30.5.0 babel-preset-current-node-syntax: 1.2.0(@babel/core@7.29.7) + optional: true balanced-match@1.0.2: {} @@ -4696,6 +4485,7 @@ snapshots: bser@2.1.2: dependencies: node-int64: 0.4.0 + optional: true buffer-from@1.1.2: {} @@ -4718,9 +4508,11 @@ snapshots: callsites@3.1.0: {} - camelcase@5.3.1: {} + camelcase@5.3.1: + optional: true - camelcase@6.3.0: {} + camelcase@6.3.0: + optional: true caniuse-lite@1.0.30001806: {} @@ -4731,17 +4523,20 @@ snapshots: chalk@6.0.1: {} - char-regex@1.0.2: {} + char-regex@1.0.2: + optional: true ci-info@4.4.0: {} - cjs-module-lexer@2.3.0: {} + cjs-module-lexer@2.3.0: + optional: true cliui@8.0.1: dependencies: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 7.0.0 + optional: true clone-deep@4.0.1: dependencies: @@ -4749,9 +4544,11 @@ snapshots: kind-of: 6.0.3 shallow-clone: 3.0.1 - co@4.6.0: {} + co@4.6.0: + optional: true - collect-v8-coverage@1.0.3: {} + collect-v8-coverage@1.0.3: + optional: true color-convert@2.0.1: dependencies: @@ -4773,10 +4570,6 @@ snapshots: core-js@3.43.0: {} - core-js@3.44.0: {} - - core-js@3.45.1: {} - core-js@3.49.0: {} cross-spawn@7.0.6: @@ -4811,11 +4604,13 @@ snapshots: dependencies: ms: 2.1.3 - dedent@1.7.2: {} + dedent@1.7.2: + optional: true deep-is@0.1.4: {} - deepmerge@4.3.1: {} + deepmerge@4.3.1: + optional: true define-data-property@1.1.4: dependencies: @@ -4829,9 +4624,11 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 - detect-libc@2.1.2: {} + detect-libc@2.1.2: + optional: true - detect-newline@3.1.0: {} + detect-newline@3.1.0: + optional: true dir-glob@3.0.1: dependencies: @@ -4843,19 +4640,24 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 - eastasianwidth@0.2.0: {} + eastasianwidth@0.2.0: + optional: true electron-to-chromium@1.5.399: {} - emittery@0.13.1: {} + emittery@0.13.1: + optional: true - emoji-regex@8.0.0: {} + emoji-regex@8.0.0: + optional: true - emoji-regex@9.2.2: {} + emoji-regex@9.2.2: + optional: true error-ex@1.3.4: dependencies: is-arrayish: 0.2.1 + optional: true es-abstract-get@1.0.0: dependencies: @@ -4927,7 +4729,8 @@ snapshots: es-errors@1.3.0: {} - es-module-lexer@2.3.2: {} + es-module-lexer@2.3.2: + optional: true es-object-atoms@1.1.2: dependencies: @@ -5025,7 +4828,8 @@ snapshots: acorn-jsx: 5.3.2(acorn@8.15.0) eslint-visitor-keys: 4.2.1 - esprima@4.0.1: {} + esprima@4.0.1: + optional: true esquery@1.6.0: dependencies: @@ -5051,16 +4855,8 @@ snapshots: signal-exit: 3.0.7 strip-final-newline: 2.0.0 - exit-x@0.2.2: {} - - expect@30.5.0: - dependencies: - '@jest/expect-utils': 30.5.0 - '@jest/get-type': 30.5.0 - jest-matcher-utils: 30.5.0 - jest-message-util: 30.5.0 - jest-mock: 30.5.0 - jest-util: 30.5.0 + exit-x@0.2.2: + optional: true expect@30.5.2: dependencies: @@ -5092,10 +4888,12 @@ snapshots: fb-watchman@2.0.4: dependencies: bser: 2.1.2 + optional: true fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 + optional: true file-entry-cache@8.0.0: dependencies: @@ -5119,6 +4917,7 @@ snapshots: dependencies: locate-path: 5.0.0 path-exists: 4.0.0 + optional: true find-up@5.0.0: dependencies: @@ -5140,6 +4939,7 @@ snapshots: dependencies: cross-spawn: 7.0.6 signal-exit: 4.1.0 + optional: true function-bind@1.1.2: {} @@ -5161,7 +4961,8 @@ snapshots: gensync@1.0.0-beta.2: {} - get-caller-file@2.0.5: {} + get-caller-file@2.0.5: + optional: true get-intrinsic@1.3.0: dependencies: @@ -5176,7 +4977,8 @@ snapshots: hasown: 2.0.4 math-intrinsics: 1.1.0 - get-package-type@0.1.0: {} + get-package-type@0.1.0: + optional: true get-proto@1.0.1: dependencies: @@ -5207,6 +5009,7 @@ snapshots: minipass: 7.1.3 package-json-from-dist: 1.0.1 path-scurry: 1.11.1 + optional: true glob@13.0.6: dependencies: @@ -5264,7 +5067,8 @@ snapshots: dependencies: parse-passwd: 1.0.0 - html-escaper@2.0.2: {} + html-escaper@2.0.2: + optional: true human-signals@2.1.0: {} @@ -5281,6 +5085,7 @@ snapshots: dependencies: pkg-dir: 4.2.0 resolve-cwd: 3.0.0 + optional: true imurmurhash@0.1.4: {} @@ -5296,7 +5101,8 @@ snapshots: call-bound: 1.0.4 get-intrinsic: 1.3.0 - is-arrayish@0.2.1: {} + is-arrayish@0.2.1: + optional: true is-async-function@2.1.1: dependencies: @@ -5342,9 +5148,11 @@ snapshots: dependencies: call-bound: 1.0.4 - is-fullwidth-code-point@3.0.0: {} + is-fullwidth-code-point@3.0.0: + optional: true - is-generator-fn@2.1.0: {} + is-generator-fn@2.1.0: + optional: true is-generator-function@1.1.2: dependencies: @@ -5420,23 +5228,26 @@ snapshots: isobject@3.0.1: {} - istanbul-lib-coverage@3.2.2: {} + istanbul-lib-coverage@3.2.2: + optional: true istanbul-lib-instrument@6.0.3: dependencies: '@babel/core': 7.29.7 - '@babel/parser': 7.29.9 + '@babel/parser': 7.29.12 '@istanbuljs/schema': 0.1.6 istanbul-lib-coverage: 3.2.2 semver: 7.8.5 transitivePeerDependencies: - supports-color + optional: true istanbul-lib-report@3.0.1: dependencies: istanbul-lib-coverage: 3.2.2 make-dir: 4.0.0 supports-color: 7.2.0 + optional: true istanbul-lib-source-maps@5.0.6: dependencies: @@ -5445,23 +5256,27 @@ snapshots: istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color + optional: true istanbul-reports@3.2.0: dependencies: html-escaper: 2.0.2 istanbul-lib-report: 3.0.1 + optional: true jackspeak@3.4.3: dependencies: '@isaacs/cliui': 8.0.2 optionalDependencies: '@pkgjs/parseargs': 0.11.0 + optional: true jest-changed-files@30.5.1: dependencies: execa: 5.1.1 jest-util: 30.5.1 p-limit: 3.1.0 + optional: true jest-circus@30.5.2: dependencies: @@ -5488,6 +5303,7 @@ snapshots: transitivePeerDependencies: - babel-plugin-macros - supports-color + optional: true jest-cli@30.5.2(@types/node@22.16.5): dependencies: @@ -5507,6 +5323,7 @@ snapshots: - esbuild-register - supports-color - ts-node + optional: true jest-config@30.5.2(@types/node@22.16.5): dependencies: @@ -5538,13 +5355,7 @@ snapshots: transitivePeerDependencies: - babel-plugin-macros - supports-color - - jest-diff@30.5.0: - dependencies: - '@jest/diff-sequences': 30.5.0 - '@jest/get-type': 30.5.0 - chalk: 4.1.2 - pretty-format: 30.5.0 + optional: true jest-diff@30.5.2: dependencies: @@ -5556,6 +5367,7 @@ snapshots: jest-docblock@30.5.0: dependencies: detect-newline: 3.1.0 + optional: true jest-each@30.5.2: dependencies: @@ -5565,6 +5377,7 @@ snapshots: jest-regex-util: 30.5.0 jest-util: 30.5.1 pretty-format: 30.5.1 + optional: true jest-environment-node@30.5.2: dependencies: @@ -5575,20 +5388,7 @@ snapshots: jest-mock: 30.5.2 jest-util: 30.5.1 jest-validate: 30.5.1 - - jest-haste-map@30.5.0: - dependencies: - '@jest/types': 30.5.0 - '@parcel/watcher': 2.6.0 - '@types/node': 22.16.5 - anymatch: 3.1.3 - fb-watchman: 2.0.4 - fdir: 6.5.0(picomatch@4.0.7) - graceful-fs: 4.2.11 - jest-regex-util: 30.5.0 - jest-util: 30.5.0 - jest-worker: 30.5.0 - picomatch: 4.0.7 + optional: true jest-haste-map@30.5.1: dependencies: @@ -5603,18 +5403,13 @@ snapshots: jest-util: 30.5.1 jest-worker: 30.5.1 picomatch: 4.0.7 + optional: true jest-leak-detector@30.5.1: dependencies: '@jest/get-type': 30.5.0 pretty-format: 30.5.1 - - jest-matcher-utils@30.5.0: - dependencies: - '@jest/get-type': 30.5.0 - chalk: 4.1.2 - jest-diff: 30.5.0 - pretty-format: 30.5.0 + optional: true jest-matcher-utils@30.5.2: dependencies: @@ -5623,19 +5418,6 @@ snapshots: jest-diff: 30.5.2 pretty-format: 30.5.1 - jest-message-util@30.5.0: - dependencies: - '@babel/code-frame': 7.29.7 - '@jest/types': 30.5.0 - '@types/stack-utils': 2.0.3 - chalk: 4.1.2 - graceful-fs: 4.2.11 - jest-util: 30.5.0 - picomatch: 4.0.7 - pretty-format: 30.5.0 - slash: 3.0.0 - stack-utils: 2.0.6 - jest-message-util@30.5.1: dependencies: '@babel/code-frame': 7.29.7 @@ -5649,13 +5431,6 @@ snapshots: slash: 3.0.0 stack-utils: 2.0.6 - jest-mock@30.5.0: - dependencies: - '@jest/expect-utils': 30.5.0 - '@jest/types': 30.5.0 - '@types/node': 22.16.5 - jest-util: 30.5.0 - jest-mock@30.5.2: dependencies: '@jest/expect-utils': 30.5.2 @@ -5671,6 +5446,7 @@ snapshots: jest-snapshot: 30.5.2 transitivePeerDependencies: - supports-color + optional: true jest-resolve@30.5.1: dependencies: @@ -5681,6 +5457,7 @@ snapshots: jest-validate: 30.5.1 slash: 3.0.0 unrs-resolver: 1.13.0 + optional: true jest-runner@30.5.2: dependencies: @@ -5708,6 +5485,7 @@ snapshots: p-limit: 3.1.0 transitivePeerDependencies: - supports-color + optional: true jest-runtime@30.5.2: dependencies: @@ -5736,32 +5514,7 @@ snapshots: strip-bom: 4.0.0 transitivePeerDependencies: - supports-color - - jest-snapshot@30.5.0: - dependencies: - '@babel/core': 7.29.7 - '@babel/generator': 7.29.8 - '@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.29.7) - '@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.29.7) - '@babel/types': 7.29.8 - '@jest/expect-utils': 30.5.0 - '@jest/get-type': 30.5.0 - '@jest/snapshot-utils': 30.5.0 - '@jest/transform': 30.5.0 - '@jest/types': 30.5.0 - babel-preset-current-node-syntax: 1.2.0(@babel/core@7.29.7) - chalk: 4.1.2 - expect: 30.5.0 - graceful-fs: 4.2.11 - jest-diff: 30.5.0 - jest-matcher-utils: 30.5.0 - jest-message-util: 30.5.0 - jest-util: 30.5.0 - pretty-format: 30.5.0 - semver: 7.8.5 - synckit: 0.11.13 - transitivePeerDependencies: - - supports-color + optional: true jest-snapshot@30.5.2: dependencies: @@ -5788,15 +5541,7 @@ snapshots: synckit: 0.11.13 transitivePeerDependencies: - supports-color - - jest-util@30.5.0: - dependencies: - '@jest/types': 30.5.0 - '@types/node': 22.16.5 - chalk: 4.1.2 - ci-info: 4.4.0 - graceful-fs: 4.2.11 - picomatch: 4.0.7 + optional: true jest-util@30.5.1: dependencies: @@ -5815,6 +5560,7 @@ snapshots: chalk: 4.1.2 leven: 3.1.0 pretty-format: 30.5.1 + optional: true jest-watcher@30.5.2: dependencies: @@ -5826,14 +5572,7 @@ snapshots: emittery: 0.13.1 jest-util: 30.5.1 string-length: 4.0.2 - - jest-worker@30.5.0: - dependencies: - '@types/node': 22.16.5 - '@ungap/structured-clone': 1.4.0 - jest-util: 30.5.0 - merge-stream: 2.0.0 - supports-color: 8.1.1 + optional: true jest-worker@30.5.1: dependencies: @@ -5842,6 +5581,7 @@ snapshots: jest-util: 30.5.1 merge-stream: 2.0.0 supports-color: 8.1.1 + optional: true jest@30.5.2(@types/node@22.16.5): dependencies: @@ -5855,6 +5595,7 @@ snapshots: - esbuild-register - supports-color - ts-node + optional: true js-tokens@4.0.0: {} @@ -5862,6 +5603,7 @@ snapshots: dependencies: argparse: 1.0.10 esprima: 4.0.1 + optional: true js-yaml@4.1.0: dependencies: @@ -5871,7 +5613,8 @@ snapshots: json-buffer@3.0.1: {} - json-parse-even-better-errors@2.3.1: {} + json-parse-even-better-errors@2.3.1: + optional: true json-schema-traverse@0.4.1: {} @@ -5885,14 +5628,16 @@ snapshots: kind-of@6.0.3: {} - leven@3.1.0: {} + leven@3.1.0: + optional: true levn@0.4.1: dependencies: prelude-ls: 1.2.1 type-check: 0.4.0 - lines-and-columns@1.2.4: {} + lines-and-columns@1.2.4: + optional: true locate-path@3.0.0: dependencies: @@ -5902,6 +5647,7 @@ snapshots: locate-path@5.0.0: dependencies: p-locate: 4.1.0 + optional: true locate-path@6.0.0: dependencies: @@ -5911,7 +5657,8 @@ snapshots: lodash.merge@4.6.2: {} - lru-cache@10.4.3: {} + lru-cache@10.4.3: + optional: true lru-cache@11.5.3: {} @@ -5927,6 +5674,7 @@ snapshots: make-dir@4.0.0: dependencies: semver: 7.8.5 + optional: true math-intrinsics@1.1.0: {} @@ -5957,22 +5705,26 @@ snapshots: ms@2.1.3: {} - napi-postinstall@0.3.7: {} + napi-postinstall@0.3.7: + optional: true natural-compare@1.4.0: {} - node-addon-api@7.1.1: {} + node-addon-api@7.1.1: + optional: true node-environment-flags@1.0.6: dependencies: object.getownpropertydescriptors: 2.1.9 semver: 5.7.2 - node-int64@0.4.0: {} + node-int64@0.4.0: + optional: true node-releases@2.0.51: {} - normalize-path@3.0.0: {} + normalize-path@3.0.0: + optional: true npm-run-path@4.0.1: dependencies: @@ -6036,6 +5788,7 @@ snapshots: p-locate@4.1.0: dependencies: p-limit: 2.3.0 + optional: true p-locate@5.0.0: dependencies: @@ -6055,6 +5808,7 @@ snapshots: error-ex: 1.3.4 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + optional: true parse-passwd@1.0.0: {} @@ -6070,6 +5824,7 @@ snapshots: dependencies: lru-cache: 10.4.3 minipass: 7.1.3 + optional: true path-scurry@2.0.2: dependencies: @@ -6095,6 +5850,7 @@ snapshots: pkg-dir@4.2.0: dependencies: find-up: 4.1.0 + optional: true possible-typed-array-names@1.1.0: {} @@ -6102,13 +5858,6 @@ snapshots: prettier@3.9.10: {} - pretty-format@30.5.0: - dependencies: - '@jest/react-is-18': react-is@18.3.1 - '@jest/react-is-19': react-is@19.3.1 - '@jest/schemas': 30.5.0 - ansi-styles: 5.2.0 - pretty-format@30.5.1: dependencies: '@jest/react-is-18': react-is@18.3.1 @@ -6118,7 +5867,8 @@ snapshots: punycode@2.3.1: {} - pure-rand@7.0.1: {} + pure-rand@7.0.1: + optional: true queue-microtask@1.2.3: {} @@ -6169,15 +5919,18 @@ snapshots: dependencies: jsesc: 3.1.0 - require-directory@2.1.1: {} + require-directory@2.1.1: + optional: true resolve-cwd@3.0.0: dependencies: resolve-from: 5.0.0 + optional: true resolve-from@4.0.0: {} - resolve-from@5.0.0: {} + resolve-from@5.0.0: + optional: true resolve@1.22.12: dependencies: @@ -6289,7 +6042,8 @@ snapshots: signal-exit@3.0.7: {} - signal-exit@4.1.0: {} + signal-exit@4.1.0: + optional: true slash@3.0.0: {} @@ -6300,7 +6054,8 @@ snapshots: source-map@0.6.1: {} - sprintf-js@1.0.3: {} + sprintf-js@1.0.3: + optional: true stack-utils@2.0.6: dependencies: @@ -6315,18 +6070,21 @@ snapshots: dependencies: char-regex: 1.0.2 strip-ansi: 6.0.1 + optional: true string-width@4.2.3: dependencies: emoji-regex: 8.0.0 is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 + optional: true string-width@5.1.2: dependencies: eastasianwidth: 0.2.0 emoji-regex: 9.2.2 strip-ansi: 7.2.0 + optional: true string.prototype.trim@1.2.11: dependencies: @@ -6355,12 +6113,15 @@ snapshots: strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 + optional: true strip-ansi@7.2.0: dependencies: ansi-regex: 6.5.0 + optional: true - strip-bom@4.0.0: {} + strip-bom@4.0.0: + optional: true strip-final-newline@2.0.0: {} @@ -6373,18 +6134,21 @@ snapshots: supports-color@8.1.1: dependencies: has-flag: 4.0.0 + optional: true supports-preserve-symlinks-flag@1.0.0: {} synckit@0.11.13: dependencies: '@pkgr/core': 0.3.6 + optional: true test-exclude@7.0.2: dependencies: '@istanbuljs/schema': 0.1.6 glob: 10.5.0 minimatch: 10.2.6 + optional: true to-regex-range@5.0.1: dependencies: @@ -6402,9 +6166,11 @@ snapshots: dependencies: prelude-ls: 1.2.1 - type-detect@4.0.8: {} + type-detect@4.0.8: + optional: true - type-fest@0.21.3: {} + type-fest@0.21.3: + optional: true typed-array-buffer@1.0.3: dependencies: @@ -6497,6 +6263,7 @@ snapshots: '@unrs/resolver-binding-win32-arm64-msvc': 1.13.0 '@unrs/resolver-binding-win32-ia32-msvc': 1.13.0 '@unrs/resolver-binding-win32-x64-msvc': 1.13.0 + optional: true update-browserslist-db@1.2.3(browserslist@4.28.7): dependencies: @@ -6513,6 +6280,7 @@ snapshots: '@jridgewell/trace-mapping': 0.3.31 '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 + optional: true v8flags@3.2.0: dependencies: @@ -6570,23 +6338,28 @@ snapshots: ansi-styles: 4.3.0 string-width: 4.2.3 strip-ansi: 6.0.1 + optional: true wrap-ansi@8.1.0: dependencies: ansi-styles: 6.2.3 string-width: 5.1.2 strip-ansi: 7.2.0 + optional: true write-file-atomic@5.0.1: dependencies: imurmurhash: 0.1.4 signal-exit: 4.1.0 + optional: true - y18n@5.0.8: {} + y18n@5.0.8: + optional: true yallist@3.1.1: {} - yargs-parser@21.1.1: {} + yargs-parser@21.1.1: + optional: true yargs@17.7.3: dependencies: @@ -6597,5 +6370,6 @@ snapshots: string-width: 4.2.3 y18n: 5.0.8 yargs-parser: 21.1.1 + optional: true yocto-queue@0.1.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml deleted file mode 100644 index 2e35c96b..00000000 --- a/pnpm-workspace.yaml +++ /dev/null @@ -1,2 +0,0 @@ -onlyBuiltDependencies: - - core-js diff --git a/src/jest-globals.mts b/src/jest-globals.mts new file mode 100644 index 00000000..756131c8 --- /dev/null +++ b/src/jest-globals.mts @@ -0,0 +1,238 @@ +// Provides the Jest API used by the track's test files, on top of node:test, +// Jest's own `expect` package and `jest-mock`. setup.mts makes +// `import ... from '@jest/globals'` load this file, and loads it before the +// test file. This file also: +// +// 1. makes the API available as globals, as Jest did. +// 2. replaces `console` with Jest's BufferedConsole, which records each +// message with the stack it came from. The reporter uses that stack to work +// out which test printed the message. +// 3. runs the test file's jest.mock calls before the test file loads, as Jest +// did (see hoistMocks below). +import { BufferedConsole } from '@jest/console' +import { parse } from 'acorn' +import type { Statement } from 'acorn' +import { expect } from 'expect' +import { ModuleMocker } from 'jest-mock' +import fs from 'node:fs' +import { createRequire } from 'node:module' +import { + after, + afterEach as nodeAfterEach, + before, + beforeEach as nodeBeforeEach, + describe as nodeDescribe, + mock, + test as nodeTest, +} from 'node:test' +import { fileURLToPath, pathToFileURL } from 'node:url' +import { getCallSites } from 'node:util' +import { runInThisContext } from 'node:vm' + +/** Collects every console message, for the reporter. */ +export const testConsole = new BufferedConsole() +globalThis.console = testConsole + +// Jest fails a test or hook that takes longer than 5 seconds. +const TIMEOUT = 5000 + +type Callback = (error?: unknown) => void +type Result = Promise | void +type TestFn = (done: Callback) => Result + +// Jest passes a `done` callback to a function that takes an argument, and +// waits for it to be called. Node does the same for a function that takes two +// arguments (the test context, then `done`). +// +// Jest also failed a test that left a rejected promise unhandled. Node only +// does that if it notices the rejection before the test ends, so a test +// without `done` waits for Node to check for unhandled rejections first. +// +// Node's timer for the timeout can fire during that wait, after a slow test +// has already finished. Jest passed such a test, so a test that has used up +// its time skips the wait. +function wrap( + fn: TestFn, + timeout = TIMEOUT +): (context: unknown, done: Callback) => Result { + return fn.length > 0 + ? (_context, done): Result => fn(done) + : async (): Promise => { + const start = performance.now() + await (fn as () => Result)() + if (performance.now() - start < timeout) { + await new Promise((resolve) => { + setImmediate(resolve) + }) + } + } +} + +// Jest reported the test file as failed to run when the solution threw an +// error, or left a rejected promise unhandled, while the files were loading +// (for example at its top level). Node's test runner ignores these errors +// when the tests run in its own process. So we keep them here until the +// tests start, and the reporter reports the first one. +export const loadErrors: unknown[] = [] + +function keepLoadError(error: unknown): void { + loadErrors.push(error) +} + +process.on('uncaughtException', keepLoadError) +process.on('unhandledRejection', keepLoadError) + +// Node runs the first test straight after loading the test file, before it +// reports unhandled rejections. So the first describe or test adds a hook +// that waits for those reports before any test runs. +let waitingForLoadErrors = false + +function waitForLoadErrors(): void { + if (waitingForLoadErrors) { + return + } + waitingForLoadErrors = true + + before(async () => { + await new Promise((resolve) => { + setImmediate(resolve) + }) + process.off('uncaughtException', keepLoadError) + process.off('unhandledRejection', keepLoadError) + }) +} + +export function test(name: string, fn: TestFn, timeout = TIMEOUT): void { + waitForLoadErrors() + void nodeTest(name, { timeout }, wrap(fn, timeout)) +} +test.skip = (name: string, fn: TestFn): void => { + void nodeTest(name, { skip: true }, wrap(fn)) +} + +// bin/prepare.sh turns xtest, xit and xdescribe into test, it and describe in +// the test file, so that every test runs. +export const it = test +export const xtest = test.skip +export const xit = test.skip + +export function describe(name: string, fn: () => void): void { + waitForLoadErrors() + void nodeDescribe(name, () => { + fn() + }) +} +describe.skip = (name: string, fn: () => void): void => { + void nodeDescribe(name, { skip: true }, () => { + fn() + }) +} +export const xdescribe = describe.skip + +export function beforeEach(fn: TestFn, timeout = TIMEOUT): void { + nodeBeforeEach(wrap(fn, timeout), { timeout }) +} +export function afterEach(fn: TestFn, timeout = TIMEOUT): void { + nodeAfterEach(wrap(fn, timeout), { timeout }) +} +export function beforeAll(fn: TestFn, timeout = TIMEOUT): void { + before(wrap(fn, timeout), { timeout }) +} +export function afterAll(fn: TestFn, timeout = TIMEOUT): void { + after(wrap(fn, timeout), { timeout }) +} + +const mocker = new ModuleMocker(globalThis) +const mockedModules = new Set() + +export const jest = { + fn: mocker.fn.bind(mocker), + spyOn: mocker.spyOn.bind(mocker), + mocked: mocker.mocked.bind(mocker), + replaceProperty: mocker.replaceProperty.bind(mocker), + clearAllMocks: mocker.clearAllMocks.bind(mocker), + resetAllMocks: mocker.resetAllMocks.bind(mocker), + restoreAllMocks: mocker.restoreAllMocks.bind(mocker), + + // Replaces a module with the object returned by `factory`. This uses Node's + // mock.module, which needs the --experimental-test-module-mocks flag. + mock(moduleName: string, factory: () => Record): void { + const url = pathToFileURL(createRequire(callerFile()).resolve(moduleName)) + if (mockedModules.has(url.href)) { + // hoistMocks already ran this call, before the test file loaded. + return + } + mockedModules.add(url.href) + + const { default: defaultExport, ...namedExports } = factory() + mock.module(url.href, { defaultExport, namedExports }) + }, +} + +/** The file of the function that called the function calling this one. */ +function callerFile(): string { + // [0] is this function, [1] is its caller, and [2] is the caller's caller. + const file = getCallSites(3)[2]?.scriptName ?? '' + return file.startsWith('file:') ? fileURLToPath(file) : file +} + +export { expect } + +Object.assign(globalThis, { + afterAll, + afterEach, + beforeAll, + beforeEach, + describe, + expect, + it, + jest, + test, + xdescribe, + xit, + xtest, +}) + +// Jest moved each jest.mock call above the imports of the test file (with +// babel-plugin-jest-hoist), so the mock replaced the module before anything +// imported it. Native ES modules load all their imports before any of their +// code runs, which would be too late for the mock. So before Node loads the +// test file, this finds its top-level jest.mock calls with acorn and runs them +// here. As in Jest, a mock factory may only use globals such as `jest`. +function hoistMocks(testFile: string): void { + const source = fs.readFileSync(testFile, 'utf8') + + let body: Statement[] + try { + ;({ body } = parse(source, { + ecmaVersion: 'latest', + sourceType: 'module', + allowHashBang: true, + }) as { body: Statement[] }) + } catch { + // Node will report the syntax error when it loads the test file. + return + } + + const calls = body + .filter( + (statement) => + statement.type === 'ExpressionStatement' && + statement.expression.type === 'CallExpression' && + statement.expression.callee.type === 'MemberExpression' && + statement.expression.callee.object.type === 'Identifier' && + statement.expression.callee.object.name === 'jest' && + statement.expression.callee.property.type === 'Identifier' && + statement.expression.callee.property.name === 'mock' + ) + .map((statement) => source.slice(statement.start, statement.end)) + + if (calls.length > 0) { + // Naming the test file lets jest.mock resolve paths from it. + runInThisContext(calls.join('\n'), { filename: testFile }) + } +} + +if (process.env.TEST_FILE) { + hoistMocks(process.env.TEST_FILE) +} diff --git a/src/jest/setup.ts b/src/jest/setup.ts deleted file mode 100644 index fed1645d..00000000 --- a/src/jest/setup.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This used to be a setup script,b ut we replaced it with -// code in the test-runner. -// -// It's still here, so that if we need it, we don't need to -// reconfigure everything. diff --git a/src/output.ts b/src/output.ts index 8ecf069e..86de565b 100644 --- a/src/output.ts +++ b/src/output.ts @@ -1,16 +1,38 @@ /* eslint-disable @typescript-eslint/naming-convention */ import type { ConsoleBuffer } from '@jest/console' -import type { - AggregatedResult, - AssertionResult, - TestResult, -} from '@jest/test-result' -import type { Config } from '@jest/types' import fs from 'fs' import path from 'path' +import { locateSyntaxError } from './syntax-error' import { parseTests } from './tests' import type { ParsedTests, TestCase } from './tests' +// The parts of Jest's results that this file reads. The reporter builds them +// from the events of Node's test runner. +export interface AssertionResult { + ancestorTitles: string[] + title: string + status: 'passed' | 'failed' | 'pending' | 'skipped' + failureMessages: string[] +} + +export interface TestResult { + testFilePath: string + failureMessage?: string + testExecError?: { message: string } + console?: ConsoleBuffer + testResults: AssertionResult[] +} + +export interface AggregatedResult { + numFailedTests: number + numFailedTestSuites: number + numPassedTests: number + numPendingTests: number + numPendingTestSuites: number + numRuntimeErrorTestSuites: number + testResults: TestResult[] +} + interface OutputInterface { status: 'fail' | 'pass' | 'error' message: string @@ -40,16 +62,13 @@ const OUTPUT_VERSION = 3 export class Output { private readonly results: Partial & Pick - private readonly globalConfig: Config.GlobalConfig private readonly outputFile: string private readonly sources: Record private readonly config: null | ExerciseConfig - constructor(globalConfig: Config.GlobalConfig) { - this.globalConfig = globalConfig + constructor(outputFile: string) { this.results = { tests: [] } - this.outputFile = - this.globalConfig.outputFile ?? path.join(process.cwd(), 'results.json') + this.outputFile = outputFile this.config = findConfig(path.dirname(this.outputFile)) this.sources = {} @@ -61,26 +80,6 @@ export class Output { } public finish(aggregatedResults: AggregatedResult): void { - // If Jest found no test files, report that no tests ran. Checking here - // saves run.sh from starting Jest a second time to list the test files. - // Version 3 output can't have an empty list of tests, so this uses the - // version 1 format, which has no tests key. - if (!this.results.status && aggregatedResults.numTotalTestSuites === 0) { - const artifact = JSON.stringify( - { - version: 1, - status: 'error', - message: - 'The submitted code was not subjected to any type or execution ' + - 'tests. At least one test was expected.', - }, - undefined, - 2 - ) - fs.writeFileSync(this.outputFile, artifact) - return - } - if (!this.results.status) { this.results.status = aggregatedResults.numRuntimeErrorTestSuites === 0 && @@ -215,8 +214,11 @@ export class Output { this.error( sanitizeErrorMessage( specFilePath, - testResult.failureMessage ?? - 'Something went wrong when running the tests.' + locateSyntaxError( + specFilePath, + testResult.failureMessage ?? + 'Something went wrong when running the tests.' + ) ) ) return @@ -318,9 +320,10 @@ function buildOutput( return undefined } + // Frames end in "12)", or in "12" for a function with no name. const messageLoc = { line: Number(line), - column: Number(column.slice(0, column.length - 1)), + column: parseInt(column, 10), } return (foundTest = tests.find(({ testNode }) => { if (messageLoc.line < testNode.loc.start.line) { @@ -427,6 +430,10 @@ function sanitizeErrorMessage(specFilePath: string, message: string): string { path.dirname(process.cwd()), ] + // Stack frames in ES modules name files by URL (file:///...), and Jest's + // code frames shorten that to file:/... + dirs.unshift(...dirs.flatMap((dir) => [`file://${dir}`, `file:${dir}`])) + dirs.forEach((sensitivePath) => { while (message.includes(sensitivePath)) { message = message.replace(sensitivePath, '') diff --git a/src/reporter.mts b/src/reporter.mts new file mode 100644 index 00000000..77ff9c39 --- /dev/null +++ b/src/reporter.mts @@ -0,0 +1,165 @@ +// A reporter for Node's test runner (`node --test --test-reporter`). It +// collects the result of each test from the runner's events, then writes +// results.json through Output, as the Jest reporter did. +// +// bin/run.sh runs the tests with --test-isolation=none, so the tests, +// jest-globals.mjs and this reporter share one process. That lets the reporter +// read the console messages collected by jest-globals.mjs. +// +// Node gives reporters no options, so run.sh passes the test file and the +// results file in the TEST_FILE and RESULTS_FILE environment variables. +import path from 'node:path' +import type { TestEvent } from 'node:test/reporters' +import { fileURLToPath } from 'node:url' +import { inspect } from 'node:util' +import { Output } from './output.js' +import type { AggregatedResult, AssertionResult, TestResult } from './output.js' + +const RUNNER_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url))) + +type TestFailure = Error & { code?: string; failureType?: string } + +export default async function* reporter( + source: AsyncIterable +): AsyncGenerator { + const testFile = process.env.TEST_FILE ?? '' + const output = new Output(process.env.RESULTS_FILE ?? 'results.json') + + const ancestors: string[] = [] + const results: AssertionResult[] = [] + let pendingSuites = 0 + + // Set when the test file can't run: it fails to load, or a describe block + // throws. Jest reported both as a test suite that failed to run. + let failureMessage: string | undefined + + for await (const event of source) { + if (event.type === 'test:start') { + ancestors[event.data.nesting] = event.data.name + } + + if (event.type !== 'test:pass' && event.type !== 'test:fail') { + continue + } + + const { data } = event + const error = + event.type === 'test:fail' + ? (event.data.details.error as TestFailure) + : undefined + + // Node reports a file that fails to load as a failed test, with the + // error itself. Every other failure wraps the error in ERR_TEST_FAILURE. + if (error && error.code !== 'ERR_TEST_FAILURE') { + failureMessage ??= formatError(error, testFile) + continue + } + + // Node reports a test file that defines no tests as one passing test, + // named after the file. Jest reported that the file failed to run. + if (data.nesting === 0 && data.name === data.file) { + failureMessage ??= 'Your test suite must contain at least one test.' + continue + } + + if (data.details.type === 'suite') { + if (data.skip) { + pendingSuites += 1 + } + if (error?.failureType === 'testCodeFailure') { + failureMessage ??= formatError(error, testFile) + } + continue + } + + results.push({ + ancestorTitles: ancestors.slice(0, data.nesting), + title: data.name, + status: data.skip || data.todo ? 'pending' : error ? 'failed' : 'passed', + failureMessages: error ? [formatError(error, testFile)] : [], + }) + } + + // Node loads this reporter before the preloaded setup.mts, so this file + // imports jest-globals.mjs only now, to let setup.mts load it first. + const { loadErrors, testConsole } = await import('./jest-globals.mjs') + + if (loadErrors.length > 0) { + failureMessage ??= formatError(loadErrors[0] as TestFailure, testFile) + } + + const testResult: TestResult = { + testFilePath: testFile, + failureMessage, + console: testConsole.getBuffer(), + testResults: results, + } + + const count = (status: AssertionResult['status']): number => + results.filter((result) => result.status === status).length + + const aggregatedResults: AggregatedResult = { + numFailedTests: count('failed'), + numFailedTestSuites: count('failed') > 0 ? 1 : 0, + numPassedTests: count('passed'), + numPendingTests: count('pending'), + numPendingTestSuites: pendingSuites, + numRuntimeErrorTestSuites: failureMessage ? 1 : 0, + testResults: [testResult], + } + + output.testFinished(testFile, testResult, aggregatedResults) + output.finish(aggregatedResults) + + yield `${aggregatedResults.numPassedTests} passed, ${aggregatedResults.numFailedTests} failed\n` +} + +/** + * Turns an error into a message in the shape Jest gave: the error's own stack, + * without the frames of the test function and the runner. So the message + * keeps the frames in the student's code. + */ +function formatError(error: TestFailure, testFile: string): string { + // Node wraps the error from a failed test or hook in ERR_TEST_FAILURE. + const cause: unknown = error.code === 'ERR_TEST_FAILURE' ? error.cause : error + + if (cause instanceof Error && typeof cause.stack === 'string') { + return cutStack(cause.stack, testFile) + } + + if ( + error.code === 'ERR_TEST_FAILURE' && + error.failureType !== 'testCodeFailure' + ) { + // A timeout, or a test cancelled because its parent failed. The cause is + // Node's message, such as "test timed out after 5000ms". + return String(cause) + } + + return `thrown: ${inspect(cause)}` +} + +function cutStack(stack: string, testFile: string): string { + const lines = stack.split('\n') + const isFrame = (line: string): boolean => /^\s+at /.test(line) + + // Keep the frames up to the first one in Node or in the runner. Then drop + // the frames at the end that are in the test file, which are the test + // function itself. Jest cut the stack at the same place. + let end = lines.findIndex( + (line) => + isFrame(line) && (line.includes('node:') || line.includes(RUNNER_ROOT)) + ) + if (end === -1) { + end = lines.length + } + while ( + end > 0 && + isFrame(lines[end - 1]) && + lines[end - 1].includes(testFile) + ) { + end -= 1 + } + + return lines.slice(0, end).join('\n') +} diff --git a/src/reporter.ts b/src/reporter.ts deleted file mode 100644 index 71f5f3c3..00000000 --- a/src/reporter.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { - TestContext, - Reporter, - ReporterOnStartOptions, - Test, -} from '@jest/reporters' -import type { AggregatedResult, TestResult } from '@jest/test-result' -import type { Config } from '@jest/types' -import { Output } from './output' - -export default class StandardReporter implements Reporter { - private readonly output: Output - - private error: null | Error - - constructor(globalConfig: Config.GlobalConfig) { - this.error = null - this.output = new Output(globalConfig) - } - - public getLastError(): Error | undefined { - if (this.error) { - return this.error - } - } - - public setError(error: Error): void { - this.error = error - this.output.error(error.message) - } - - /** - * @param results - * @param options - */ - public onRunStart( - _results: AggregatedResult, - _options: ReporterOnStartOptions - ): void { - // no-op - } - - /** - * @param test - */ - public onTestStart(test: Test): void { - this.output.testStarted(test.path) - } - - /** - * @param test - * @param testResult - * @param results - */ - public async onTestFileResult( - test: Test, - testResult: TestResult, - results: AggregatedResult - ): Promise { - this.output.testFinished(test.path, testResult, results) - } - - /** - * @param contexts - * @param aggregatedResults - */ - public onRunComplete( - _contexts: Set, - aggregatedResults: AggregatedResult - ): Promise | void { - this.output.finish(aggregatedResults) - } -} diff --git a/src/setup.mts b/src/setup.mts new file mode 100644 index 00000000..55893d2c --- /dev/null +++ b/src/setup.mts @@ -0,0 +1,48 @@ +// Runs the track's Jest-style test files on Node's built-in test runner. +// +// bin/run.sh preloads this file with `node --import`, so it runs before the +// test file loads. Node loads the solution and the test file as they are, as +// native ES modules. Jest used to load every file through Babel first. +// +// This file registers a module hook that does two things: +// +// 1. It makes `import ... from '@jest/globals'` load jest-globals.mjs, which +// provides the Jest API on top of node:test. +// 2. It lets relative imports leave out the `.js` extension, as Jest did +// (`import { twoFer } from './two-fer'`). +// +// Worker threads started by a solution also run this file, because they +// inherit Node's options. They only need the hook, so they don't load the +// Jest API, which would make every worker start much more slowly. +import { registerHooks } from 'node:module' +import { isMainThread } from 'node:worker_threads' + +const jestGlobals = new URL('./jest-globals.mjs', import.meta.url).href + +registerHooks({ + resolve(specifier, context, nextResolve) { + if (specifier === '@jest/globals') { + return { url: jestGlobals, shortCircuit: true } + } + + try { + return nextResolve(specifier, context) + } catch (error) { + if ( + (error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND' && + specifier.startsWith('.') + ) { + return nextResolve(`${specifier}.js`, context) + } + throw error + } + }, +}) + +if (isMainThread) { + // Jest ran with --colors, which makes chalk colour the messages from + // `expect`. Node has no such option, so this adds the flag to the process's + // arguments, where chalk looks for it, before Jest's packages load. + process.argv.push('--colors') + await import(jestGlobals) +} diff --git a/src/syntax-error.ts b/src/syntax-error.ts new file mode 100644 index 00000000..99c6a498 --- /dev/null +++ b/src/syntax-error.ts @@ -0,0 +1,75 @@ +// Node loads the files as native ES modules, so a syntax error comes straight +// from Node, as just "SyntaxError: Unexpected token 'const'", with no file +// name or line. Babel used to name the file and show the line. When the +// message has no file name, we parse the exercise's files with acorn to find +// the error, and report it in the same shape as Babel did: +// +// SyntaxError: /two-fer.js: Unexpected keyword 'const' (1:13) +// +// > 1 | export const const () => { ( +// | ^ +// 2 | + +import fs from 'fs' +import path from 'path' +import { parse } from 'acorn' + +type AcornSyntaxError = SyntaxError & { loc?: { line: number; column: number } } + +export function locateSyntaxError( + specFilePath: string, + message: string +): string { + if ( + !message.includes('SyntaxError: ') || + message.includes('SyntaxError: /') + ) { + return message + } + + const dir = path.dirname(specFilePath) + const files = fs + .readdirSync(dir) + .filter((file) => /\.m?js$/.test(file) && !file.includes('.config.')) + .map((file) => path.join(dir, file)) + .sort((a, b) => Number(a === specFilePath) - Number(b === specFilePath)) + + for (const file of files) { + const source = fs.readFileSync(file, 'utf8') + try { + parse(source, { + ecmaVersion: 'latest', + sourceType: 'module', + allowHashBang: true, + }) + } catch (error) { + const { loc, message: reason } = error as AcornSyntaxError + if (!loc) { + continue + } + return `SyntaxError: ${file}: ${reason}\n\n${codeFrame(source, loc.line, loc.column)}\n` + } + } + + return message +} + +// Shows the lines around the error in the same layout as Babel's code frame. +function codeFrame(source: string, line: number, column: number): string { + const lines = source.split(/\r?\n/) + const first = Math.max(1, line - 2) + const last = Math.min(lines.length, line + 3) + const width = String(last).length + const frame: string[] = [] + + for (let n = first; n <= last; n++) { + const marker = n === line ? '>' : ' ' + const code = lines[n - 1] ? ` ${lines[n - 1]}` : '' + frame.push(` ${marker} ${String(n).padStart(width)} |${code}`) + if (n === line) { + frame.push(` ${' '.repeat(width)} | ${' '.repeat(column)}^`) + } + } + + return frame.join('\n') +} diff --git a/test/fixtures/two-fer/error/empty/expected_results.json b/test/fixtures/two-fer/error/empty/expected_results.json new file mode 100644 index 00000000..edab60d6 --- /dev/null +++ b/test/fixtures/two-fer/error/empty/expected_results.json @@ -0,0 +1,6 @@ +{ + "status": "error", + "message": "/two-fer.spec.js:1\nimport { twoFer } from './two-fer';\n ^^^^^^\nSyntaxError: Named export 'twoFer' not found. The requested module './two-fer' is a CommonJS module, which may not support all module.exports as named exports.\nCommonJS modules can always be imported via the default export, for example using:\n\nimport pkg from './two-fer';\nconst { twoFer } = pkg;\n", + "tests": [], + "version": 3 +} \ No newline at end of file diff --git a/test/fixtures/two-fer/fail/empty/two-fer.js b/test/fixtures/two-fer/error/empty/two-fer.js similarity index 100% rename from test/fixtures/two-fer/fail/empty/two-fer.js rename to test/fixtures/two-fer/error/empty/two-fer.js diff --git a/test/fixtures/two-fer/fail/empty/two-fer.spec.js b/test/fixtures/two-fer/error/empty/two-fer.spec.js similarity index 100% rename from test/fixtures/two-fer/fail/empty/two-fer.spec.js rename to test/fixtures/two-fer/error/empty/two-fer.spec.js diff --git a/test/fixtures/two-fer/error/syntax/expected_results.json b/test/fixtures/two-fer/error/syntax/expected_results.json index 4c3ba28a..8206fd82 100644 --- a/test/fixtures/two-fer/error/syntax/expected_results.json +++ b/test/fixtures/two-fer/error/syntax/expected_results.json @@ -1,6 +1,6 @@ { "status": "error", - "message": "SyntaxError: /two-fer.js: Unexpected keyword 'const'. (1:13)\n\n > 1 | export const const () => { (\n | ^\n 2 |\n", + "message": "SyntaxError: /two-fer.js: Unexpected keyword 'const' (1:13)\n\n > 1 | export const const () => { (\n | ^\n 2 |\n", "tests": [], "version": 3 } \ No newline at end of file diff --git a/test/fixtures/two-fer/fail/empty/expected_results.json b/test/fixtures/two-fer/fail/empty/expected_results.json deleted file mode 100644 index 527649c5..00000000 --- a/test/fixtures/two-fer/fail/empty/expected_results.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "status": "fail", - "tests": [ - { - "name": "twoFer() > no name given", - "status": "fail", - "message": "TypeError: (0 , _twoFer.twoFer) is not a function", - "output": null, - "test_code": "expect(twoFer()).toEqual('One for you, one for me.');" - }, - { - "name": "twoFer() > a name given", - "status": "fail", - "message": "TypeError: (0 , _twoFer.twoFer) is not a function", - "output": null, - "test_code": "const name = 'Alice';\nexpect(twoFer(name)).toEqual('One for Alice, one for me.');" - }, - { - "name": "twoFer() > another name given", - "status": "fail", - "message": "TypeError: (0 , _twoFer.twoFer) is not a function", - "output": null, - "test_code": "const name = 'Bob';\nexpect(twoFer(name)).toEqual('One for Bob, one for me.');" - } - ], - "version": 3 -} \ No newline at end of file diff --git a/test/smoke.test.mjs b/test/smoke.test.mjs index f06cb2b6..e98ec04d 100644 --- a/test/smoke.test.mjs +++ b/test/smoke.test.mjs @@ -35,7 +35,7 @@ shelljs.echo( assertPass('two-fer', join(fixtures, 'two-fer', 'npm')) /** Test failures */ -const failures = ['tests', 'empty'] +const failures = ['tests'] failures.forEach((cause) => { const input = join(fixtures, 'two-fer', 'fail', cause) @@ -51,7 +51,9 @@ failures.forEach((cause) => { }) /** Test errors */ -const errors = ['missing', 'syntax', 'malformed_tests'] +// An empty solution has no twoFer export. Node checks the imports of a native +// ES module before any test runs, so the whole test file fails to run. +const errors = ['empty', 'missing', 'syntax', 'malformed_tests'] errors.forEach((cause) => { const input = join(fixtures, 'two-fer', 'error', cause)