collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['html', 'lcov', 'text'],
- collectCoverageFrom: ['packages/pinia/src/**/*.ts'],
+ collectCoverageFrom: [
+ 'packages/pinia/src/**/*.ts',
+ 'packages/testing/src/**/*.ts',
+ '!packages/testing/**/*.spec.ts',
+ ],
coveragePathIgnorePatterns: [
'/node_modules/',
'src/index.ts',
'src/deprecated.ts',
'src/vue2-plugin.ts',
],
- testMatch: ['<rootDir>/packages/pinia/__tests__/**/*.spec.ts'],
+ testMatch: [
+ '<rootDir>/packages/pinia/__tests__/**/*.spec.ts',
+ '<rootDir>/packages/testing/**/*.spec.ts',
+ ],
transform: {
'^.+\\.tsx?$': '@sucrase/jest-plugin',
},
_StoreObject,
} from './mapHelpers'
-export { createTestingPinia } from './testing'
-export type { TestingOptions, TestingPinia } from './testing'
-
export { acceptHMRUpdate } from './hmr'
export { PiniaPlugin } from './vue2-plugin'
--- /dev/null
+# Pinia testing module
--- /dev/null
+{
+ "name": "@pinia/testing",
+ "version": "0.0.0",
+ "description": "Testing module for Pinia",
+ "keywords": [
+ "vue",
+ "vuex",
+ "store",
+ "pinia",
+ "tests",
+ "mock",
+ "testing"
+ ],
+ "homepage": "https://github.com/posva/pinia/tree/v2/packages/testing#readme",
+ "bugs": {
+ "url": "https://github.com/posva/pinia/issues"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/posva/pinia.git"
+ },
+ "funding": "https://github.com/sponsors/posva",
+ "license": "MIT",
+ "author": {
+ "name": "Eduardo San Martin Morote",
+ "email": "posva13@gmail.com"
+ },
+ "sideEffects": false,
+ "exports": {
+ "require": "./dist/index.js",
+ "import": "./dist/index.mjs"
+ },
+ "main": "./dist/index.js",
+ "module": "./dist/index.mjs",
+ "types": "./dist/index.d.ts",
+ "files": [
+ "dist/*.js",
+ "dist/*.mjs",
+ "dist/*.d.ts",
+ "templates/*.js"
+ ],
+ "scripts": {
+ "build": "siroc",
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s --commit-path . -l @pinia/testing -r 1"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "siroc": "^0.15.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
--- /dev/null
+export { createTestingPinia } from './testing'
+export type { TestingPinia, TestingOptions } from './testing'
-import {
- createPinia,
- createTestingPinia,
- defineStore,
- TestingOptions,
-} from '../src'
+import { createTestingPinia, TestingOptions } from './testing'
+import { createPinia, defineStore } from 'pinia'
import { mount } from '@vue/test-utils'
import { defineComponent } from 'vue'
describe('Testing', () => {
- const useCounter = defineStore({
- id: 'counter',
+ const useCounter = defineStore('counter', {
state: () => ({ n: 0 }),
actions: {
increment(amount = 1) {
import { App, createApp } from 'vue-demi'
-import { createPinia } from './createPinia'
-import { Pinia, PiniaStorePlugin, setActivePinia } from './rootStore'
+import { createPinia } from 'pinia'
+import {
+ Pinia,
+ PiniaStorePlugin,
+ setActivePinia,
+} from '../../pinia/src/rootStore'
export interface TestingOptions {
/**