Skip to content

Commit 3b08276

Browse files
UPdate to version without removal of markdown files
1 parent beaedf4 commit 3b08276

File tree

1 file changed

+0
-374
lines changed

1 file changed

+0
-374
lines changed

patches/snap-shot-core+10.2.4.dev.patch

Lines changed: 0 additions & 374 deletions
Original file line numberDiff line numberDiff line change
@@ -1,377 +1,3 @@
1-
diff --git a/node_modules/snap-shot-core/README.md b/node_modules/snap-shot-core/README.md
2-
deleted file mode 100644
3-
index 2b8a68c..0000000
4-
--- a/node_modules/snap-shot-core/README.md
5-
+++ /dev/null
6-
@@ -1,368 +0,0 @@
7-
-[![TODO board](https://imdone.io/api/1.0/projects/5b1adebb4f7fd004e58ef569/badge)](https://imdone.io/app#/board/bahmutov/snap-shot-core)
8-
-
9-
-# snap-shot-core
10-
-
11-
-> Save / load named snapshots, useful for tests
12-
-
13-
-[![NPM][npm-icon] ][npm-url]
14-
-
15-
-[![Build status][ci-image] ][ci-url]
16-
-[![semantic-release][semantic-image] ][semantic-url]
17-
-[![js-standard-style][standard-image]][standard-url]
18-
-[![renovate-app badge][renovate-badge]][renovate-app]
19-
-
20-
-This is the snapshot loading and saving utility, used by
21-
-[snap-shot-it][snap-shot-it] and [schema-shot][schema-shot] projects.
22-
-Can be used to save snapshots from any testing project.
23-
-
24-
-```sh
25-
-npm install --save-dev snap-shot-core
26-
-```
27-
-
28-
-```js
29-
-const snapShot = require('snap-shot-core')
30-
-const what // my object
31-
-const out = snapShot.core({
32-
- what,
33-
- file: __filename, // aliases: file, __filename
34-
- specName: 'my test', // or whatever name you want to give,
35-
- store, // optional function to preprocess the value before storing
36-
- compare: compareFn, // optional function that compares values
37-
- raiser: raiseErrorFn, // optional
38-
- ext: '.test', // default value is '.snapshot.js'
39-
- opts: {
40-
- // see below
41-
- }
42-
-})
43-
-```
44-
-
45-
-The returned value contains both the saved value and the snapshot name
46-
-
47-
-```js
48-
-let out = snapShot.core({
49-
- what: 42,
50-
- exactSpecName: 'my snapshot'
51-
-})
52-
-console.log(out)
53-
-// {value: 42, key 'my snapshot'}
54-
-out = snapShot.core({
55-
- what: 42,
56-
- specName: 'my snapshot'
57-
-})
58-
-console.log(out)
59-
-// auto-increments counter if we are using
60-
-// just the spec name
61-
-// {value: 42, key 'my snapshot 1'}
62-
-```
63-
-
64-
-When throwing an error on different value, the error instance will still have `key` property with the final snapshot name.
65-
-
66-
-## Save folders
67-
-
68-
-All snapshots are saved in a single folder `__snapshots__`, even if original spec files are nested. See [test-nested-specs](test-nested-specs) example folder.
69-
-
70-
-## Store function
71-
-
72-
-Sometimes you want to store not the value itself, but something derived,
73-
-like the object's schema (check out [schema-shot][schema-shot]). You can
74-
-pass a function `store` that transforms the object before saving.
75-
-For example if we are only interested in the type of value, we can do the
76-
-following (paired with the right `compare` function).
77-
-
78-
-```js
79-
-const store = x => typeof x
80-
-// expected - previously saved "type of" value
81-
-// value - current original value
82-
-const compare = (
83-
- { expected, value } // return Result
84-
-) =>
85-
- snapShot({
86-
- what,
87-
- store,
88-
- compare,
89-
- })
90-
-```
91-
-
92-
-Note: by default multi line text is saves using ES6 template string, while
93-
-everything else is saved using normal serialization using
94-
-[jsesc](https://github.com/mathiasbynens/jsesc).
95-
-
96-
-## Compare function
97-
-
98-
-A function to compare expected and actual value should return `Result`
99-
-instance, preferably [Folktable.Result][result]. A simple one could be
100-
-
101-
-```js
102-
-const Result = require('folktale/result')
103-
-function compare({ expected, value }) {
104-
- const e = JSON.stringify(expected)
105-
- const v = JSON.stringify(value)
106-
- if (e === v) {
107-
- return Result.Ok()
108-
- }
109-
- return Result.Error(`${e} !== ${v}`)
110-
-}
111-
-```
112-
-
113-
-Another one, that compares values by type could be even simpler
114-
-
115-
-```js
116-
-const sameTypes = (a, b) => typeof a === typeof b
117-
-
118-
-const compareTypes = ({ expected, value }) =>
119-
- sameTypes(expected, value) ? Result.Ok() : Result.Error('types are different')
120-
-```
121-
-
122-
-Note input is an object `{expected, value}` and if there is a difference
123-
-you should describe it as a string `Result.Error(<difference string>)`.
124-
-Why does it return a `Result`? Because it makes [life easier][result post].
125-
-
126-
-[result]: http://folktale.origamitower.com/api/v2.0.0/en/folktale.result.html
127-
-[result post]: https://glebbahmutov.com/blog/use-a-little-bit-of-fp/#result-either-for-utility-functions
128-
-
129-
-## Raise function
130-
-
131-
-Default function will compare current and loaded values using `compare`
132-
-function and if the values are different will throw an error. You can provide
133-
-your own function to fail a test differently. Your function will be called
134-
-with these parameters
135-
-
136-
-```js
137-
-raiser({
138-
- value, // current value
139-
- expected, // loaded value
140-
- specName, // the name of the test
141-
- compare, // compare function
142-
-})
143-
-```
144-
-
145-
-Default `raiser` function just throws an Error with good message.
146-
-
147-
-## Returned value
148-
-
149-
-The `snapShotCore` function returns the _expected_ value.
150-
-If this is the first time, it will be `store(what)` value.
151-
-Otherwise it will be the loaded `expected` value.
152-
-
153-
-## Options
154-
-
155-
-You can pass several options to control the behavior. I usually grab them
156-
-from the environment variables.
157-
-
158-
-- `show` - log snapshot value when saving new one
159-
-- `dryRun` - only show the new snapshot value, but do not save it
160-
-- `update` - override snapshot value with the new one if there is difference
161-
-- `ci` - the tests are running on CI, which should disallow _saving snapshots_
162-
-- `sortSnapshots` - enable sorting snapshots by name when saving (default is false)
163-
-- `useRelativePath` - use relative paths inside `__snapshots__` folder to recreate folder structure to mimic spec file relative path. Default is false.
164-
-
165-
-```js
166-
-// for example to use environment variables
167-
-const opts = {
168-
- show: Boolean(process.env.SHOW),
169-
- dryRun: Boolean(process.env.DRY),
170-
- update: Boolean(process.env.UPDATE),
171-
- ci: Boolean(process.env.CI),
172-
- sortSnapshots: false,
173-
- useRelativePath: false
174-
-}
175-
-snapShot.core({
176-
- what,
177-
- file: __filename,
178-
- specName: 'my test',
179-
- compare: compareFn,
180-
- ext: '.test',
181-
- opts,
182-
-})
183-
-```
184-
-
185-
-If `opts.ci` is not set, it will use [is-ci](https://github.com/watson/is-ci)
186-
-to determine if running on CI or not.
187-
-
188-
-## useRelativePath
189-
-
190-
-When you pass `useRelativePath: true` option, the folder structure inside the `__snapshots__` folder will recreate the folder paths to the spec. For example if the specs are in subfolders:
191-
-
192-
-```text
193-
-specs/
194-
- foo/
195-
- spec.js
196-
- bar/
197-
- spec.js
198-
-```
199-
-
200-
-Then output snapshots will be saved as
201-
-
202-
-```text
203-
-__snapshots__/
204-
- specs/
205-
- foo/
206-
- spec.js.snapshot.js
207-
- bar/
208-
- spec.js.snapshot.js
209-
-```
210-
-
211-
-## Pruning snapshots
212-
-
213-
-When test names change or tests are updated, new snapshots are saved, but old ones remain
214-
-in the snapshot file. To prune the old snapshots, the test runner can pass all current spec
215-
-names to prune all other ones. Just call `.prune()` method and pass the following options
216-
-
217-
-```
218-
-* tests: list of current tests. Each object should have
219-
- file: the full test filename
220-
- specName: the full title of the test
221-
-* ext: optional snapshot filename extension
222-
-```
223-
-
224-
-For example see [src/prune-spec.js](src/prune-spec.js)
225-
-
226-
-**note** this can still leave old snapshot files, if the spec has no tests running or
227-
-has been renamed.
228-
-
229-
-**note 2** if you run tests with `.only` it will remove all other snapshots in that file.
230-
-This is normal, you will recreated all snapshots once you run all the tests again.
231-
-
232-
-## Exact snapshot name
233-
-
234-
-Sometimes you do not want to auto increment the snapshots, or use default test name.
235-
-In this case you can pass `exactSpecName` to just save the snapshot with that key.
236-
-
237-
-```js
238-
-snapShot.core({
239-
- what: 42,
240-
- exactSpecName: 'computed value',
241-
- file: __filename,
242-
-})
243-
-```
244-
-
245-
-The snapshot file will have
246-
-
247-
-```js
248-
-exports['computed value'] = 42
249-
-```
250-
-
251-
-## Text snapshots
252-
-
253-
-When saving strings, the snapshot will be surrounded by newlines to avoid
254-
-extra lone first line (looking like `exports["name"] = ...`). So when saving snapshot text
255-
-
256-
-```text
257-
-line 1
258-
-line 2
259-
-```
260-
-
261-
-the snapshot file will have
262-
-
263-
-```js
264-
-exports['name'] = `
265-
-line 1
266-
-line 2
267-
-`
268-
-```
269-
-
270-
-The newlines will be trimmed automatically when loading the snapshot value.
271-
-
272-
-## Debugging
273-
-
274-
-Run the code with `DEBUG=snap-shot-core` option to see more log messages. During testing you can see additional output by adding `DEBUG=test` environment variable (or both `DEBUG=snap-shot-core,test`).
275-
-
276-
-If you want verbose output, use `DEBUG=snap-shot-core*`
277-
-
278-
-## Testing in watch mode
279-
-
280-
-In case you execute your tests in watch mode and you notice the snapshots are always new-created for the same set of tests, then you need to restore the counters per file.
281-
-
282-
-tape example:
283-
-
284-
-```js
285-
-//foo.test.js
286-
-const test = require('tape')
287-
-const snapShot = require('snap-shot-core')
288-
-
289-
-test.onFinish(snapShot.restore)
290-
-
291-
-test('one test', function(t) {
292-
- t.plan(1)
293-
- snapShot.core({
294-
- what: 1,
295-
- file: __filename,
296-
- specName: 'one test',
297-
- })
298-
-})
299-
-```
300-
-
301-
-You can restore / reset a counter for a particular test
302-
-
303-
-```js
304-
-const snapShot = require('snap-shot-core')
305-
-snapShot.restore({
306-
- file: __filename,
307-
- specName: 'this test',
308-
-})
309-
-```
310-
-
311-
-## Escaping values
312-
-
313-
-Because the snapshots are saved as template literals, back ticks and other "niceties" have to be escaped. This module uses [jsesc](https://github.com/mathiasbynens/jsesc) module to do string escaping. Currently only the [minimal set of characters is escaped](https://github.com/mathiasbynens/jsesc#minimal).
314-
-
315-
-## Resaving snaphots
316-
-
317-
-You can re-save snapshot file (for example to escape it again, or to resort the snapshots by name) using [bin/resave-snapshots.js](bin/resave-snapshots.js) script. After installing this module, run `bin` script
318-
-
319-
-```bash
320-
-$(npm bin)/resave-snapshots [--sort] snapshot-filename
321-
-```
322-
-
323-
-To just re-escape the snapshots omit the `--sort` flag.
324-
-
325-
-### Small print
326-
-
327-
-Author: Gleb Bahmutov &lt;[email protected]&gt; &copy; 2017
328-
-
329-
-- [@bahmutov](https://twitter.com/bahmutov)
330-
-- [glebbahmutov.com](https://glebbahmutov.com)
331-
-- [blog](https://glebbahmutov.com/blog)
332-
-
333-
-License: MIT - do anything with the code, but don't blame me if it does not work.
334-
-
335-
-Support: if you find any problems with this module, email / tweet /
336-
-[open issue](https://github.com/bahmutov/snap-shot-core/issues) on Github
337-
-
338-
-## MIT License
339-
-
340-
-Copyright (c) 2017 Gleb Bahmutov &lt;[email protected]&gt;
341-
-
342-
-Permission is hereby granted, free of charge, to any person
343-
-obtaining a copy of this software and associated documentation
344-
-files (the "Software"), to deal in the Software without
345-
-restriction, including without limitation the rights to use,
346-
-copy, modify, merge, publish, distribute, sublicense, and/or sell
347-
-copies of the Software, and to permit persons to whom the
348-
-Software is furnished to do so, subject to the following
349-
-conditions:
350-
-
351-
-The above copyright notice and this permission notice shall be
352-
-included in all copies or substantial portions of the Software.
353-
-
354-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
355-
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
356-
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
357-
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
358-
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
359-
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
360-
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
361-
-OTHER DEALINGS IN THE SOFTWARE.
362-
-
363-
-[npm-icon]: https://nodei.co/npm/snap-shot-core.svg?downloads=true
364-
-[npm-url]: https://npmjs.org/package/snap-shot-core
365-
-[ci-image]: https://travis-ci.org/bahmutov/snap-shot-core.svg?branch=master
366-
-[ci-url]: https://travis-ci.org/bahmutov/snap-shot-core
367-
-[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
368-
-[semantic-url]: https://github.com/semantic-release/semantic-release
369-
-[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
370-
-[standard-url]: http://standardjs.com/
371-
-[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
372-
-[renovate-app]: https://renovateapp.com/
373-
-[snap-shot-it]: https://github.com/bahmutov/snap-shot-it
374-
-[schema-shot]: https://github.com/bahmutov/schema-shot
3751
diff --git a/node_modules/snap-shot-core/src/file-system.js b/node_modules/snap-shot-core/src/file-system.js
3762
index b2886cd..7d199a0 100644
3773
--- a/node_modules/snap-shot-core/src/file-system.js

0 commit comments

Comments
 (0)