quickpickle 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +30 -18
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -37,39 +37,51 @@ npm install --save-dev quickpickle vitest
37
37
 
38
38
  ## Configuration
39
39
 
40
- Add the quickpickle plugin to your Vitest configuration in vite.config.ts (or .js, etc.):
40
+ Add the quickpickle plugin to your Vitest configuration in vite.config.ts (or .js, etc.).
41
+ Also add the configuration to get the feature files, step definitions, world file, etc.
41
42
 
42
43
  ```ts
43
44
  // vite.config.ts
44
45
  import { quickpickle } from 'quickpickle';
45
46
 
46
- const qpConfig:Partial<QuickPickleConfig> = { // <-- Optional configuration (defaults shown)
47
-
48
- /**
49
- * The files to be imported for each Feature.
50
- * All step definitions, hooks, world constructor, etc. must be listed.
51
- * The value can be a glob pattern or an array of glob patterns.
52
- */
53
- import: [
54
- '{features,test,tests}/**/*.steps.{ts,js,mjs}',
55
- '{features,test,tests}/**/*.world.{ts,js,mjs}'
56
- ]
57
-
58
- }
59
-
60
47
  export default {
61
48
  plugins: [
62
- quickpickle(qpConfig) // <-- Add the quickpickle plugin
49
+ quickpickle() // <-- Add the quickpickle plugin
63
50
  ],
64
51
  test: {
65
52
  include : [
66
53
  'features/*.feature', // <-- Add Gherkin feature files into "test" configuration
67
54
  // (you'll probably want other test files too, for unit tests etc.)
68
55
  ],
56
+ setupFiles: ['./tests/tests.steps.ts'] // <-- specify each setupfile here
69
57
  },
70
58
  };
71
59
  ```
72
60
 
61
+ If you have multiple configurations, you can also add the test settings in vitest.workspace.ts.
62
+ This is also where you could set up separate configurations for components vs. application,
63
+ different browser environments, different world constructors, etc.
64
+
65
+ ```ts
66
+ // vitest.workspace.ts
67
+ import { defineWorkspace } from 'vitest/config';
68
+
69
+ export default defineWorkspace([
70
+ { // configuration for feature files
71
+ extends: './vite.config.ts',
72
+ test: {
73
+ include : [ 'tests/*.feature' ],
74
+ setupFiles: [ 'tests/tests.steps.ts' ],
75
+ },
76
+ },
77
+ { // configuration for unit tests
78
+ test: {
79
+ include : [ 'tests/*.test.ts' ],
80
+ }
81
+ }
82
+ ])
83
+ ```
84
+
73
85
  ## Usage
74
86
 
75
87
  ### Write Feature files
@@ -100,11 +112,11 @@ npx vitest --run
100
112
  ### Write step definitions
101
113
 
102
114
  Write your step definitions in a typescript or javascript file as configured
103
- in the "import" declaration of the qpConfig object above.
115
+ in the "setupFiles" declaration in your vitest config.
104
116
 
105
117
  These files will be imported into the Vitest test runner, and the code for
106
118
  `Given`, `When`, `Then` will register each of the step definitions with quickpickle.
107
- These step definitions should run on import, i.e. at the top level of the script,
119
+ These step definitions should run immediately, i.e. at the top level of the script,
108
120
  not as exported functions like a normal node module would do.
109
121
 
110
122
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickpickle",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Plugin for Vitest to run tests written in Gherkin Syntax.",
5
5
  "keywords": [
6
6
  "BDD",