]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat(testing): add testing package
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 19 Aug 2021 12:34:12 +0000 (14:34 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 19 Aug 2021 12:34:12 +0000 (14:34 +0200)
jest.config.js
packages/pinia/src/index.ts
packages/testing/README.md [new file with mode: 0644]
packages/testing/package.json [new file with mode: 0644]
packages/testing/src/index.ts [new file with mode: 0644]
packages/testing/src/testing.spec.ts [moved from packages/pinia/__tests__/testing.spec.ts with 96% similarity]
packages/testing/src/testing.ts [moved from packages/pinia/src/testing.ts with 96% similarity]

index c46474700b7674d6d33ba2cce31e035052ebf7f8..172e759de8f4167dd2cae6945a5828f0a0ea0745 100644 (file)
@@ -3,7 +3,11 @@ module.exports = {
   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',
@@ -13,7 +17,10 @@ module.exports = {
     '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',
   },
index e0f8af46eac6b5ad29c838b3b7572d01549d6627..73305dd8f67fe8db32069d8480ba4dc543fab26d 100644 (file)
@@ -59,9 +59,6 @@ export type {
   _StoreObject,
 } from './mapHelpers'
 
-export { createTestingPinia } from './testing'
-export type { TestingOptions, TestingPinia } from './testing'
-
 export { acceptHMRUpdate } from './hmr'
 
 export { PiniaPlugin } from './vue2-plugin'
diff --git a/packages/testing/README.md b/packages/testing/README.md
new file mode 100644 (file)
index 0000000..f2cacbd
--- /dev/null
@@ -0,0 +1 @@
+# Pinia testing module
diff --git a/packages/testing/package.json b/packages/testing/package.json
new file mode 100644 (file)
index 0000000..a13506a
--- /dev/null
@@ -0,0 +1,53 @@
+{
+  "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"
+  }
+}
diff --git a/packages/testing/src/index.ts b/packages/testing/src/index.ts
new file mode 100644 (file)
index 0000000..b5d8a91
--- /dev/null
@@ -0,0 +1,2 @@
+export { createTestingPinia } from './testing'
+export type { TestingPinia, TestingOptions } from './testing'
similarity index 96%
rename from packages/pinia/__tests__/testing.spec.ts
rename to packages/testing/src/testing.spec.ts
index 0f97b3dfc796b86bab0b37b408b17abf7a8e118e..04dd6f7f483233f7e8ea490ff3ccf58b629f2a33 100644 (file)
@@ -1,15 +1,10 @@
-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) {
similarity index 96%
rename from packages/pinia/src/testing.ts
rename to packages/testing/src/testing.ts
index ffdf61be74a471260ddd340f53fe4620dbb224cf..39789d5a8fbd8ae3fa1bb7968683258da425105c 100644 (file)
@@ -1,6 +1,10 @@
 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 {
   /**