diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index c58fe779..00000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-version: 2
-jobs:
- build:
- docker:
- - image: circleci/node:8.10
-
- working_directory: ~/repo
-
- steps:
- - checkout
-
- # Download and cache dependencies
- - restore_cache:
- keys:
- - node-8-dependencies-{{ checksum "package.json" }}
- # fallback to using the latest cache if no exact match is found
- - node-8-dependencies-
-
- - run: yarn install
-
- - save_cache:
- paths:
- - node_modules
- key: node-8-dependencies-{{ checksum "package.json" }}
-
- # run tests!
- - run: npm run test
diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml
new file mode 100644
index 00000000..c0675923
--- /dev/null
+++ b/.github/workflows/node.yml
@@ -0,0 +1,38 @@
+name: Node.js CI
+
+on:
+ push:
+ branches:
+ - master
+ - next
+ paths:
+ - '**'
+ - '!**.md'
+ pull_request:
+ branches:
+ - master
+ - next
+ paths:
+ - '**'
+ - '!**.md'
+
+jobs:
+ test:
+ strategy:
+ matrix:
+ node: [14, 16, 18]
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ matrix.node }}
+ uses: actions/setup-node@v3
+ with:
+ node-version: ${{ matrix.node }}
+ cache: yarn
+
+ - name: Install Project Dependencies
+ run: yarn --frozen-lockfile
+
+ - name: Test
+ run: yarn test
diff --git a/.gitignore b/.gitignore
index 03280d22..606f99ec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,3 +25,6 @@ pids
*.pid.lock
package-lock.json
+/e2e/**/yarn.lock
+
+.vscode
diff --git a/README.md b/README.md
index eb880d5b..38e53f22 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,41 @@
# vue-jest
-Jest Vue transformer with source map support
+Jest transformer for Vue Single File Components.
-> **NOTE:** This is documentation for `vue-jest@3.x`. [View the vue-jest@2.x documentation](https://github.com/vuejs/vue-jest/tree/e694fc7ce11ae1ac1c778ed7c4402515c5f0d5aa)
+## Installation
-## Usage
+Since we need to support a variety of Vue and Jest versions, vue-jest doesn't follow semantic versioning.
+
+| Vue version | Jest Version | npm Package | Branch |
+| ----------- | ----------------- | ------------------- | ------ |
+| Vue 2 | Jest 26 and below | `vue-jest@4` | |
+| Vue 3 | Jest 26 and below | `vue-jest@5` | |
+| Vue 2 | Jest 27 and above | `@vue/vue2-jest@27` | 27.x |
+| Vue 3 | Jest 27 and above | `@vue/vue3-jest@27` | 27.x |
+| Vue 2 | Jest 28 and above | `@vue/vue2-jest@28` | 28.x |
+| Vue 3 | Jest 28 and above | `@vue/vue3-jest@28` | 28.x |
```bash
-npm install --save-dev vue-jest
+# Vue 2
+npm install --save-dev @vue/vue2-jest@28 # (use the appropriate version)
+yarn add @vue/vue2-jest@28 --dev
+
+# Vue 3
+npm install --save-dev @vue/vue3-jest@28 # (use the appropriate version)
+yarn add @vue/vue3-jest@28 --dev
```
## Setup
-To define `vue-jest` as a transformer for your `.vue` files, map them to the `vue-jest` module:
+To use `vue-jest` as a transformer for your `.vue` files, map them to the appropriate `vue-jest` module:
```json
{
"jest": {
"transform": {
- "^.+\\.vue$": "vue-jest"
+ "^.+\\.vue$": "@vue/vue2-jest" // Update to match your installed version
}
+ }
}
```
@@ -31,24 +47,24 @@ A full config will look like this.
"moduleFileExtensions": ["js", "json", "vue"],
"transform": {
"^.+\\.js$": "babel-jest",
- "^.+\\.vue$": "vue-jest"
+ "^.+\\.vue$": "@vue/vue2-jest"
}
}
}
```
-If you're on a version of Jest older than 22.4.0, you need to set `mapCoverage` to `true` in order to use source maps.
+### Usage with Babel 7
-## Example Projects
+If you use [jest](https://github.com/facebook/jest) > 24.0.0 and [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest) make sure to install babel-core@bridge
-Example repositories testing Vue components with jest and vue-jest:
-
-- [Avoriaz with Jest](https://github.com/eddyerburgh/avoriaz-jest-example)
-- [Vue Test Utils with Jest](https://github.com/eddyerburgh/vue-test-utils-jest-example)
+```bash
+npm install --save-dev babel-core@bridge
+yarn add babel-core@bridge --dev
+```
-## Supported langs
+## Supported languages for SFC sections
-vue-jest compiles the script and template of SFCs into a JavaScript file that Jest can run. **Currently, SCSS, SASS and Stylus are the only style languages that are compiled**.
+vue-jest compiles ``, ``, and `` blocks with supported `lang` attributes into JavaScript that Jest can run.
### Supported script languages
@@ -59,147 +75,109 @@ vue-jest compiles the script and template of SFCs into a JavaScript file that Je
You can change the behavior of `vue-jest` by using `jest.globals`.
-> _Tip:_ Need programmatic configuration? Use the [--config](https://jestjs.io/docs/en/cli.html#config-path) option in Jest CLI, and export a `.js` file
-
-#### babelConfig
-
-Provide `babelConfig` in one of the following formats:
-
-- ``
-- `