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

Add compat adapter for @ember/test-waiters #1428

Merged
merged 1 commit into from
May 16, 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
24 changes: 24 additions & 0 deletions packages/compat/src/compat-adapters/@ember/test-waiters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import V1Addon from '../../v1-addon';
import { satisfies } from 'semver';

export default class extends V1Addon {
// our heuristic for detecting tree suppression can't deal with the way
// test-waiters patches treeFor on other copies of its addon instances all
// over the place. It causes us to falsely detect that it's trying to suppress
// all tree output, reducing in empty copies.
protected suppressesTree(_name: string): boolean {
return false;
}

reduceInstances(instances: V1Addon[]): V1Addon[] {
if (!satisfies(this.packageJSON.version, '>=3.0.2')) {
throw new Error(
`@ember/test-waiters cannot work safely under embroider before version 3.0.2 due to https://github.com/emberjs/ember-test-waiters/pull/388. You have a copy at version ${this.packageJSON.version}.`
);
}

// we know test waiters tries to dedup itself, so there's no point in building
// and smooshing many copies.
return [instances[0]];
}
}
2 changes: 1 addition & 1 deletion packages/compat/src/v1-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ export default class V1Addon {
// But there is a very common use case that we *can* handle opportunisticaly,
// which is a treeFor() that's used purely to guard whether `_super` will be
// called or not.
private suppressesTree(name: string): boolean {
protected suppressesTree(name: string): boolean {
if (!this.customizes('treeFor')) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"prepack": "rollup --config"
},
"dependencies": {
"@ember/test-waiters": "^3.0.0",
"@ember/test-waiters": "^3.0.2",
"@embroider/addon-shim": "workspace:^"
},
"devDependencies": {
Expand Down
Loading