Skip to content

Commit

Permalink
Back to Symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Dec 1, 2023
1 parent 595fcc2 commit a45e358
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions addon/@ember/test-waiters/waiter-manager.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import { assert } from '@ember/debug';
import { PendingWaiterState, Waiter, WaiterName } from './types';

import Ember from 'ember';
import { registerWaiter } from '@ember/test';

type Indexable = Record<any, unknown>;

// NOTE: We can't use symbols when we could have multiple copies of the addon
// in the dep tree. So for now, we can use this private string-based key
// that all copies of the `@ember/test-waiters` can use.
const PRIVATE_GLOBAL_DATA_KEY =
'__#private_global_state_for_test_waiters__do_not_access_if_you_want_your_projects_to_keep_working__';
assert(`Expected the 'Symbol' global to be available in this environment. Environments without support for 'Symbol' are not supported by '@ember/test-waiters'. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol`, typeof Symbol !== 'undefined');

Check failure on line 9 in addon/@ember/test-waiters/waiter-manager.ts

View workflow job for this annotation

GitHub Actions / Floating Dependencies

Replace ``Expected·the·'Symbol'·global·to·be·available·in·this·environment.·Environments·without·support·for·'Symbol'·are·not·supported·by·'@ember/test-waiters'.·See:·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol`,·typeof·Symbol·!==·'undefined'` with `⏎··`Expected·the·'Symbol'·global·to·be·available·in·this·environment.·Environments·without·support·for·'Symbol'·are·not·supported·by·'@ember/test-waiters'.·See:·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol`,⏎··typeof·Symbol·!==·'undefined'⏎`

Check failure on line 9 in addon/@ember/test-waiters/waiter-manager.ts

View workflow job for this annotation

GitHub Actions / Tests

Replace ``Expected·the·'Symbol'·global·to·be·available·in·this·environment.·Environments·without·support·for·'Symbol'·are·not·supported·by·'@ember/test-waiters'.·See:·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol`,·typeof·Symbol·!==·'undefined'` with `⏎··`Expected·the·'Symbol'·global·to·be·available·in·this·environment.·Environments·without·support·for·'Symbol'·are·not·supported·by·'@ember/test-waiters'.·See:·https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol`,⏎··typeof·Symbol·!==·'undefined'⏎`

// All copies of `@ember/test-waiters must have this same key/symbol.
// Once this `@ember/test-waiters` is released, folks will want to use 'overrides'
// to pin it across their whole dep graph.
//
// In the v1 addon version of this library, the build time highlander code will ensure
// that there is only one copy,
// And with the v2 addon version of this library, that is where pinning is important,
// because either:
// - highlander code will run, and boot out the v2 addon copy
// - v2 addon has precedence, and the min-version of test-waiters throughout the
// dep graph should not preceed the version which this symbol was introduced.
const PRIVATE_GLOBAL_DATA_KEY = Symbol.for(`@ember/test-waiters' WAITERS`);

// this ensures that if @ember/test-waiters exists in multiple places in the
// build output we will still use a single map of waiters (there really should
Expand Down

0 comments on commit a45e358

Please sign in to comment.