Skip to content

Releases: babel-utils/babel-plugin-tester

v12.0.0-canary.1

13 Mar 20:11
v12.0.0-canary.1
785dfce
Compare
Choose a tag to compare
v12.0.0-canary.1 Pre-release
Pre-release

12.0.0-canary.1 (2024-03-13)

💥 BREAKING CHANGES 💥

  • Minimum supported Node.js version is now 18.19.0

  • Default exports are no longer available. See usage instructions
    for details on proper import syntax.

  • Due to prettier@3 forcing downstream adoption of their
    asynchronous interface, ResultFormatter is no longer synchronous and can now
    return a Promise.

  • Adoption of prettier@3 requires some versions of Node to be
    executed with the --experimental-vm-modules option. E.g.
    NODE_OPTIONS="--no-warnings --experimental-vm-modules" npx jest.

  • Attempting to install babel-plugin-tester alongside jest@<30
    will cause NPM to fail with ERESOLVE. This is because only jest@>=30
    (jest-snapshot) supports the prettier@3 asynchronous interface.

✨ Features

  • Allow testing entire babel transform result via outputRaw (e9d5aa1) closes #186
  • Upgrade to prettier@3 (3334248)

🪄 Fixes

  • readme: use proper codecov coverage badge (1047e5c)

⚙️ Build system

  • package: bump minimum supported node versions to maintained (ee6f7da)
  • Update core-js to 3.33 (170248d)
  • Upgrade typescript-babel toolchain to nodenext (d0b722f)

🧙🏿 Refactored

  • src: deprecated default exports are no longer available (b02d4f0)

v11.0.4

25 Jan 04:24
v11.0.4
e8c7f88
Compare
Choose a tag to compare

11.0.4 (2023-01-25)

🪄 Fixes

  • Ensure exec realm has access to context-sensitive versions of __filename and __dirname globals (0306698)

v11.0.3

24 Jan 21:57
v11.0.3
ded70cc
Compare
Choose a tag to compare

11.0.3 (2023-01-24)

🪄 Fixes

  • Pass full file path to prettier::resolveConfig, not just the dirname (e9ebcdd)

v11.0.2

23 Jan 22:14
v11.0.2
18b0b95
Compare
Choose a tag to compare

11.0.2 (2023-01-23)

🪄 Fixes

  • src: use cross-realm symbols (330aa1e)
  • Use node-util import compatible with node@14 (2c4cd84)

⚙️ Build system

  • babel: explicitly include polyfills for shipped proposals (850d58c)

v11.0.1

18 Jan 16:55
v11.0.1
66ffb3f
Compare
Choose a tag to compare

11.0.1 (2023-01-18)

🪄 Fixes

  • src: ensure deprecated config option is still supported by prettierFormatter (e48badf) closes #139

v11.0.0

18 Jan 12:04
v11.0.0
8a25595
Compare
Choose a tag to compare

11.0.0 (2023-01-18)

💥 BREAKING CHANGES 💥

  • Implicit "global" options merging is no longer supported

    In previous versions of babel-plugin-tester, any test object and fixture configuration option could be passed directly to babel-plugin-tester and apply "globally" across all test objects and fixtures. This was even the case for options that made no sense in a "global" context, such as only, skip, and code. In this version of babel-plugin-tester, only options explicitly listed in the documentation can be passed directly and applied globally. Unrecognized "rest" options are silently ignored.

  • Test/fixture configuration is resolved early and consistently

    In previous versions of babel-plugin-tester, test object and fixture configuration options were resolved in various places, with some options getting finalized before it(...) and describe(...) were called and others being determined as Jest was executing the test. In this version, all configuration options are resolved and finalized before it(...) and describe(...) are called. This also means configurations are finalized before hooks like beforeAll get called by the testing framework.

  • Fixture configuration schema is standardized

    In previous versions of babel-plugin-tester, you could provide any key to options.json and it would be passed as-is to the plugin under test. This made it impossible to allow fixtures to be configured with the same flexibility as test objects. In this version of babel-plugin-tester, fixture options.json (and options.js) files must return a standard set of options. Non-standard properties are silently ignored. For instance: to pass options to the plugin under test, they must be provided via pluginOptions.

  • Global setup/teardown no longer overwrites local versions

    In previous versions of babel-plugin-tester, test-level setup and teardown functions overrode global setup and teardown functions. In this version of babel-plugin-tester, the global setup and teardown functions will be called alongside their test-level counterparts for each test and in a well-defined order (see documentation).

  • TypeError for config error; AssertionError for test error

    All configuration-related issues now throw TypeError instead of AssertionError. AssertionError is now exclusively used for failing tests. Additionally, the text of some error messages has been updated.

  • error only captures exceptions from Babel

    error (aka throws) no longer potentially captures exceptions thrown by the formatResult function. If the formatResult function throws, the entire test will fail immediately.

  • error no longer accepts arbitrary class constructors

    error (aka throws) no longer accepts arbitrary class constructors. Any provided class constructor must extend Error, e.g. built-ins like SyntaxError or custom error classes like class MyError extends Error. Thanks to the nature of JavaScript, providing a class constructor that does not extend Error will lead to undefined behavior.

  • Built-in TypeScript support

    TypeScript types are now included within the package itself, obviating the need to install a separate types package. Installing the old types package alongside this version of babel-plugin-tester will cause conflicts.

  • Global describe and it functions must be defined

    babel-plugin-tester will refuse to run if describe or it are not globally available.

  • All test titles are now numbered

    All test titles are now numbered (e.g. "1. ...", "2. ...", etc), including fixtures tests and tests with custom titles.

  • Minimum recommended node version bumped from 10.13.0 to 14.20.0

  • Plugin names are once again automatically determined by analyzing the return value of the plugin function. Though this is implemented in a backwards-compatible way, there is a small caveat.

  • In previous versions, the lodash.mergeWith customizer skipped source properties that resolved to undefined. With this version, the customizer now unsets these properties (sets them to undefined), allowing the end user to easily unset defaults (e.g. filename).

  • babelOptions.filename is now set to filepath by default rather than undefined.

✨ Features

  • Add support for testing presets (73b90b3)
  • Implement default filepath inference using Error stack trace (9d1b321)
  • src: add exec/execFixture support via Node's VM module (4754f42)
  • src: add support for "only", "skip", and "title" test options in fixtures (#90) (89b58b5)
  • src: add support for arbitrary run order of plugin under test (#91) (8c8b858)
  • src: add support for loading prettier configuration files in fixtures (f54deda)
  • src: add TEST_SKIP/TEST_NUM_SKIP/TEST_ONLY/TEST_NUM_ONLY env variable support (13626d1)
  • src: bring back (lightweight) plugin name inference (#92) (f9ad903)
  • src: implement titleNumbering and restartTitleNumbering options (09e792d)
  • src: implement standard setup/teardown run order (4ea283f)
  • src: provide debug output support via debug package (4c7c6e7)
  • Windows support (f214995)

🪄 Fixes

  • src: ensure test function errors are not swallowed by teardown function errors (2acfe37)
  • src: fix fixtureOutputExt being ignored in root options.json (#89) (481be19)
  • src: fix plugin run order for fixtures to match tests (#88) (fbb6c19)

⚙️ Build system

🔥 Reverted

  • "test: make debugging names shorter and sweeter" (0b869bb)

🧙🏿 Refactored

  • Lodash.mergeWith customizer now allows unsetting options by setting them to undefined (74af680)
  • Reorganize source into unified extensible tester pipeline w/ first-class fixtures support (0c44392)

v11.0.0-canary.1

16 Jan 22:30
v11.0.0-canary.1
b817a5f
Compare
Choose a tag to compare
v11.0.0-canary.1 Pre-release
Pre-release

11.0.0-canary.1 (2023-01-16)

💥 BREAKING CHANGES 💥

  • In previous versions, the lodash.mergeWith customizer skipped source properties
    that resolved to undefined. With this version, the customizer now unsets these properties
    (sets them to undefined), allowing the end user to easily unset defaults (e.g. filename).

  • babelOptions.filename is now set to filepath
    by default rather than undefined.

  • Implicit "global" options merging is no longer supported

    In previous versions of babel-plugin-tester, any test object and fixture
    configuration option could be passed directly to babel-plugin-tester and apply
    "globally" across all test objects and fixtures. This was even the case for
    options that made no sense in a "global" context, such as only, skip, and
    code. In this version of babel-plugin-tester, only options explicitly listed
    in the documentation can be passed directly and applied globally. Unrecognized
    "rest" options are silently ignored.

  • Test/fixture configuration is resolved early and consistently

    In previous versions of babel-plugin-tester, test object and fixture
    configuration options were resolved in various places, with some options getting
    finalized before it(...) and describe(...) were called and others being
    determined as Jest was executing the test. In this version, all configuration
    options are resolved and finalized before it(...) and describe(...) are
    called. This also means configurations are finalized before hooks like
    beforeAll get called by the testing framework.

  • Fixture configuration schema is standardized

    In previous versions of babel-plugin-tester, you could provide any key to
    options.json and it would be passed as-is to the plugin under test. This made
    it impossible to allow fixtures to be configured with the same flexibility as
    test objects. In this version of babel-plugin-tester, fixture options.json
    (and options.js) files must return a standard set of options. Non-standard
    properties are silently ignored. For instance: to pass options to the plugin
    under test, they must be provided via pluginOptions.

  • Global setup/teardown no longer overwrites local versions

    In previous versions of babel-plugin-tester, test-level setup and teardown
    functions overrode global setup and teardown functions. In this version of
    babel-plugin-tester, the global setup and teardown functions will be called
    alongside their test-level counterparts for each test and in a well-defined
    order (see documentation).

  • TypeError for config error; AssertionError for test error

    All configuration-related issues now throw TypeError instead of
    AssertionError. AssertionError is now exclusively used for failing tests.
    Additionally, the text of some error messages has been updated.

  • error only captures exceptions from Babel

    error (aka throws) no longer potentially captures exceptions thrown by the
    formatResult function. If the formatResult function throws, the entire test
    will fail immediately.

  • error no longer accepts arbitrary class constructors

    error (aka throws) no longer accepts arbitrary class constructors. Any
    provided class constructor must extend Error, e.g. built-ins like
    SyntaxError or custom error classes like class MyError extends Error. Thanks
    to the nature of JavaScript, providing a class constructor that does not
    extend Error will lead to undefined behavior
    .

  • Built-in TypeScript support

    TypeScript types are now included within the package itself, obviating the need
    to install a separate types package. Installing the old types package alongside
    this version of babel-plugin-tester will cause conflicts.

  • Global describe and it functions must be defined

    babel-plugin-tester will refuse to run if describe, it, it.only, or
    it.skip are not globally available.

  • All test titles are now numbered

    All test titles are now numbered (e.g. "1. ...", "2. ...", etc), including
    fixtures tests and tests with custom titles.

  • Minimum recommended node version bumped from
    10.13.0 to 14.20.0

  • Plugin names are once again automatically determined
    by analyzing the return value of the plugin function. Though this is
    implemented in a backwards-compatible way, there is a
    small caveat.

✨ Features

  • Add support for testing presets (73b90b3)
  • Implement default filepath inference using Error stack trace (9d1b321)
  • src: add exec/execFixture support via Node's VM module (4754f42)
  • src: add support for "only", "skip", and "title" test options in fixtures (#90) (89b58b5)
  • src: add support for arbitrary run order of plugin under test (#91) (8c8b858)
  • src: add support for loading prettier configuration files in fixtures (f54deda)
  • src: add TEST_SKIP/TEST_NUM_SKIP/TEST_ONLY/TEST_NUM_ONLY env variable support (13626d1)
  • src: bring back (lightweight) plugin name inference (#92) (f9ad903)
  • src: implement titleNumbering and restartTitleNumbering options (09e792d)
  • src: implement standard setup/teardown run order (4ea283f)
  • src: provide debug output support via debug package (4c7c6e7)
  • Windows support (f214995)

🪄 Fixes

  • src: ensure test function errors are not swallowed by teardown function errors (2acfe37)
  • src: fix fixtureOutputExt being ignored in root options.json (#89) (481be19)
  • src: fix plugin run order for fixtures to match tests (#88) (fbb6c19)

⚙️ Build system

🔥 Reverted

  • "test: make debugging names shorter and sweeter" (0b869bb)

🧙🏿 Refactored

  • Lodash.mergeWith customizer now allows unsetting options by setting them to undefined (74af680)
  • Reorganize source into unified extensible tester pipeline w/ first-class fixtures support (0c44392)

v10.1.0

29 May 06:08
969be11
Compare
Choose a tag to compare

10.1.0 (2021-05-29)

Features

  • use babel.transformAsync when it's available (#84) (969be11)

v10.0.0

02 Oct 02:18
91c22ec
Compare
Choose a tag to compare

10.0.0 (2020-10-02)

Bug Fixes

  • pluginNameInference: remove the inference. Default to "unknown plugin" (#78) (91c22ec), closes #60

BREAKING CHANGES

  • pluginNameInference: Plugin name inference is no longer supported

v9.2.0

27 May 12:45
248986e
Compare
Choose a tag to compare

9.2.0 (2020-05-27)

Features

  • add 'fixtureOutputExt' configuration option (#73) (ae67eee)