Featurevisor

Scopes

Scopes have been replaced by Targets. Everything that scopes used to do is now handled by target definitions.

What changed

In earlier versions of Featurevisor, scopes were configured inside featurevisor.config.js to generate smaller and more optimized datafiles by:

  • picking features belonging to one or more tags, and
  • applying a partially known context to remove redundant rules and segments.

Targets now own that responsibility. Instead of generating a datafile per tag and an extra datafile per scope, every datafile is now produced from a target definition that lives in the targets directory.

The scopes key in featurevisor.config.js is obsolete. Featurevisor ignores it in v3, so keeping it there will not build any additional datafiles. Migrate each old scope to a target file instead.

Mapping scopes to targets

A scope used to be defined like this:

featurevisor.config.js
module.exports = {
scopes: [
{
name: 'browsers',
tag: 'web',
context: { platform: 'web' },
},
],
}

The same intent is now expressed as a target file:

targets/browsers.yml
description: Web browsers
tag: web
context:
platform: web

Both tag and tags selectors carry over unchanged, including the or and and shapes for selecting multiple tags. The partially known context works exactly as before: Featurevisor applies it while building the target datafile and removes any rules or segments that are no longer relevant.

Testing

The scope property in test assertions, and the --with-scopes CLI flag, are obsolete. Assertions now choose a target directly:

tests/features/showBanner.spec.yml
feature: showBanner
assertions:
- environment: production
target: browsers
at: 10
context: {}
expectedToBeEnabled: true

The test runner builds target datafiles in memory automatically, so no extra flag is needed.

Learn more

  • Targets: define the datafiles your project builds
  • Tags: group features so targets can select them
  • Building datafiles: how datafiles are generated from targets