Injects Tasty API into given `scope`. Called automatically with `global` if {@link /tasty/?api=server#Tasty|`config.globals`} is `true`.
@memberof tasty
@method api
@param {Object} scope Scope to inject API into.
@returns {Object} Passed `scope` for chaining.
@throws {TypeError}
@example tasty.api(this);
function api(scope) {
		if (!scope) {
			throw new TypeError('api, scope is required');
		}

		// TODO filter.

		inject(tool, scope, true);
		inject(thing, scope, false);
		scope.noop = noop;
		scope.now = now;

		config.addon &&
			config.addon.split(',')
				.sort(
					(a, b) => a.localeCompare(b)
				)
				.forEach((name) => {
					const module = require(util.resolve(name));
					scope[name] = module;

					// NOTE support for assterion/expectation libraries.
					if (module.assert) {
						scope.assert = module.assert;
					}
					if (module.expect) {
						scope.expect = module.expect;
					}
					// TODO support should();

					// WORKAROUND for chai plugins.
					/^chai-/.test(name) && scope.chai &&
						scope.chai.use(module);
				});

		return scope;
	}