Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type issues with v5.2.0 #503

Merged
merged 7 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion addon-test-support/setup-global-a11y-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { _registerHook, HookUnregister } from '@ember/test-helpers';
import { _registerHook } from '@ember/test-helpers';
import { InvocationStrategy, AuditFunction } from './types';
import { getRunOptions } from './run-options';
import a11yAudit from './audit';
Expand All @@ -24,6 +24,10 @@ type HelperName =
| 'typeIn'
| 'visit';

interface HookUnregister {
unregister: () => void;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the changes in PR #1344, a 2.9.4 release of @ember/test-helpers would allow us to just import registerHook and HookUnregister as official public APIs. Is there a reason why we can't just wait for that release before making these changes? Seems like duplicative work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, I'm trying to migrate an addon to typescript; this PR unblocks that as there is an issue with a reference to ember__test-helpers. Being that the code is already written and ready for merging. Seems like the duplicative work has been done.

Do we know when the PR referenced above will be released? @drewlee

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a question for @chriskrycho, who maintains the @ember/test-helpers releases.

Copy link
Contributor

@drewlee drewlee May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be specific, the duplicative work would entail removing the inline HookUnregister type that's being introduced with this change. Just seems more efficient to incorporate these changes wholesale in accommodating a 2.9.4 release of @ember/test-helpers. We've been aware of the TypeScript bug (see issue #498) and is one of the reasons why the changes were carried out in PR #1344.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I pushed this PR at the suggestion of @chriskrycho. Chris, is there a reason why we cant just release @ember/test-helpers and then update this addon?


let _unregisterHooks: HookUnregister[] = [];

export const DEFAULT_A11Y_TEST_HELPER_NAMES: HelperName[] = [
Expand Down
8 changes: 7 additions & 1 deletion addon-test-support/setup-middleware-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ export async function middlewareReporter(axeResults: AxeResults) {

if (!currentTestResult) {
let { module, testName } = QUnit.config.current;
let testMetaData = getTestMetadata(getContext());
const context = getContext();
if (!context) {
throw new Error(
'You tried to run ember-a11y-testing without calling one of the `setupTest` helpers from `@ember/test-helpers`. Please make sure yoru test setup calls `setupTest()`, `setupRenderingTest()`, or `setupApplicationTest()`!'
);
}
let testMetaData = getTestMetadata(context);

let stack = (!DEBUG && new Error().stack) || '';

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,12 @@
},
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.6.0",
"@ember/test-helpers": "^2.9.3",
"@embroider/test-setup": "^2.0.2",
"@glimmer/component": "^1.0.4",
"@glimmer/tracking": "^1.0.4",
"@types/ember": "^3.16.0",
"@types/ember-qunit": "^3.4.15",
"@types/ember__test-helpers": "2.6.0",
"@types/qunit": "^2.11.3",
"@types/rsvp": "^4.0.3",
"@typescript-eslint/eslint-plugin": "^4.0.0",
Expand Down
35 changes: 0 additions & 35 deletions types/@ember/test-helpers.d.ts

This file was deleted.

121 changes: 77 additions & 44 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1695,16 +1695,18 @@
mkdirp "^1.0.4"
silent-error "^1.1.1"

"@ember/test-helpers@^2.6.0":
version "2.6.0"
resolved "https://registry.yarnpkg.com/@ember/test-helpers/-/test-helpers-2.6.0.tgz#d687515c6ab49ba72717fc62046970ef4a72ea9c"
integrity sha512-N5sr3layWk60wB3maCy+/5hFHQRcTh8aqxcZTSs3Od9QkuHdWBtRgMGLP/35mXpJlgWuu3xqLpt6u3dGHc8gCg==
"@ember/test-helpers@^2.9.3":
version "2.9.3"
resolved "https://registry.yarnpkg.com/@ember/test-helpers/-/test-helpers-2.9.3.tgz#c2a9d6ab1c367af92cf1a334f97eb19b8e06e6e1"
integrity sha512-ejVg4Dj+G/6zyLvQsYOvmGiOLU6AS94tY4ClaO1E2oVvjjtVJIRmVLFN61I+DuyBg9hS3cFoPjQRTZB9MRIbxQ==
dependencies:
"@ember/test-waiters" "^3.0.0"
"@embroider/macros" "^1.10.0"
"@embroider/util" "^1.9.0"
broccoli-debug "^0.6.5"
broccoli-funnel "^3.0.8"
ember-cli-babel "^7.26.6"
ember-cli-htmlbars "^5.7.1"
ember-cli-babel "^7.26.11"
ember-cli-htmlbars "^6.1.1"
ember-destroyable-polyfill "^2.0.3"

"@ember/test-waiters@^2.4.3 || ^3.0.0", "@ember/test-waiters@^3.0.0":
Expand Down Expand Up @@ -1771,6 +1773,34 @@
resolve "^1.8.1"
semver "^7.3.2"

"@embroider/macros@^1.10.0":
version "1.10.0"
resolved "https://registry.yarnpkg.com/@embroider/macros/-/macros-1.10.0.tgz#af3844d5db48f001b85cfb096c76727c72ad6c1e"
integrity sha512-LMbfQGk/a+f6xtvAv5fq/wf2LRxETnbgSCLUf/z6ebzmuskOUxrke+uP55chF/loWrARi9g6erFQ7RDOUoBMSg==
dependencies:
"@embroider/shared-internals" "2.0.0"
assert-never "^1.2.1"
babel-import-util "^1.1.0"
ember-cli-babel "^7.26.6"
find-up "^5.0.0"
lodash "^4.17.21"
resolve "^1.20.0"
semver "^7.3.2"

"@embroider/[email protected]":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@embroider/shared-internals/-/shared-internals-2.0.0.tgz#d8205ec6944362aeecfbb51143db352430ced316"
integrity sha512-qZ2/xky9mWm5YC6noOa6AiAwgISEQ78YTZNv4SNu2PFgEK/H+Ha/3ddngzGSsnXkVnIHZyxIBzhxETonQYHY9g==
dependencies:
babel-import-util "^1.1.0"
ember-rfc176-data "^0.3.17"
fs-extra "^9.1.0"
js-string-escape "^1.0.1"
lodash "^4.17.21"
resolve-package-path "^4.0.1"
semver "^7.3.5"
typescript-memoize "^1.0.1"

"@embroider/shared-internals@^0.40.0":
version "0.40.0"
resolved "https://registry.yarnpkg.com/@embroider/shared-internals/-/shared-internals-0.40.0.tgz#2f768c60f4f35ba5f9228f046f70324851e8bfe2"
Expand All @@ -1792,6 +1822,15 @@
lodash "^4.17.21"
resolve "^1.20.0"

"@embroider/util@^1.9.0":
version "1.10.0"
resolved "https://registry.yarnpkg.com/@embroider/util/-/util-1.10.0.tgz#8320d73651e7f5d48dac1b71fb9e6d21cac7c803"
integrity sha512-utAFKoq6ajI27jyqjvX3PiGL4m+ZyGVlVNbSbE/nOqi2llRyAkh5ltH1WkIK7jhdwQFJouo1NpOSj9J3/HDa3A==
dependencies:
"@embroider/macros" "^1.10.0"
broccoli-funnel "^3.0.5"
ember-cli-babel "^7.26.11"

"@eslint/eslintrc@^0.4.3":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"
Expand Down Expand Up @@ -2461,16 +2500,6 @@
resolved "https://registry.yarnpkg.com/@types/ember__template/-/ember__template-3.16.1.tgz#30d7f50a49b190934db0f5a56dd76ad86c21efc6"
integrity sha512-APQINizzizl2LHWGMFBCanRjKZQsdzqn7b+us17zbNhnx/R0IZAJq901x/i7eozCRwxsDKmGzNABSCIu6uc1Tg==

"@types/[email protected]":
version "2.6.0"
resolved "https://registry.yarnpkg.com/@types/ember__test-helpers/-/ember__test-helpers-2.6.0.tgz#26a3e709502868fbf73d3cf06942335195f6408b"
integrity sha512-iLb4npBAi2nWdAgnL/lClJkZUXuS4pCpGq3a5yzWoNjzRZCJzLI+zbmNgfY3nQjsV8lXclgfEY0ZzGkRpHU+Xw==
dependencies:
"@types/ember" "*"
"@types/ember__application" "*"
"@types/ember__error" "*"
"@types/htmlbars-inline-precompile" "*"

"@types/ember__test@*":
version "3.16.1"
resolved "https://registry.yarnpkg.com/@types/ember__test/-/ember__test-3.16.1.tgz#8407e42b9835a13ef0c6ef7a7ce3aa3d7ebcb7ed"
Expand Down Expand Up @@ -3380,7 +3409,7 @@ asn1.js@^5.2.0:
minimalistic-assert "^1.0.0"
safer-buffer "^2.1.0"

assert-never@^1.1.0:
assert-never@^1.1.0, assert-never@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/assert-never/-/assert-never-1.2.1.tgz#11f0e363bf146205fb08193b5c7b90f4d1cf44fe"
integrity sha512-TaTivMB6pYI1kXwrFlEhLeGfOqoDNdTxjCdwRfFFkEA30Eu+k48W34nlok2EYWJfFFzqaEmichdNM7th6M5HNw==
Expand Down Expand Up @@ -3578,6 +3607,11 @@ babel-import-util@^0.2.0:
resolved "https://registry.yarnpkg.com/babel-import-util/-/babel-import-util-0.2.0.tgz#b468bb679919601a3570f9e317536c54f2862e23"
integrity sha512-CtWYYHU/MgK88rxMrLfkD356dApswtR/kWZ/c6JifG1m10e7tBBrs/366dFzWMAoqYmG5/JSh+94tUSpIwh+ag==

babel-import-util@^1.1.0, babel-import-util@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/babel-import-util/-/babel-import-util-1.3.0.tgz#dc9251ea39a7747bd586c1c13b8d785a42797f8e"
integrity sha512-PPzUT17eAI18zn6ek1R3sB4Krc/MbnmT1MkZQFmyhjoaEGBVwNABhfVU9+EKcDSKrrOm9OIpGhjxukx1GCiy1g==

babel-loader@^8.0.6:
version "8.2.2"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.2.2.tgz#9363ce84c10c9a40e6c753748e1441b60c8a0b81"
Expand Down Expand Up @@ -3640,6 +3674,13 @@ babel-plugin-ember-template-compilation@^1.0.0:
magic-string "^0.25.7"
string.prototype.matchall "^4.0.5"

babel-plugin-ember-template-compilation@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/babel-plugin-ember-template-compilation/-/babel-plugin-ember-template-compilation-2.0.2.tgz#632a082feac60fea1432fd6c9448e65bb7884fd5"
integrity sha512-/sQJbmOqfNfaEYrIayy8qpfi6GhsoMeBVR3IiihOTHaKFN9+EdTzED8fhUqfshBPu5Qz6zhPkY1aMJ3k/mAuxw==
dependencies:
babel-import-util "^1.3.0"

babel-plugin-filter-imports@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/babel-plugin-filter-imports/-/babel-plugin-filter-imports-4.0.0.tgz#068f8da15236a96a9602c36dc6f4a6eeca70a4f4"
Expand All @@ -3648,17 +3689,6 @@ babel-plugin-filter-imports@^4.0.0:
"@babel/types" "^7.7.2"
lodash "^4.17.15"

babel-plugin-htmlbars-inline-precompile@^5.0.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/babel-plugin-htmlbars-inline-precompile/-/babel-plugin-htmlbars-inline-precompile-5.3.0.tgz#eeaff07c35415264aea4d6bafb5e71167f6ffb2f"
integrity sha512-WeLBQM5Y9rx2GbwfxKy47lWh+u23afdlb48sM+5RTMTLwO90oILA7znzzOls7e+bcj06Nw0H+xpRWuyhlS37hg==
dependencies:
babel-plugin-ember-modules-api-polyfill "^3.5.0"
line-column "^1.0.2"
magic-string "^0.25.7"
parse-static-imports "^1.1.0"
string.prototype.matchall "^4.0.4"

babel-plugin-htmlbars-inline-precompile@^5.2.1, babel-plugin-htmlbars-inline-precompile@^5.3.0:
version "5.3.1"
resolved "https://registry.yarnpkg.com/babel-plugin-htmlbars-inline-precompile/-/babel-plugin-htmlbars-inline-precompile-5.3.1.tgz#5ba272e2e4b6221522401f5f1d98a73b1de38787"
Expand Down Expand Up @@ -5965,18 +5995,17 @@ ember-cli-github-pages@^0.2.2:
ember-cli-version-checker "^2.1.0"
rsvp "^4.7.0"

ember-cli-htmlbars@^5.7.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-5.7.1.tgz#eb5b88c7d9083bc27665fb5447a9b7503b32ce4f"
integrity sha512-9laCgL4tSy48orNoQgQKEHp93MaqAs9ZOl7or5q+8iyGGJHW6sVXIYrVv5/5O9HfV6Ts8/pW1rSoaeKyLUE+oA==
ember-cli-htmlbars@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-6.0.1.tgz#5487831d477e61682bc867fd138808269e5d2152"
integrity sha512-IDsl9uty+MXtMfp/BUTEc/Q36EmlHYj8ZdPekcoRa8hmdsigHnK4iokfaB7dJFktlf6luruei+imv7JrJrBQPQ==
dependencies:
"@ember/edition-utils" "^1.2.0"
babel-plugin-htmlbars-inline-precompile "^5.0.0"
babel-plugin-ember-template-compilation "^1.0.0"
babel-plugin-htmlbars-inline-precompile "^5.3.0"
broccoli-debug "^0.6.5"
broccoli-persistent-filter "^3.1.2"
broccoli-plugin "^4.0.3"
common-tags "^1.8.0"
ember-cli-babel-plugin-helpers "^1.1.1"
ember-cli-version-checker "^5.1.2"
fs-tree-diff "^2.0.1"
hash-for-dep "^1.5.1"
Expand All @@ -5987,13 +6016,13 @@ ember-cli-htmlbars@^5.7.1:
strip-bom "^4.0.0"
walk-sync "^2.2.0"

ember-cli-htmlbars@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-6.0.1.tgz#5487831d477e61682bc867fd138808269e5d2152"
integrity sha512-IDsl9uty+MXtMfp/BUTEc/Q36EmlHYj8ZdPekcoRa8hmdsigHnK4iokfaB7dJFktlf6luruei+imv7JrJrBQPQ==
ember-cli-htmlbars@^6.1.1:
version "6.2.0"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-6.2.0.tgz#18ec48ee1c93f9eed862a64eb24a9d14604f1dfc"
integrity sha512-j5EGixjGau23HrqRiW/JjoAovg5UBHfjbyN7wX5ekE90knIEqUUj1z/Mo/cTx/J2VepQ2lE6HdXW9LWQ/WdMtw==
dependencies:
"@ember/edition-utils" "^1.2.0"
babel-plugin-ember-template-compilation "^1.0.0"
babel-plugin-ember-template-compilation "^2.0.0"
babel-plugin-htmlbars-inline-precompile "^5.3.0"
broccoli-debug "^0.6.5"
broccoli-persistent-filter "^3.1.2"
Expand All @@ -6002,10 +6031,9 @@ ember-cli-htmlbars@^6.0.1:
fs-tree-diff "^2.0.1"
hash-for-dep "^1.5.1"
heimdalljs-logger "^0.1.10"
json-stable-stringify "^1.0.1"
js-string-escape "^1.0.1"
semver "^7.3.4"
silent-error "^1.1.1"
strip-bom "^4.0.0"
walk-sync "^2.2.0"

ember-cli-inject-live-reload@^2.1.0:
Expand Down Expand Up @@ -12069,7 +12097,7 @@ resolve-package-path@^3.1.0:
path-root "^0.1.1"
resolve "^1.17.0"

resolve-package-path@^4.0.0:
resolve-package-path@^4.0.0, resolve-package-path@^4.0.1:
version "4.0.3"
resolved "https://registry.yarnpkg.com/resolve-package-path/-/resolve-package-path-4.0.3.tgz#31dab6897236ea6613c72b83658d88898a9040aa"
integrity sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==
Expand Down Expand Up @@ -12955,7 +12983,7 @@ string-width@^3.0.0, string-width@^3.1.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"

string.prototype.matchall@^4.0.4, string.prototype.matchall@^4.0.5:
string.prototype.matchall@^4.0.5:
version "4.0.6"
resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.6.tgz#5abb5dabc94c7b0ea2380f65ba610b3a544b15fa"
integrity sha512-6WgDX8HmQqvEd7J+G6VtAahhsQIssiZ8zl7zKh1VDMFyL3hRTJP4FTNA3RbIp2TOQ9AYNDcc7e3fH0Qbup+DBg==
Expand Down Expand Up @@ -13627,6 +13655,11 @@ typescript-memoize@^1.0.0-alpha.3:
resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.0.1.tgz#0a8199aa28f6fe18517f6e9308ef7bfbe9a98d59"
integrity sha512-oJNge1qUrOK37d5Y6Ly2txKeuelYVsFtNF6U9kXIN7juudcQaHJQg2MxLOy0CqtkW65rVDYuTCOjnSIVPd8z3w==

typescript-memoize@^1.0.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.1.1.tgz#02737495d5df6ebf72c07ba0d002e8f4cf5ccfa0"
integrity sha512-GQ90TcKpIH4XxYTI2F98yEQYZgjNMOGPpOgdjIBhaLaWji5HPWlRnZ4AeA1hfBxtY7bCGDJsqDDHk/KaHOl5bA==

typescript@^4.0.0:
version "4.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8"
Expand Down