Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-test-utils-compat

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-test-utils-compat - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# 0.0.4
- Altered behavior of MOUNT_ARGS_DIRECTIVES to pass directives also to stubs
See https://github.com/vuejs/test-utils/pull/1804 for details
# 0.0.3

@@ -2,0 +7,0 @@

2

package.json
{
"name": "vue-test-utils-compat",
"version": "0.0.3",
"version": "0.0.4",
"description": "Compat layer for @vue/test-utils@2.x",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -1,2 +0,2 @@

# vue-test-utils-compat
# vue-test-utils-compat [![npm badge](https://img.shields.io/npm/v/vue-test-utils-compat)](https://npmjs.com/vue-test-utils-compat)

@@ -46,2 +46,6 @@ Upgrade your Vue components first, deal with tests later

```bash
npm install --save-dev vue-test-utils-compat
```
**Vue 3**:

@@ -75,3 +79,3 @@

}).mount(document.createElement("div"));
installVTUCompat(VTU, fullCompatConfig, compatH);
installVTUCompat(VueTestUtils, fullCompatConfig, compatH);
```

@@ -102,3 +106,3 @@

3. Install `vue-test-utils-compat`. Please take a note that your test environment might reset modules between files (jest do this), so make sure to do this in the proper place (we're using `setupFilesAfterEnv` in jest):
3. Install `vue-test-utils-compat`. Please take a note that your test environment might reset modules between files (`jest` do this), so make sure to do this in the proper place (we're using `setupFilesAfterEnv` in jest):

@@ -117,3 +121,3 @@ ```js

5. At this point, you (theoretically) have a green suite and can start working on upgrading your code to Vue 3
6. Switch `fullCompatConfig` from step 3 with the detailed configuration of compat flags. You can copy-paste the full list of flags below or take a look at the source code to figure all flags:
6. Replace `fullCompatConfig` from step 3 with the detailed list of compat flags. You can copy-paste the full list of flags below or take a look at the source code to figure all flags:

@@ -147,4 +151,4 @@ ```js

6. Turn off one compatibility flag. Fix failing tests. Repeat.
7. As soon as you turn off the last compatibility flag - throw away and uninstall this package. You are awesome!
7. 🔁 Turn off one compatibility flag. Fix failing tests. Repeat.
8. As soon as you turn off the last compatibility flag - throw away and uninstall this package. You are awesome! 🎉

@@ -151,0 +155,0 @@ ## 🌐 Global API

@@ -0,1 +1,3 @@

const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
function smartMerge(...args) {

@@ -17,4 +19,2 @@ const filteredArgs = args.filter((a) => a != null);

Object.keys(listeners).map((key) => {
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
const fixedKey = `on${capitalize(key)}`;

@@ -93,3 +93,3 @@ return [fixedKey, listeners[key]];

Object.keys(on).map((key) => {
const capitalized = key.charAt(0).toUpperCase() + key.slice(1);
const capitalized = capitalize(key);
return [`on${capitalized}`, on[key]];

@@ -164,3 +164,10 @@ })

{
stubs: config.MOUNT_ARGS_STUBS ? normalizeStubs(stubs) : null,
stubs: config.MOUNT_ARGS_STUBS
? {
...normalizeStubs(stubs),
...(config.MOUNT_ARGS_DIRECTIVES
? Object.fromEntries(Object.entries(directives).map(([k, v]) => [`v${capitalize(k)}`, v]))
: {}),
}
: null,
mocks: config.MOUNT_ARGS_MOCKS ? mocks : null,

@@ -177,4 +184,3 @@ provide: config.MOUNT_ARGS_PROVIDE ? normalizeProvide(provide) : null,

});
return smartMerge(computedArgs, otherArgsOptions);
}

@@ -20,3 +20,3 @@ import { jest, describe, afterEach, beforeEach, it, expect } from "@jest/globals";

installCompat(VTU, { [compatFlags.MOUNT_ARGS_DIRECTIVES]: compatMode });
installCompat(VTU, { [compatFlags.MOUNT_ARGS_DIRECTIVES]: compatMode, [compatFlags.MOUNT_ARGS_STUBS]: compatMode });
wrapper = VTU.mount(FakeComponent, {

@@ -23,0 +23,0 @@ global: {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc