chore: update project state and prepare for image support development
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
- Add comprehensive image test document with various image types - Update project structure with development artifacts - Prepare foundation for image support enhancement phase - Include test files for validating image editing workflows 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
22
node_modules/@jest/console/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/console/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
39
node_modules/@jest/console/package.json
generated
vendored
Normal file
39
node_modules/@jest/console/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@jest/console",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-console"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/types": "30.2.0",
|
||||
"@types/node": "*",
|
||||
"chalk": "^4.1.2",
|
||||
"jest-message-util": "30.2.0",
|
||||
"jest-util": "30.2.0",
|
||||
"slash": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-utils": "30.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/core/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@jest/core/README.md
generated
vendored
Normal file
3
node_modules/@jest/core/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @jest/core
|
||||
|
||||
Jest is currently working on providing a programmatic API. This is under development, and usage of this package directly is currently not supported.
|
||||
103
node_modules/@jest/core/package.json
generated
vendored
Normal file
103
node_modules/@jest/core/package.json
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"name": "@jest/core",
|
||||
"description": "Delightful JavaScript Testing.",
|
||||
"version": "30.2.0",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/console": "30.2.0",
|
||||
"@jest/pattern": "30.0.1",
|
||||
"@jest/reporters": "30.2.0",
|
||||
"@jest/test-result": "30.2.0",
|
||||
"@jest/transform": "30.2.0",
|
||||
"@jest/types": "30.2.0",
|
||||
"@types/node": "*",
|
||||
"ansi-escapes": "^4.3.2",
|
||||
"chalk": "^4.1.2",
|
||||
"ci-info": "^4.2.0",
|
||||
"exit-x": "^0.2.2",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"jest-changed-files": "30.2.0",
|
||||
"jest-config": "30.2.0",
|
||||
"jest-haste-map": "30.2.0",
|
||||
"jest-message-util": "30.2.0",
|
||||
"jest-regex-util": "30.0.1",
|
||||
"jest-resolve": "30.2.0",
|
||||
"jest-resolve-dependencies": "30.2.0",
|
||||
"jest-runner": "30.2.0",
|
||||
"jest-runtime": "30.2.0",
|
||||
"jest-snapshot": "30.2.0",
|
||||
"jest-util": "30.2.0",
|
||||
"jest-validate": "30.2.0",
|
||||
"jest-watcher": "30.2.0",
|
||||
"micromatch": "^4.0.8",
|
||||
"pretty-format": "30.2.0",
|
||||
"slash": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-sequencer": "30.2.0",
|
||||
"@jest/test-utils": "30.2.0",
|
||||
"@types/graceful-fs": "^4.1.9",
|
||||
"@types/micromatch": "^4.0.9"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"node-notifier": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-core"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jestjs/jest/issues"
|
||||
},
|
||||
"homepage": "https://jestjs.io/",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"ava",
|
||||
"babel",
|
||||
"coverage",
|
||||
"easy",
|
||||
"expect",
|
||||
"facebook",
|
||||
"immersive",
|
||||
"instant",
|
||||
"jasmine",
|
||||
"jest",
|
||||
"jsdom",
|
||||
"mocha",
|
||||
"mocking",
|
||||
"painless",
|
||||
"qunit",
|
||||
"runner",
|
||||
"sandboxed",
|
||||
"snapshot",
|
||||
"tap",
|
||||
"tape",
|
||||
"test",
|
||||
"testing",
|
||||
"typescript",
|
||||
"watch"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/diff-sequences/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/diff-sequences/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
404
node_modules/@jest/diff-sequences/README.md
generated
vendored
Normal file
404
node_modules/@jest/diff-sequences/README.md
generated
vendored
Normal file
@@ -0,0 +1,404 @@
|
||||
# diff-sequences
|
||||
|
||||
Compare items in two sequences to find a **longest common subsequence**.
|
||||
|
||||
The items not in common are the items to delete or insert in a **shortest edit script**.
|
||||
|
||||
To maximize flexibility and minimize memory, you write **callback** functions as configuration:
|
||||
|
||||
**Input** function `isCommon(aIndex, bIndex)` compares items at indexes in the sequences and returns a truthy/falsey value. This package might call your function more than once for some pairs of indexes.
|
||||
|
||||
- Because your function encapsulates **comparison**, this package can compare items according to `===` operator, `Object.is` method, or other criterion.
|
||||
- Because your function encapsulates **sequences**, this package can find differences in arrays, strings, or other data.
|
||||
|
||||
**Output** function `foundSubsequence(nCommon, aCommon, bCommon)` receives the number of adjacent items and starting indexes of each common subsequence. If sequences do not have common items, then this package does not call your function.
|
||||
|
||||
If N is the sum of lengths of sequences and L is length of a longest common subsequence, then D = N – 2L is the number of **differences** in the corresponding shortest edit script.
|
||||
|
||||
[_An O(ND) Difference Algorithm and Its Variations_](http://xmailserver.org/diff2.pdf) by Eugene W. Myers is fast when sequences have **few** differences.
|
||||
|
||||
This package implements the **linear space** variation with optimizations so it is fast even when sequences have **many** differences.
|
||||
|
||||
## Usage
|
||||
|
||||
To add this package as a dependency of a project, do either of the following:
|
||||
|
||||
- `npm install diff-sequences`
|
||||
- `yarn add diff-sequences`
|
||||
|
||||
To use `diff` as the name of the default export from this package, do either of the following:
|
||||
|
||||
- `var diff = require('@jest/diff-sequences').default; // CommonJS modules`
|
||||
- `import diff from '@jest/diff-sequences'; // ECMAScript modules`
|
||||
|
||||
Call `diff` with the **lengths** of sequences and your **callback** functions:
|
||||
|
||||
```js
|
||||
const a = ['a', 'b', 'c', 'a', 'b', 'b', 'a'];
|
||||
const b = ['c', 'b', 'a', 'b', 'a', 'c'];
|
||||
|
||||
function isCommon(aIndex, bIndex) {
|
||||
return a[aIndex] === b[bIndex];
|
||||
}
|
||||
function foundSubsequence(nCommon, aCommon, bCommon) {
|
||||
// see examples
|
||||
}
|
||||
|
||||
diff(a.length, b.length, isCommon, foundSubsequence);
|
||||
```
|
||||
|
||||
## Example of longest common subsequence
|
||||
|
||||
Some sequences (for example, `a` and `b` in the example of usage) have more than one longest common subsequence.
|
||||
|
||||
This package finds the following common items:
|
||||
|
||||
| comparisons of common items | values | output arguments |
|
||||
| :------------------------------- | :--------- | --------------------------: |
|
||||
| `a[2] === b[0]` | `'c'` | `foundSubsequence(1, 2, 0)` |
|
||||
| `a[4] === b[1]` | `'b'` | `foundSubsequence(1, 4, 1)` |
|
||||
| `a[5] === b[3] && a[6] === b[4]` | `'b', 'a'` | `foundSubsequence(2, 5, 3)` |
|
||||
|
||||
The “edit graph” analogy in the Myers paper shows the following common items:
|
||||
|
||||
| comparisons of common items | values |
|
||||
| :------------------------------- | :--------- |
|
||||
| `a[2] === b[0]` | `'c'` |
|
||||
| `a[3] === b[2] && a[4] === b[3]` | `'a', 'b'` |
|
||||
| `a[6] === b[4]` | `'a'` |
|
||||
|
||||
Various packages which implement the Myers algorithm will **always agree** on the **length** of a longest common subsequence, but might **sometimes disagree** on which **items** are in it.
|
||||
|
||||
## Example of callback functions to count common items
|
||||
|
||||
```js
|
||||
// Return length of longest common subsequence according to === operator.
|
||||
function countCommonItems(a, b) {
|
||||
let n = 0;
|
||||
function isCommon(aIndex, bIndex) {
|
||||
return a[aIndex] === b[bIndex];
|
||||
}
|
||||
function foundSubsequence(nCommon) {
|
||||
n += nCommon;
|
||||
}
|
||||
|
||||
diff(a.length, b.length, isCommon, foundSubsequence);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
const commonLength = countCommonItems(
|
||||
['a', 'b', 'c', 'a', 'b', 'b', 'a'],
|
||||
['c', 'b', 'a', 'b', 'a', 'c'],
|
||||
);
|
||||
```
|
||||
|
||||
| category of items | expression | value |
|
||||
| :----------------- | ------------------------: | ----: |
|
||||
| in common | `commonLength` | `4` |
|
||||
| to delete from `a` | `a.length - commonLength` | `3` |
|
||||
| to insert from `b` | `b.length - commonLength` | `2` |
|
||||
|
||||
If the length difference `b.length - a.length` is:
|
||||
|
||||
- negative: its absolute value is the minimum number of items to **delete** from `a`
|
||||
- positive: it is the minimum number of items to **insert** from `b`
|
||||
- zero: there is an **equal** number of items to delete from `a` and insert from `b`
|
||||
- non-zero: there is an equal number of **additional** items to delete from `a` and insert from `b`
|
||||
|
||||
In this example, `6 - 7` is:
|
||||
|
||||
- negative: `1` is the minimum number of items to **delete** from `a`
|
||||
- non-zero: `2` is the number of **additional** items to delete from `a` and insert from `b`
|
||||
|
||||
## Example of callback functions to find common items
|
||||
|
||||
```js
|
||||
// Return array of items in longest common subsequence according to Object.is method.
|
||||
const findCommonItems = (a, b) => {
|
||||
const array = [];
|
||||
diff(
|
||||
a.length,
|
||||
b.length,
|
||||
(aIndex, bIndex) => Object.is(a[aIndex], b[bIndex]),
|
||||
(nCommon, aCommon) => {
|
||||
for (; nCommon !== 0; nCommon -= 1, aCommon += 1) {
|
||||
array.push(a[aCommon]);
|
||||
}
|
||||
},
|
||||
);
|
||||
return array;
|
||||
};
|
||||
|
||||
const commonItems = findCommonItems(
|
||||
['a', 'b', 'c', 'a', 'b', 'b', 'a'],
|
||||
['c', 'b', 'a', 'b', 'a', 'c'],
|
||||
);
|
||||
```
|
||||
|
||||
| `i` | `commonItems[i]` | `aIndex` |
|
||||
| --: | :--------------- | -------: |
|
||||
| `0` | `'c'` | `2` |
|
||||
| `1` | `'b'` | `4` |
|
||||
| `2` | `'b'` | `5` |
|
||||
| `3` | `'a'` | `6` |
|
||||
|
||||
## Example of callback functions to diff index intervals
|
||||
|
||||
Instead of slicing array-like objects, you can adjust indexes in your callback functions.
|
||||
|
||||
```js
|
||||
// Diff index intervals that are half open [start, end) like array slice method.
|
||||
const diffIndexIntervals = (a, aStart, aEnd, b, bStart, bEnd) => {
|
||||
// Validate: 0 <= aStart and aStart <= aEnd and aEnd <= a.length
|
||||
// Validate: 0 <= bStart and bStart <= bEnd and bEnd <= b.length
|
||||
|
||||
diff(
|
||||
aEnd - aStart,
|
||||
bEnd - bStart,
|
||||
(aIndex, bIndex) => Object.is(a[aStart + aIndex], b[bStart + bIndex]),
|
||||
(nCommon, aCommon, bCommon) => {
|
||||
// aStart + aCommon, bStart + bCommon
|
||||
},
|
||||
);
|
||||
|
||||
// After the last common subsequence, do any remaining work.
|
||||
};
|
||||
```
|
||||
|
||||
## Example of callback functions to emulate diff command
|
||||
|
||||
Linux or Unix has a `diff` command to compare files line by line. Its output is a **shortest edit script**:
|
||||
|
||||
- **c**hange adjacent lines from the first file to lines from the second file
|
||||
- **d**elete lines from the first file
|
||||
- **a**ppend or insert lines from the second file
|
||||
|
||||
```js
|
||||
// Given zero-based half-open range [start, end) of array indexes,
|
||||
// return one-based closed range [start + 1, end] as string.
|
||||
const getRange = (start, end) =>
|
||||
start + 1 === end ? `${start + 1}` : `${start + 1},${end}`;
|
||||
|
||||
// Given index intervals of lines to delete or insert, or both, or neither,
|
||||
// push formatted diff lines onto array.
|
||||
const pushDelIns = (aLines, aIndex, aEnd, bLines, bIndex, bEnd, array) => {
|
||||
const deleteLines = aIndex !== aEnd;
|
||||
const insertLines = bIndex !== bEnd;
|
||||
const changeLines = deleteLines && insertLines;
|
||||
if (changeLines) {
|
||||
array.push(`${getRange(aIndex, aEnd)}c${getRange(bIndex, bEnd)}`);
|
||||
} else if (deleteLines) {
|
||||
array.push(`${getRange(aIndex, aEnd)}d${String(bIndex)}`);
|
||||
} else if (insertLines) {
|
||||
array.push(`${String(aIndex)}a${getRange(bIndex, bEnd)}`);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
for (; aIndex !== aEnd; aIndex += 1) {
|
||||
array.push(`< ${aLines[aIndex]}`); // delete is less than
|
||||
}
|
||||
|
||||
if (changeLines) {
|
||||
array.push('---');
|
||||
}
|
||||
|
||||
for (; bIndex !== bEnd; bIndex += 1) {
|
||||
array.push(`> ${bLines[bIndex]}`); // insert is greater than
|
||||
}
|
||||
};
|
||||
|
||||
// Given content of two files, return emulated output of diff utility.
|
||||
const findShortestEditScript = (a, b) => {
|
||||
const aLines = a.split('\n');
|
||||
const bLines = b.split('\n');
|
||||
const aLength = aLines.length;
|
||||
const bLength = bLines.length;
|
||||
|
||||
const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex];
|
||||
|
||||
let aIndex = 0;
|
||||
let bIndex = 0;
|
||||
const array = [];
|
||||
const foundSubsequence = (nCommon, aCommon, bCommon) => {
|
||||
pushDelIns(aLines, aIndex, aCommon, bLines, bIndex, bCommon, array);
|
||||
aIndex = aCommon + nCommon; // number of lines compared in a
|
||||
bIndex = bCommon + nCommon; // number of lines compared in b
|
||||
};
|
||||
|
||||
diff(aLength, bLength, isCommon, foundSubsequence);
|
||||
|
||||
// After the last common subsequence, push remaining change lines.
|
||||
pushDelIns(aLines, aIndex, aLength, bLines, bIndex, bLength, array);
|
||||
|
||||
return array.length === 0 ? '' : `${array.join('\n')}\n`;
|
||||
};
|
||||
```
|
||||
|
||||
## Example of callback functions to format diff lines
|
||||
|
||||
Here is simplified code to format **changed and unchanged lines** in expected and received values after a test fails in Jest:
|
||||
|
||||
```js
|
||||
// Format diff with minus or plus for change lines and space for common lines.
|
||||
const formatDiffLines = (a, b) => {
|
||||
// Jest depends on pretty-format package to serialize objects as strings.
|
||||
// Unindented for comparison to avoid distracting differences:
|
||||
const aLinesUn = format(a, {indent: 0 /*, other options*/}).split('\n');
|
||||
const bLinesUn = format(b, {indent: 0 /*, other options*/}).split('\n');
|
||||
// Indented to display changed and unchanged lines:
|
||||
const aLinesIn = format(a, {indent: 2 /*, other options*/}).split('\n');
|
||||
const bLinesIn = format(b, {indent: 2 /*, other options*/}).split('\n');
|
||||
|
||||
const aLength = aLinesIn.length; // Validate: aLinesUn.length === aLength
|
||||
const bLength = bLinesIn.length; // Validate: bLinesUn.length === bLength
|
||||
|
||||
const isCommon = (aIndex, bIndex) => aLinesUn[aIndex] === bLinesUn[bIndex];
|
||||
|
||||
// Only because the GitHub Flavored Markdown doc collapses adjacent spaces,
|
||||
// this example code and the following table represent spaces as middle dots.
|
||||
let aIndex = 0;
|
||||
let bIndex = 0;
|
||||
const array = [];
|
||||
const foundSubsequence = (nCommon, aCommon, bCommon) => {
|
||||
for (; aIndex !== aCommon; aIndex += 1) {
|
||||
array.push(`-·${aLinesIn[aIndex]}`); // delete is minus
|
||||
}
|
||||
for (; bIndex !== bCommon; bIndex += 1) {
|
||||
array.push(`+·${bLinesIn[bIndex]}`); // insert is plus
|
||||
}
|
||||
for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) {
|
||||
// For common lines, received indentation seems more intuitive.
|
||||
array.push(`··${bLinesIn[bIndex]}`); // common is space
|
||||
}
|
||||
};
|
||||
|
||||
diff(aLength, bLength, isCommon, foundSubsequence);
|
||||
|
||||
// After the last common subsequence, push remaining change lines.
|
||||
for (; aIndex !== aLength; aIndex += 1) {
|
||||
array.push(`-·${aLinesIn[aIndex]}`);
|
||||
}
|
||||
for (; bIndex !== bLength; bIndex += 1) {
|
||||
array.push(`+·${bLinesIn[bIndex]}`);
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
const expected = {
|
||||
searching: '',
|
||||
sorting: {
|
||||
ascending: true,
|
||||
fieldKey: 'what',
|
||||
},
|
||||
};
|
||||
const received = {
|
||||
searching: '',
|
||||
sorting: [
|
||||
{
|
||||
descending: false,
|
||||
fieldKey: 'what',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const diffLines = formatDiffLines(expected, received);
|
||||
```
|
||||
|
||||
If N is the sum of lengths of sequences and L is length of a longest common subsequence, then N – L is length of an array of diff lines. In this example, N is 7 + 9, L is 5, and N – L is 11.
|
||||
|
||||
| `i` | `diffLines[i]` | `aIndex` | `bIndex` |
|
||||
| ---: | :--------------------------------- | -------: | -------: |
|
||||
| `0` | `'··Object {'` | `0` | `0` |
|
||||
| `1` | `'····"searching": "",'` | `1` | `1` |
|
||||
| `2` | `'-···"sorting": Object {'` | `2` | |
|
||||
| `3` | `'-·····"ascending": true,'` | `3` | |
|
||||
| `4` | `'+·····"sorting": Array ['` | | `2` |
|
||||
| `5` | `'+·······Object {'` | | `3` |
|
||||
| `6` | `'+·········"descending": false,'` | | `4` |
|
||||
| `7` | `'··········"fieldKey": "what",'` | `4` | `5` |
|
||||
| `8` | `'········},'` | `5` | `6` |
|
||||
| `9` | `'+·····],'` | | `7` |
|
||||
| `10` | `'··}'` | `6` | `8` |
|
||||
|
||||
## Example of callback functions to find diff items
|
||||
|
||||
Here is simplified code to find changed and unchanged substrings **within adjacent changed lines** in expected and received values after a test fails in Jest:
|
||||
|
||||
```js
|
||||
// Return diff items for strings (compatible with diff-match-patch package).
|
||||
const findDiffItems = (a, b) => {
|
||||
const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex];
|
||||
|
||||
let aIndex = 0;
|
||||
let bIndex = 0;
|
||||
const array = [];
|
||||
const foundSubsequence = (nCommon, aCommon, bCommon) => {
|
||||
if (aIndex !== aCommon) {
|
||||
array.push([-1, a.slice(aIndex, aCommon)]); // delete is -1
|
||||
}
|
||||
if (bIndex !== bCommon) {
|
||||
array.push([1, b.slice(bIndex, bCommon)]); // insert is 1
|
||||
}
|
||||
|
||||
aIndex = aCommon + nCommon; // number of characters compared in a
|
||||
bIndex = bCommon + nCommon; // number of characters compared in b
|
||||
array.push([0, a.slice(aCommon, aIndex)]); // common is 0
|
||||
};
|
||||
|
||||
diff(a.length, b.length, isCommon, foundSubsequence);
|
||||
|
||||
// After the last common subsequence, push remaining change items.
|
||||
if (aIndex !== a.length) {
|
||||
array.push([-1, a.slice(aIndex)]);
|
||||
}
|
||||
if (bIndex !== b.length) {
|
||||
array.push([1, b.slice(bIndex)]);
|
||||
}
|
||||
|
||||
return array;
|
||||
};
|
||||
|
||||
const expectedDeleted = ['"sorting": Object {', '"ascending": true,'].join(
|
||||
'\n',
|
||||
);
|
||||
const receivedInserted = [
|
||||
'"sorting": Array [',
|
||||
'Object {',
|
||||
'"descending": false,',
|
||||
].join('\n');
|
||||
|
||||
const diffItems = findDiffItems(expectedDeleted, receivedInserted);
|
||||
```
|
||||
|
||||
| `i` | `diffItems[i][0]` | `diffItems[i][1]` |
|
||||
| --: | ----------------: | :---------------- |
|
||||
| `0` | `0` | `'"sorting": '` |
|
||||
| `1` | `1` | `'Array [\n'` |
|
||||
| `2` | `0` | `'Object {\n"'` |
|
||||
| `3` | `-1` | `'a'` |
|
||||
| `4` | `1` | `'de'` |
|
||||
| `5` | `0` | `'scending": '` |
|
||||
| `6` | `-1` | `'tru'` |
|
||||
| `7` | `1` | `'fals'` |
|
||||
| `8` | `0` | `'e,'` |
|
||||
|
||||
The length difference `b.length - a.length` is equal to the sum of `diffItems[i][0]` values times `diffItems[i][1]` lengths. In this example, the difference `48 - 38` is equal to the sum `10`.
|
||||
|
||||
| category of diff item | `[0]` | `[1]` lengths | subtotal |
|
||||
| :-------------------- | ----: | -----------------: | -------: |
|
||||
| in common | `0` | `11 + 10 + 11 + 2` | `0` |
|
||||
| to delete from `a` | `–1` | `1 + 3` | `-4` |
|
||||
| to insert from `b` | `1` | `8 + 2 + 4` | `14` |
|
||||
|
||||
Instead of formatting the changed substrings with escape codes for colors in the `foundSubsequence` function to save memory, this example spends memory to **gain flexibility** before formatting, so a separate heuristic algorithm might modify the generic array of diff items to show changes more clearly:
|
||||
|
||||
| `i` | `diffItems[i][0]` | `diffItems[i][1]` |
|
||||
| --: | ----------------: | :---------------- |
|
||||
| `6` | `-1` | `'true'` |
|
||||
| `7` | `1` | `'false'` |
|
||||
| `8` | `0` | `','` |
|
||||
|
||||
For expected and received strings of serialized data, the result of finding changed **lines**, and then finding changed **substrings** within adjacent changed lines (as in the preceding two examples) sometimes displays the changes in a more intuitive way than the result of finding changed substrings, and then splitting them into changed and unchanged lines.
|
||||
41
node_modules/@jest/diff-sequences/package.json
generated
vendored
Normal file
41
node_modules/@jest/diff-sequences/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@jest/diff-sequences",
|
||||
"version": "30.0.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/diff-sequences"
|
||||
},
|
||||
"license": "MIT",
|
||||
"description": "Compare items in two sequences to find a longest common subsequence",
|
||||
"keywords": [
|
||||
"fast",
|
||||
"linear",
|
||||
"space",
|
||||
"callback",
|
||||
"diff"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fast-check/jest": "^2.1.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"diff": "^7.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "5ce865b4060189fe74cd486544816c079194a0f7"
|
||||
}
|
||||
22
node_modules/@jest/environment/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/environment/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
32
node_modules/@jest/environment/package.json
generated
vendored
Normal file
32
node_modules/@jest/environment/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@jest/environment",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-environment"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/fake-timers": "30.2.0",
|
||||
"@jest/types": "30.2.0",
|
||||
"@types/node": "*",
|
||||
"jest-mock": "30.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/expect-utils/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/expect-utils/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
5
node_modules/@jest/expect-utils/README.md
generated
vendored
Normal file
5
node_modules/@jest/expect-utils/README.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# `@jest/expect-utils`
|
||||
|
||||
This module exports some utils for the `expect` function used in [Jest](https://jestjs.io/).
|
||||
|
||||
You probably don't want to use this package directly. E.g. if you're writing [custom matcher](https://jestjs.io/docs/expect#expectextendmatchers), you should use the injected [`this.equals`](https://jestjs.io/docs/expect#thisequalsa-b).
|
||||
35
node_modules/@jest/expect-utils/package.json
generated
vendored
Normal file
35
node_modules/@jest/expect-utils/package.json
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@jest/expect-utils",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/expect-utils"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/get-type": "30.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"immutable": "^5.1.2",
|
||||
"jest-matcher-utils": "30.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/expect/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/expect/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
5
node_modules/@jest/expect/README.md
generated
vendored
Normal file
5
node_modules/@jest/expect/README.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# @jest/expect
|
||||
|
||||
This package extends `expect` library with `jest-snapshot` matchers. It exports `jestExpect` object, which can be used as standalone replacement of `expect`.
|
||||
|
||||
The `jestExpect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect).
|
||||
32
node_modules/@jest/expect/package.json
generated
vendored
Normal file
32
node_modules/@jest/expect/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@jest/expect",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-expect"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"expect": "30.2.0",
|
||||
"jest-snapshot": "30.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/fake-timers/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/fake-timers/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
40
node_modules/@jest/fake-timers/package.json
generated
vendored
Normal file
40
node_modules/@jest/fake-timers/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "@jest/fake-timers",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-fake-timers"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/types": "30.2.0",
|
||||
"@sinonjs/fake-timers": "^13.0.0",
|
||||
"@types/node": "*",
|
||||
"jest-message-util": "30.2.0",
|
||||
"jest-mock": "30.2.0",
|
||||
"jest-util": "30.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-utils": "30.2.0",
|
||||
"@types/sinonjs__fake-timers": "^8.1.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/get-type/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/get-type/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
29
node_modules/@jest/get-type/package.json
generated
vendored
Normal file
29
node_modules/@jest/get-type/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@jest/get-type",
|
||||
"description": "A utility function to get the type of a value",
|
||||
"version": "30.1.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-get-type"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "4d5f41d0885c1d9630c81b4fd47f74ab0615e18f"
|
||||
}
|
||||
22
node_modules/@jest/globals/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/globals/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
32
node_modules/@jest/globals/package.json
generated
vendored
Normal file
32
node_modules/@jest/globals/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@jest/globals",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-globals"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/environment": "30.2.0",
|
||||
"@jest/expect": "30.2.0",
|
||||
"@jest/types": "30.2.0",
|
||||
"jest-mock": "30.2.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/pattern/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/pattern/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@jest/pattern/README.md
generated
vendored
Normal file
3
node_modules/@jest/pattern/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# @jest/pattern
|
||||
|
||||
`@jest/pattern` is a helper library for the jest library that implements the logic for parsing and matching patterns.
|
||||
5
node_modules/@jest/pattern/api-extractor.json
generated
vendored
Normal file
5
node_modules/@jest/pattern/api-extractor.json
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "../../api-extractor.json",
|
||||
"mainEntryPointFilePath": "/Users/cpojer/Dropbox/Projects/jest/packages/jest-pattern/build/index.d.ts",
|
||||
"projectFolder": "/Users/cpojer/Dropbox/Projects/jest/packages/jest-pattern"
|
||||
}
|
||||
32
node_modules/@jest/pattern/package.json
generated
vendored
Normal file
32
node_modules/@jest/pattern/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@jest/pattern",
|
||||
"version": "30.0.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-pattern"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"jest-regex-util": "30.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "5ce865b4060189fe74cd486544816c079194a0f7"
|
||||
}
|
||||
132
node_modules/@jest/pattern/src/TestPathPatterns.ts
generated
vendored
Normal file
132
node_modules/@jest/pattern/src/TestPathPatterns.ts
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import {replacePathSepForRegex} from 'jest-regex-util';
|
||||
|
||||
export class TestPathPatterns {
|
||||
constructor(readonly patterns: Array<string>) {}
|
||||
|
||||
/**
|
||||
* Return true if there are any patterns.
|
||||
*/
|
||||
isSet(): boolean {
|
||||
return this.patterns.length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the patterns are valid.
|
||||
*/
|
||||
isValid(): boolean {
|
||||
return this.toExecutor({
|
||||
// isValid() doesn't require rootDir to be accurate, so just
|
||||
// specify a dummy rootDir here
|
||||
rootDir: '/',
|
||||
}).isValid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a human-friendly version of the pattern regex.
|
||||
*/
|
||||
toPretty(): string {
|
||||
return this.patterns.join('|');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a TestPathPatternsExecutor that can execute the patterns.
|
||||
*/
|
||||
toExecutor(
|
||||
options: TestPathPatternsExecutorOptions,
|
||||
): TestPathPatternsExecutor {
|
||||
return new TestPathPatternsExecutor(this, options);
|
||||
}
|
||||
|
||||
/** For jest serializers */
|
||||
toJSON(): any {
|
||||
return {
|
||||
patterns: this.patterns,
|
||||
type: 'TestPathPatterns',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export type TestPathPatternsExecutorOptions = {
|
||||
rootDir: string;
|
||||
};
|
||||
|
||||
export class TestPathPatternsExecutor {
|
||||
constructor(
|
||||
readonly patterns: TestPathPatterns,
|
||||
private readonly options: TestPathPatternsExecutorOptions,
|
||||
) {}
|
||||
|
||||
private toRegex(s: string): RegExp {
|
||||
return new RegExp(s, 'i');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there are any patterns.
|
||||
*/
|
||||
isSet(): boolean {
|
||||
return this.patterns.isSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the patterns are valid.
|
||||
*/
|
||||
isValid(): boolean {
|
||||
try {
|
||||
for (const p of this.patterns.patterns) {
|
||||
this.toRegex(p);
|
||||
}
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the given ABSOLUTE path matches the patterns.
|
||||
*
|
||||
* Throws an error if the patterns form an invalid regex (see `validate`).
|
||||
*/
|
||||
isMatch(absPath: string): boolean {
|
||||
const relPath = path.relative(this.options.rootDir || '/', absPath);
|
||||
|
||||
if (this.patterns.patterns.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const p of this.patterns.patterns) {
|
||||
const pathToTest = path.isAbsolute(p) ? absPath : relPath;
|
||||
|
||||
// special case: ./foo.spec.js (and .\foo.spec.js on Windows) should
|
||||
// match /^foo.spec.js/ after stripping root dir
|
||||
let regexStr = p.replace(/^\.\//, '^');
|
||||
if (path.sep === '\\') {
|
||||
regexStr = regexStr.replace(/^\.\\/, '^');
|
||||
}
|
||||
|
||||
regexStr = replacePathSepForRegex(regexStr);
|
||||
if (this.toRegex(regexStr).test(pathToTest)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.toRegex(regexStr).test(absPath)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a human-friendly version of the pattern regex.
|
||||
*/
|
||||
toPretty(): string {
|
||||
return this.patterns.toPretty();
|
||||
}
|
||||
}
|
||||
259
node_modules/@jest/pattern/src/__tests__/TestPathPatterns.test.ts
generated
vendored
Normal file
259
node_modules/@jest/pattern/src/__tests__/TestPathPatterns.test.ts
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import {
|
||||
TestPathPatterns,
|
||||
TestPathPatternsExecutor,
|
||||
type TestPathPatternsExecutorOptions,
|
||||
} from '../TestPathPatterns';
|
||||
|
||||
const mockSep: jest.Mock<() => string> = jest.fn();
|
||||
const mockIsAbsolute: jest.Mock<(p: string) => boolean> = jest.fn();
|
||||
const mockRelative: jest.Mock<(from: string, to: string) => string> = jest.fn();
|
||||
jest.mock('path', () => {
|
||||
const actualPath = jest.requireActual('path');
|
||||
return {
|
||||
...actualPath,
|
||||
isAbsolute(p) {
|
||||
return mockIsAbsolute(p) || actualPath.isAbsolute(p);
|
||||
},
|
||||
relative(from, to) {
|
||||
return mockRelative(from, to) || actualPath.relative(from, to);
|
||||
},
|
||||
get sep() {
|
||||
return mockSep() || actualPath.sep;
|
||||
},
|
||||
} as typeof path;
|
||||
});
|
||||
const forcePosix = () => {
|
||||
mockSep.mockReturnValue(path.posix.sep);
|
||||
mockIsAbsolute.mockImplementation(path.posix.isAbsolute);
|
||||
mockRelative.mockImplementation(path.posix.relative);
|
||||
};
|
||||
const forceWindows = () => {
|
||||
mockSep.mockReturnValue(path.win32.sep);
|
||||
mockIsAbsolute.mockImplementation(path.win32.isAbsolute);
|
||||
mockRelative.mockImplementation(path.win32.relative);
|
||||
};
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
forcePosix();
|
||||
});
|
||||
|
||||
const config = {rootDir: ''};
|
||||
|
||||
interface TestPathPatternsLike {
|
||||
isSet(): boolean;
|
||||
isValid(): boolean;
|
||||
toPretty(): string;
|
||||
}
|
||||
|
||||
const testPathPatternsLikeTests = (
|
||||
makePatterns: (
|
||||
patterns: Array<string>,
|
||||
options: TestPathPatternsExecutorOptions,
|
||||
) => TestPathPatternsLike,
|
||||
) => {
|
||||
describe('isSet', () => {
|
||||
it('returns false if no patterns specified', () => {
|
||||
const testPathPatterns = makePatterns([], config);
|
||||
expect(testPathPatterns.isSet()).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true if patterns specified', () => {
|
||||
const testPathPatterns = makePatterns(['a'], config);
|
||||
expect(testPathPatterns.isSet()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isValid', () => {
|
||||
it('succeeds for empty patterns', () => {
|
||||
const testPathPatterns = makePatterns([], config);
|
||||
expect(testPathPatterns.isValid()).toBe(true);
|
||||
});
|
||||
|
||||
it('succeeds for valid patterns', () => {
|
||||
const testPathPatterns = makePatterns(['abc+', 'z.*'], config);
|
||||
expect(testPathPatterns.isValid()).toBe(true);
|
||||
});
|
||||
|
||||
it('fails for at least one invalid pattern', () => {
|
||||
const testPathPatterns = makePatterns(['abc+', '(', 'z.*'], config);
|
||||
expect(testPathPatterns.isValid()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('toPretty', () => {
|
||||
it('renders a human-readable string', () => {
|
||||
const testPathPatterns = makePatterns(['a/b', 'c/d'], config);
|
||||
expect(testPathPatterns.toPretty()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
describe('TestPathPatterns', () => {
|
||||
testPathPatternsLikeTests(
|
||||
(patterns: Array<string>, _: TestPathPatternsExecutorOptions) =>
|
||||
new TestPathPatterns(patterns),
|
||||
);
|
||||
});
|
||||
|
||||
describe('TestPathPatternsExecutor', () => {
|
||||
const makeExecutor = (
|
||||
patterns: Array<string>,
|
||||
options: TestPathPatternsExecutorOptions,
|
||||
) => new TestPathPatternsExecutor(new TestPathPatterns(patterns), options);
|
||||
|
||||
testPathPatternsLikeTests(makeExecutor);
|
||||
|
||||
describe('isMatch', () => {
|
||||
it('returns true with no patterns', () => {
|
||||
const testPathPatterns = makeExecutor([], config);
|
||||
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for same path', () => {
|
||||
const testPathPatterns = makeExecutor(['/a/b'], config);
|
||||
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for same path with case insensitive', () => {
|
||||
const testPathPatternsUpper = makeExecutor(['/A/B'], config);
|
||||
expect(testPathPatternsUpper.isMatch('/a/b')).toBe(true);
|
||||
expect(testPathPatternsUpper.isMatch('/A/B')).toBe(true);
|
||||
|
||||
const testPathPatternsLower = makeExecutor(['/a/b'], config);
|
||||
expect(testPathPatternsLower.isMatch('/A/B')).toBe(true);
|
||||
expect(testPathPatternsLower.isMatch('/a/b')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for contained path', () => {
|
||||
const testPathPatterns = makeExecutor(['b/c'], config);
|
||||
expect(testPathPatterns.isMatch('/a/b/c/d')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for explicit relative path', () => {
|
||||
const testPathPatterns = makeExecutor(['./b/c'], {
|
||||
rootDir: '/a',
|
||||
});
|
||||
expect(testPathPatterns.isMatch('/a/b/c')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for explicit relative path for Windows with ./', () => {
|
||||
forceWindows();
|
||||
const testPathPatterns = makeExecutor(['./b/c'], {
|
||||
rootDir: 'C:\\a',
|
||||
});
|
||||
expect(testPathPatterns.isMatch('C:\\a\\b\\c')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for explicit relative path for Windows with .\\', () => {
|
||||
forceWindows();
|
||||
const testPathPatterns = makeExecutor(['.\\b\\c'], {
|
||||
rootDir: 'C:\\a',
|
||||
});
|
||||
expect(testPathPatterns.isMatch('C:\\a\\b\\c')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for partial file match', () => {
|
||||
const testPathPatterns = makeExecutor(['aaa'], config);
|
||||
expect(testPathPatterns.isMatch('/foo/..aaa..')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/..aaa')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/aaa..')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true for path suffix', () => {
|
||||
const testPathPatterns = makeExecutor(['c/d'], config);
|
||||
expect(testPathPatterns.isMatch('/a/b/c/d')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true if regex matches', () => {
|
||||
const testPathPatterns = makeExecutor(['ab*c?'], config);
|
||||
|
||||
expect(testPathPatterns.isMatch('/foo/a')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/ab')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/abb')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/ac')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/abc')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/abbc')).toBe(true);
|
||||
|
||||
expect(testPathPatterns.isMatch('/foo/bc')).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true only if matches relative path', () => {
|
||||
const rootDir = '/home/myuser/';
|
||||
|
||||
const testPathPatterns = makeExecutor(['home'], {
|
||||
rootDir,
|
||||
});
|
||||
expect(
|
||||
testPathPatterns.isMatch(
|
||||
path.relative(rootDir, '/home/myuser/LoginPage.js'),
|
||||
),
|
||||
).toBe(false);
|
||||
expect(
|
||||
testPathPatterns.isMatch(
|
||||
path.relative(rootDir, '/home/myuser/HomePage.js'),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('matches absolute paths regardless of rootDir', () => {
|
||||
forcePosix();
|
||||
const testPathPatterns = makeExecutor(['/a/b'], {
|
||||
rootDir: '/foo/bar',
|
||||
});
|
||||
expect(testPathPatterns.isMatch('/a/b')).toBe(true);
|
||||
});
|
||||
|
||||
it('matches absolute paths for Windows', () => {
|
||||
forceWindows();
|
||||
const testPathPatterns = makeExecutor(['C:\\a\\b'], {
|
||||
rootDir: 'C:\\foo\\bar',
|
||||
});
|
||||
expect(testPathPatterns.isMatch('C:\\a\\b')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns true if match any paths', () => {
|
||||
const testPathPatterns = makeExecutor(['a/b', 'c/d'], config);
|
||||
|
||||
expect(testPathPatterns.isMatch('/foo/a/b')).toBe(true);
|
||||
expect(testPathPatterns.isMatch('/foo/c/d')).toBe(true);
|
||||
|
||||
expect(testPathPatterns.isMatch('/foo/a')).toBe(false);
|
||||
expect(testPathPatterns.isMatch('/foo/b/c')).toBe(false);
|
||||
});
|
||||
|
||||
it('does not normalize Windows paths on POSIX', () => {
|
||||
forcePosix();
|
||||
const testPathPatterns = makeExecutor(['a\\z', 'a\\\\z'], config);
|
||||
expect(testPathPatterns.isMatch('/foo/a/z')).toBe(false);
|
||||
});
|
||||
|
||||
it('normalizes paths for Windows', () => {
|
||||
forceWindows();
|
||||
const testPathPatterns = makeExecutor(['a/b'], config);
|
||||
expect(testPathPatterns.isMatch('C:\\foo\\a\\b')).toBe(true);
|
||||
});
|
||||
|
||||
it('matches absolute path with absPath', () => {
|
||||
const pattern = '^/home/app/';
|
||||
const rootDir = '/home/app';
|
||||
const absolutePath = '/home/app/packages/';
|
||||
|
||||
const testPathPatterns = makeExecutor([pattern], {
|
||||
rootDir,
|
||||
});
|
||||
|
||||
const relativePath = path.relative(rootDir, absolutePath);
|
||||
|
||||
expect(testPathPatterns.isMatch(relativePath)).toBe(false);
|
||||
expect(testPathPatterns.isMatch(absolutePath)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
5
node_modules/@jest/pattern/src/__tests__/__snapshots__/TestPathPatterns.test.ts.snap
generated
vendored
Normal file
5
node_modules/@jest/pattern/src/__tests__/__snapshots__/TestPathPatterns.test.ts.snap
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`TestPathPatterns toPretty renders a human-readable string 1`] = `"a/b|c/d"`;
|
||||
|
||||
exports[`TestPathPatternsExecutor toPretty renders a human-readable string 1`] = `"a/b|c/d"`;
|
||||
12
node_modules/@jest/pattern/src/index.ts
generated
vendored
Normal file
12
node_modules/@jest/pattern/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export {
|
||||
TestPathPatterns,
|
||||
TestPathPatternsExecutor,
|
||||
type TestPathPatternsExecutorOptions,
|
||||
} from './TestPathPatterns';
|
||||
10
node_modules/@jest/pattern/tsconfig.json
generated
vendored
Normal file
10
node_modules/@jest/pattern/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "build"
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"exclude": ["./**/__tests__/**/*"],
|
||||
"references": [{"path": "../jest-regex-util"}]
|
||||
}
|
||||
22
node_modules/@jest/reporters/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/reporters/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
BIN
node_modules/@jest/reporters/assets/jest_logo.png
generated
vendored
Normal file
BIN
node_modules/@jest/reporters/assets/jest_logo.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
80
node_modules/@jest/reporters/package.json
generated
vendored
Normal file
80
node_modules/@jest/reporters/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "@jest/reporters",
|
||||
"description": "Jest's reporters",
|
||||
"version": "30.2.0",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bcoe/v8-coverage": "^0.2.3",
|
||||
"@jest/console": "30.2.0",
|
||||
"@jest/test-result": "30.2.0",
|
||||
"@jest/transform": "30.2.0",
|
||||
"@jest/types": "30.2.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"@types/node": "*",
|
||||
"chalk": "^4.1.2",
|
||||
"collect-v8-coverage": "^1.0.2",
|
||||
"exit-x": "^0.2.2",
|
||||
"glob": "^10.3.10",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"istanbul-lib-coverage": "^3.0.0",
|
||||
"istanbul-lib-instrument": "^6.0.0",
|
||||
"istanbul-lib-report": "^3.0.0",
|
||||
"istanbul-lib-source-maps": "^5.0.0",
|
||||
"istanbul-reports": "^3.1.3",
|
||||
"jest-message-util": "30.2.0",
|
||||
"jest-util": "30.2.0",
|
||||
"jest-worker": "30.2.0",
|
||||
"slash": "^3.0.0",
|
||||
"string-length": "^4.0.2",
|
||||
"v8-to-istanbul": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/pattern": "30.0.1",
|
||||
"@jest/test-utils": "30.2.0",
|
||||
"@types/graceful-fs": "^4.1.9",
|
||||
"@types/istanbul-lib-coverage": "^2.0.6",
|
||||
"@types/istanbul-lib-instrument": "^1.7.7",
|
||||
"@types/istanbul-lib-report": "^3.0.3",
|
||||
"@types/istanbul-lib-source-maps": "^4.0.4",
|
||||
"@types/istanbul-reports": "^3.0.4",
|
||||
"@types/node-notifier": "^8.0.5",
|
||||
"jest-resolve": "30.2.0",
|
||||
"mock-fs": "^5.5.0",
|
||||
"node-notifier": "^10.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"node-notifier": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-reporters"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jestjs/jest/issues"
|
||||
},
|
||||
"homepage": "https://jestjs.io/",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/schemas/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/schemas/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
3
node_modules/@jest/schemas/README.md
generated
vendored
Normal file
3
node_modules/@jest/schemas/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@jest/schemas`
|
||||
|
||||
Experimental and currently incomplete module for JSON schemas for [Jest's](https://jestjs.io/) configuration.
|
||||
31
node_modules/@jest/schemas/package.json
generated
vendored
Normal file
31
node_modules/@jest/schemas/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@jest/schemas",
|
||||
"version": "30.0.5",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-schemas"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sinclair/typebox": "^0.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "22236cf58b66039f81893537c90dee290bab427f"
|
||||
}
|
||||
22
node_modules/@jest/snapshot-utils/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/snapshot-utils/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
5
node_modules/@jest/snapshot-utils/api-extractor.json
generated
vendored
Normal file
5
node_modules/@jest/snapshot-utils/api-extractor.json
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "../../api-extractor.json",
|
||||
"mainEntryPointFilePath": "/Users/cpojer/Dropbox/Projects/jest/packages/jest-snapshot-utils/build/index.d.ts",
|
||||
"projectFolder": "/Users/cpojer/Dropbox/Projects/jest/packages/jest-snapshot-utils"
|
||||
}
|
||||
38
node_modules/@jest/snapshot-utils/package.json
generated
vendored
Normal file
38
node_modules/@jest/snapshot-utils/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@jest/snapshot-utils",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-snapshot-utils"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/types": "30.2.0",
|
||||
"chalk": "^4.1.2",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"natural-compare": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/graceful-fs": "^4.1.9",
|
||||
"@types/natural-compare": "^1.4.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
239
node_modules/@jest/snapshot-utils/src/__tests__/utils.test.ts
generated
vendored
Normal file
239
node_modules/@jest/snapshot-utils/src/__tests__/utils.test.ts
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
jest.mock('graceful-fs', () => ({
|
||||
...jest.createMockFromModule<typeof import('fs')>('fs'),
|
||||
existsSync: jest.fn().mockReturnValue(true),
|
||||
}));
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import {
|
||||
SNAPSHOT_GUIDE_LINK,
|
||||
SNAPSHOT_VERSION,
|
||||
SNAPSHOT_VERSION_WARNING,
|
||||
getSnapshotData,
|
||||
keyToTestName,
|
||||
saveSnapshotFile,
|
||||
testNameToKey,
|
||||
} from '../utils';
|
||||
|
||||
test('keyToTestName()', () => {
|
||||
expect(keyToTestName('abc cde 12')).toBe('abc cde');
|
||||
expect(keyToTestName('abc cde 12')).toBe('abc cde ');
|
||||
expect(keyToTestName('test with\\r\\nCRLF 1')).toBe('test with\r\nCRLF');
|
||||
expect(keyToTestName('test with\\rCR 1')).toBe('test with\rCR');
|
||||
expect(keyToTestName('test with\\nLF 1')).toBe('test with\nLF');
|
||||
expect(() => keyToTestName('abc cde')).toThrow(
|
||||
'Snapshot keys must end with a number.',
|
||||
);
|
||||
});
|
||||
|
||||
test('testNameToKey', () => {
|
||||
expect(testNameToKey('abc cde', 1)).toBe('abc cde 1');
|
||||
expect(testNameToKey('abc cde ', 12)).toBe('abc cde 12');
|
||||
});
|
||||
|
||||
test('testNameToKey escapes line endings to prevent collisions', () => {
|
||||
expect(testNameToKey('test with\r\nCRLF', 1)).toBe('test with\\r\\nCRLF 1');
|
||||
expect(testNameToKey('test with\rCR', 1)).toBe('test with\\rCR 1');
|
||||
expect(testNameToKey('test with\nLF', 1)).toBe('test with\\nLF 1');
|
||||
|
||||
expect(testNameToKey('test\r\n', 1)).not.toBe(testNameToKey('test\r', 1));
|
||||
expect(testNameToKey('test\r\n', 1)).not.toBe(testNameToKey('test\n', 1));
|
||||
expect(testNameToKey('test\r', 1)).not.toBe(testNameToKey('test\n', 1));
|
||||
});
|
||||
|
||||
test('keyToTestName reverses testNameToKey transformation', () => {
|
||||
const testCases = [
|
||||
'simple test',
|
||||
'test with\r\nCRLF',
|
||||
'test with\rCR only',
|
||||
'test with\nLF only',
|
||||
'mixed\r\nline\rendings\n',
|
||||
'test\r',
|
||||
'test\r\n',
|
||||
'test\n',
|
||||
];
|
||||
|
||||
for (const testName of testCases) {
|
||||
const key = testNameToKey(testName, 1);
|
||||
const recovered = keyToTestName(key);
|
||||
expect(recovered).toBe(testName);
|
||||
}
|
||||
});
|
||||
|
||||
test('saveSnapshotFile() works with \r\n', () => {
|
||||
const filename = path.join(__dirname, 'remove-newlines.snap');
|
||||
const data = {
|
||||
myKey: '<div>\r\n</div>',
|
||||
};
|
||||
|
||||
saveSnapshotFile(data, filename);
|
||||
expect(fs.writeFileSync).toHaveBeenCalledWith(
|
||||
filename,
|
||||
`// Jest Snapshot v1, ${SNAPSHOT_GUIDE_LINK}\n\n` +
|
||||
'exports[`myKey`] = `<div>\n</div>`;\n',
|
||||
);
|
||||
});
|
||||
|
||||
test('saveSnapshotFile() works with \r', () => {
|
||||
const filename = path.join(__dirname, 'remove-newlines.snap');
|
||||
const data = {
|
||||
myKey: '<div>\r</div>',
|
||||
};
|
||||
|
||||
saveSnapshotFile(data, filename);
|
||||
expect(fs.writeFileSync).toHaveBeenCalledWith(
|
||||
filename,
|
||||
`// Jest Snapshot v1, ${SNAPSHOT_GUIDE_LINK}\n\n` +
|
||||
'exports[`myKey`] = `<div>\n</div>`;\n',
|
||||
);
|
||||
});
|
||||
|
||||
test('getSnapshotData() throws when no snapshot version', () => {
|
||||
const filename = path.join(__dirname, 'old-snapshot.snap');
|
||||
jest
|
||||
.mocked(fs.readFileSync)
|
||||
.mockReturnValue('exports[`myKey`] = `<div>\n</div>`;\n');
|
||||
const update = 'none';
|
||||
|
||||
expect(() => getSnapshotData(filename, update)).toThrow(
|
||||
chalk.red(
|
||||
`${chalk.bold('Outdated snapshot')}: No snapshot header found. ` +
|
||||
'Jest 19 introduced versioned snapshots to ensure all developers on ' +
|
||||
'a project are using the same version of Jest. ' +
|
||||
'Please update all snapshots during this upgrade of Jest.\n\n',
|
||||
) + SNAPSHOT_VERSION_WARNING,
|
||||
);
|
||||
});
|
||||
|
||||
test('getSnapshotData() throws for older snapshot version', () => {
|
||||
const filename = path.join(__dirname, 'old-snapshot.snap');
|
||||
jest
|
||||
.mocked(fs.readFileSync)
|
||||
.mockReturnValue(
|
||||
`// Jest Snapshot v0.99, ${SNAPSHOT_GUIDE_LINK}\n\n` +
|
||||
'exports[`myKey`] = `<div>\n</div>`;\n',
|
||||
);
|
||||
const update = 'none';
|
||||
|
||||
expect(() => getSnapshotData(filename, update)).toThrow(
|
||||
`${chalk.red(
|
||||
`${chalk.red.bold('Outdated snapshot')}: The version of the snapshot ` +
|
||||
'file associated with this test is outdated. The snapshot file ' +
|
||||
'version ensures that all developers on a project are using ' +
|
||||
'the same version of Jest. ' +
|
||||
'Please update all snapshots during this upgrade of Jest.',
|
||||
)}\n\nExpected: v${SNAPSHOT_VERSION}\n` +
|
||||
`Received: v0.99\n\n${SNAPSHOT_VERSION_WARNING}`,
|
||||
);
|
||||
});
|
||||
|
||||
test.each([
|
||||
['Linux', '\n'],
|
||||
['Windows', '\r\n'],
|
||||
])(
|
||||
'getSnapshotData() throws for newer snapshot version with %s line endings',
|
||||
(_: string, fileEol: string) => {
|
||||
const filename = path.join(__dirname, 'old-snapshot.snap');
|
||||
jest
|
||||
.mocked(fs.readFileSync)
|
||||
.mockReturnValue(
|
||||
`// Jest Snapshot v2, ${SNAPSHOT_GUIDE_LINK}${fileEol}${fileEol}` +
|
||||
`exports[\`myKey\`] = \`<div>${fileEol}</div>\`;${fileEol}`,
|
||||
);
|
||||
const update = 'none';
|
||||
|
||||
expect(() => getSnapshotData(filename, update)).toThrow(
|
||||
`${chalk.red(
|
||||
`${chalk.red.bold('Outdated Jest version')}: The version of this ` +
|
||||
'snapshot file indicates that this project is meant to be used ' +
|
||||
'with a newer version of Jest. ' +
|
||||
'The snapshot file version ensures that all developers on a project ' +
|
||||
'are using the same version of Jest. ' +
|
||||
'Please update your version of Jest and re-run the tests.',
|
||||
)}\n\nExpected: v${SNAPSHOT_VERSION}\nReceived: v2`,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test('getSnapshotData() throws for deprecated snapshot guide link', () => {
|
||||
const deprecatedGuideLink = 'https://goo.gl/fbAQLP';
|
||||
const filename = path.join(__dirname, 'old-snapshot.snap');
|
||||
jest
|
||||
.mocked(fs.readFileSync)
|
||||
.mockReturnValue(
|
||||
`// Jest Snapshot v1, ${deprecatedGuideLink}\n\n` +
|
||||
'exports[`myKey`] = `<div>\n</div>`;\n',
|
||||
);
|
||||
const update = 'none';
|
||||
|
||||
expect(() => getSnapshotData(filename, update)).toThrow(
|
||||
`${chalk.red(
|
||||
`${chalk.red.bold(
|
||||
'Outdated guide link',
|
||||
)}: The snapshot guide link at the top of this snapshot is outdated. ` +
|
||||
'Please update all snapshots during this upgrade of Jest.',
|
||||
)}\n\nExpected: ${SNAPSHOT_GUIDE_LINK}\n` +
|
||||
`Received: ${deprecatedGuideLink}`,
|
||||
);
|
||||
});
|
||||
|
||||
test('getSnapshotData() does not throw for when updating', () => {
|
||||
const filename = path.join(__dirname, 'old-snapshot.snap');
|
||||
jest
|
||||
.mocked(fs.readFileSync)
|
||||
.mockReturnValue('exports[`myKey`] = `<div>\n</div>`;\n');
|
||||
const update = 'all';
|
||||
|
||||
expect(() => getSnapshotData(filename, update)).not.toThrow();
|
||||
});
|
||||
|
||||
test('getSnapshotData() marks invalid snapshot dirty when updating', () => {
|
||||
const filename = path.join(__dirname, 'old-snapshot.snap');
|
||||
jest
|
||||
.mocked(fs.readFileSync)
|
||||
.mockReturnValue('exports[`myKey`] = `<div>\n</div>`;\n');
|
||||
const update = 'all';
|
||||
|
||||
expect(getSnapshotData(filename, update)).toMatchObject({dirty: true});
|
||||
});
|
||||
|
||||
test('getSnapshotData() marks valid snapshot not dirty when updating', () => {
|
||||
const filename = path.join(__dirname, 'old-snapshot.snap');
|
||||
jest
|
||||
.mocked(fs.readFileSync)
|
||||
.mockReturnValue(
|
||||
`// Jest Snapshot v${SNAPSHOT_VERSION}, ${SNAPSHOT_GUIDE_LINK}\n\n` +
|
||||
'exports[`myKey`] = `<div>\n</div>`;\n',
|
||||
);
|
||||
const update = 'all';
|
||||
|
||||
expect(getSnapshotData(filename, update)).toMatchObject({dirty: false});
|
||||
});
|
||||
|
||||
test('escaping', () => {
|
||||
const filename = path.join(__dirname, 'escaping.snap');
|
||||
const data = '"\'\\';
|
||||
const writeFileSync = jest.mocked(fs.writeFileSync);
|
||||
|
||||
writeFileSync.mockReset();
|
||||
saveSnapshotFile({key: data}, filename);
|
||||
const writtenData = writeFileSync.mock.calls[0][1];
|
||||
expect(writtenData).toBe(
|
||||
`// Jest Snapshot v1, ${SNAPSHOT_GUIDE_LINK}\n\n` +
|
||||
'exports[`key`] = `"\'\\\\`;\n',
|
||||
);
|
||||
|
||||
// eslint-disable-next-line no-eval
|
||||
const readData = eval(`var exports = {}; ${writtenData} exports`);
|
||||
expect(readData).toEqual({key: data});
|
||||
const snapshotData = readData.key;
|
||||
expect(data).toEqual(snapshotData);
|
||||
});
|
||||
9
node_modules/@jest/snapshot-utils/src/index.ts
generated
vendored
Normal file
9
node_modules/@jest/snapshot-utils/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export * from './utils';
|
||||
export * from './types';
|
||||
8
node_modules/@jest/snapshot-utils/src/types.ts
generated
vendored
Normal file
8
node_modules/@jest/snapshot-utils/src/types.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export type SnapshotData = Record<string, string>;
|
||||
200
node_modules/@jest/snapshot-utils/src/utils.ts
generated
vendored
Normal file
200
node_modules/@jest/snapshot-utils/src/utils.ts
generated
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import * as path from 'path';
|
||||
import chalk from 'chalk';
|
||||
import * as fs from 'graceful-fs';
|
||||
import naturalCompare from 'natural-compare';
|
||||
import type {Config} from '@jest/types';
|
||||
import type {SnapshotData} from './types';
|
||||
|
||||
export const SNAPSHOT_VERSION = '1';
|
||||
const SNAPSHOT_HEADER_REGEXP = /^\/\/ Jest Snapshot v(.+), (.+)$/m;
|
||||
export const SNAPSHOT_GUIDE_LINK = 'https://jestjs.io/docs/snapshot-testing';
|
||||
export const SNAPSHOT_VERSION_WARNING = chalk.yellow(
|
||||
`${chalk.bold('Warning')}: Before you upgrade snapshots, ` +
|
||||
'we recommend that you revert any local changes to tests or other code, ' +
|
||||
'to ensure that you do not store invalid state.',
|
||||
);
|
||||
|
||||
const writeSnapshotVersion = () =>
|
||||
`// Jest Snapshot v${SNAPSHOT_VERSION}, ${SNAPSHOT_GUIDE_LINK}`;
|
||||
|
||||
const validateSnapshotHeader = (snapshotContents: string) => {
|
||||
const headerTest = SNAPSHOT_HEADER_REGEXP.exec(snapshotContents);
|
||||
const version = headerTest && headerTest[1];
|
||||
const guideLink = headerTest && headerTest[2];
|
||||
|
||||
if (!version) {
|
||||
return new Error(
|
||||
chalk.red(
|
||||
`${chalk.bold('Outdated snapshot')}: No snapshot header found. ` +
|
||||
'Jest 19 introduced versioned snapshots to ensure all developers ' +
|
||||
'on a project are using the same version of Jest. ' +
|
||||
'Please update all snapshots during this upgrade of Jest.\n\n',
|
||||
) + SNAPSHOT_VERSION_WARNING,
|
||||
);
|
||||
}
|
||||
|
||||
if (version < SNAPSHOT_VERSION) {
|
||||
return new Error(
|
||||
// eslint-disable-next-line prefer-template
|
||||
chalk.red(
|
||||
`${chalk.red.bold('Outdated snapshot')}: The version of the snapshot ` +
|
||||
'file associated with this test is outdated. The snapshot file ' +
|
||||
'version ensures that all developers on a project are using ' +
|
||||
'the same version of Jest. ' +
|
||||
'Please update all snapshots during this upgrade of Jest.',
|
||||
) +
|
||||
'\n\n' +
|
||||
`Expected: v${SNAPSHOT_VERSION}\n` +
|
||||
`Received: v${version}\n\n` +
|
||||
SNAPSHOT_VERSION_WARNING,
|
||||
);
|
||||
}
|
||||
|
||||
if (version > SNAPSHOT_VERSION) {
|
||||
return new Error(
|
||||
// eslint-disable-next-line prefer-template
|
||||
chalk.red(
|
||||
`${chalk.red.bold('Outdated Jest version')}: The version of this ` +
|
||||
'snapshot file indicates that this project is meant to be used ' +
|
||||
'with a newer version of Jest. The snapshot file version ensures ' +
|
||||
'that all developers on a project are using the same version of ' +
|
||||
'Jest. Please update your version of Jest and re-run the tests.',
|
||||
) +
|
||||
'\n\n' +
|
||||
`Expected: v${SNAPSHOT_VERSION}\n` +
|
||||
`Received: v${version}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (guideLink !== SNAPSHOT_GUIDE_LINK) {
|
||||
return new Error(
|
||||
// eslint-disable-next-line prefer-template
|
||||
chalk.red(
|
||||
`${chalk.red.bold(
|
||||
'Outdated guide link',
|
||||
)}: The snapshot guide link at the top of this snapshot is outdated. ` +
|
||||
'Please update all snapshots during this upgrade of Jest.',
|
||||
) +
|
||||
'\n\n' +
|
||||
`Expected: ${SNAPSHOT_GUIDE_LINK}\n` +
|
||||
`Received: ${guideLink}`,
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const normalizeTestNameForKey = (testName: string): string =>
|
||||
testName.replaceAll(/\r\n|\r|\n/g, match => {
|
||||
switch (match) {
|
||||
case '\r\n':
|
||||
return '\\r\\n';
|
||||
case '\r':
|
||||
return '\\r';
|
||||
case '\n':
|
||||
return '\\n';
|
||||
default:
|
||||
return match;
|
||||
}
|
||||
});
|
||||
|
||||
const denormalizeTestNameFromKey = (key: string): string =>
|
||||
key.replaceAll(/\\r\\n|\\r|\\n/g, match => {
|
||||
switch (match) {
|
||||
case '\\r\\n':
|
||||
return '\r\n';
|
||||
case '\\r':
|
||||
return '\r';
|
||||
case '\\n':
|
||||
return '\n';
|
||||
default:
|
||||
return match;
|
||||
}
|
||||
});
|
||||
|
||||
export const testNameToKey = (testName: string, count: number): string =>
|
||||
`${normalizeTestNameForKey(testName)} ${count}`;
|
||||
|
||||
export const keyToTestName = (key: string): string => {
|
||||
if (!/ \d+$/.test(key)) {
|
||||
throw new Error('Snapshot keys must end with a number.');
|
||||
}
|
||||
const testNameWithoutCount = key.replace(/ \d+$/, '');
|
||||
return denormalizeTestNameFromKey(testNameWithoutCount);
|
||||
};
|
||||
|
||||
export const getSnapshotData = (
|
||||
snapshotPath: string,
|
||||
update: Config.SnapshotUpdateState,
|
||||
): {
|
||||
data: SnapshotData;
|
||||
dirty: boolean;
|
||||
} => {
|
||||
const data = Object.create(null);
|
||||
let snapshotContents = '';
|
||||
let dirty = false;
|
||||
|
||||
if (fs.existsSync(snapshotPath)) {
|
||||
try {
|
||||
snapshotContents = fs.readFileSync(snapshotPath, 'utf8');
|
||||
// eslint-disable-next-line no-new-func
|
||||
const populate = new Function('exports', snapshotContents);
|
||||
populate(data);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const validationResult = validateSnapshotHeader(snapshotContents);
|
||||
const isInvalid = snapshotContents && validationResult;
|
||||
|
||||
if (update === 'none' && isInvalid) {
|
||||
throw validationResult;
|
||||
}
|
||||
|
||||
if ((update === 'all' || update === 'new') && isInvalid) {
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
return {data, dirty};
|
||||
};
|
||||
|
||||
export const escapeBacktickString = (str: string): string =>
|
||||
str.replaceAll(/`|\\|\${/g, '\\$&');
|
||||
|
||||
const printBacktickString = (str: string): string =>
|
||||
`\`${escapeBacktickString(str)}\``;
|
||||
|
||||
export const ensureDirectoryExists = (filePath: string): void => {
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(filePath), {recursive: true});
|
||||
} catch {}
|
||||
};
|
||||
|
||||
export const normalizeNewlines = (string: string): string =>
|
||||
string.replaceAll(/\r\n|\r/g, '\n');
|
||||
|
||||
export const saveSnapshotFile = (
|
||||
snapshotData: SnapshotData,
|
||||
snapshotPath: string,
|
||||
): void => {
|
||||
const snapshots = Object.keys(snapshotData)
|
||||
.sort(naturalCompare)
|
||||
.map(
|
||||
key =>
|
||||
`exports[${printBacktickString(key)}] = ${printBacktickString(
|
||||
normalizeNewlines(snapshotData[key]),
|
||||
)};`,
|
||||
);
|
||||
|
||||
ensureDirectoryExists(snapshotPath);
|
||||
fs.writeFileSync(
|
||||
snapshotPath,
|
||||
`${writeSnapshotVersion()}\n\n${snapshots.join('\n\n')}\n`,
|
||||
);
|
||||
};
|
||||
10
node_modules/@jest/snapshot-utils/tsconfig.json
generated
vendored
Normal file
10
node_modules/@jest/snapshot-utils/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "build"
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"exclude": ["./**/__mocks__/**/*", "./**/__tests__/**/*"],
|
||||
"references": [{"path": "../jest-types"}]
|
||||
}
|
||||
22
node_modules/@jest/source-map/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/source-map/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
36
node_modules/@jest/source-map/package.json
generated
vendored
Normal file
36
node_modules/@jest/source-map/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@jest/source-map",
|
||||
"version": "30.0.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-source-map"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"callsites": "^3.1.0",
|
||||
"graceful-fs": "^4.2.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/graceful-fs": "^4.1.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "5ce865b4060189fe74cd486544816c079194a0f7"
|
||||
}
|
||||
22
node_modules/@jest/test-result/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/test-result/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
38
node_modules/@jest/test-result/package.json
generated
vendored
Normal file
38
node_modules/@jest/test-result/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@jest/test-result",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-test-result"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/console": "30.2.0",
|
||||
"@jest/types": "30.2.0",
|
||||
"@types/istanbul-lib-coverage": "^2.0.6",
|
||||
"collect-v8-coverage": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest-haste-map": "30.2.0",
|
||||
"jest-resolve": "30.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/test-sequencer/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/test-sequencer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
38
node_modules/@jest/test-sequencer/package.json
generated
vendored
Normal file
38
node_modules/@jest/test-sequencer/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@jest/test-sequencer",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-test-sequencer"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/test-result": "30.2.0",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"jest-haste-map": "30.2.0",
|
||||
"slash": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-utils": "30.2.0",
|
||||
"@types/graceful-fs": "^4.1.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/transform/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/transform/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
54
node_modules/@jest/transform/package.json
generated
vendored
Normal file
54
node_modules/@jest/transform/package.json
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "@jest/transform",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-transform"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"require": "./build/index.js",
|
||||
"import": "./build/index.mjs",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.27.4",
|
||||
"@jest/types": "30.2.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"babel-plugin-istanbul": "^7.0.1",
|
||||
"chalk": "^4.1.2",
|
||||
"convert-source-map": "^2.0.0",
|
||||
"fast-json-stable-stringify": "^2.1.0",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"jest-haste-map": "30.2.0",
|
||||
"jest-regex-util": "30.0.1",
|
||||
"jest-util": "30.2.0",
|
||||
"micromatch": "^4.0.8",
|
||||
"pirates": "^4.0.7",
|
||||
"slash": "^3.0.0",
|
||||
"write-file-atomic": "^5.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/test-utils": "30.2.0",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/convert-source-map": "^2.0.3",
|
||||
"@types/graceful-fs": "^4.1.9",
|
||||
"@types/micromatch": "^4.0.9",
|
||||
"@types/write-file-atomic": "^4.0.3",
|
||||
"dedent": "^1.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
22
node_modules/@jest/types/LICENSE
generated
vendored
Normal file
22
node_modules/@jest/types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
Copyright Contributors to the Jest project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
30
node_modules/@jest/types/README.md
generated
vendored
Normal file
30
node_modules/@jest/types/README.md
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# @jest/types
|
||||
|
||||
This package contains shared types of Jest's packages.
|
||||
|
||||
If you are looking for types of [Jest globals](https://jestjs.io/docs/api), you can import them from `@jest/globals` package:
|
||||
|
||||
```ts
|
||||
import {describe, expect, it} from '@jest/globals';
|
||||
|
||||
describe('my tests', () => {
|
||||
it('works', () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
If you prefer to omit imports, a similar result can be achieved installing the [@types/jest](https://npmjs.com/package/@types/jest) package. Note that this is a third party library maintained at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) and may not cover the latest Jest features.
|
||||
|
||||
Another use-case for `@types/jest` is a typed Jest config as those types are not provided by Jest out of the box:
|
||||
|
||||
```ts
|
||||
// jest.config.ts
|
||||
import type {Config} from '@jest/types';
|
||||
|
||||
const config: Config.InitialOptions = {
|
||||
// some typed config
|
||||
};
|
||||
|
||||
export default config;
|
||||
```
|
||||
35
node_modules/@jest/types/package.json
generated
vendored
Normal file
35
node_modules/@jest/types/package.json
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@jest/types",
|
||||
"version": "30.2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jestjs/jest.git",
|
||||
"directory": "packages/jest-types"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./build/index.js",
|
||||
"types": "./build/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./build/index.d.ts",
|
||||
"default": "./build/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/pattern": "30.0.1",
|
||||
"@jest/schemas": "30.0.5",
|
||||
"@types/istanbul-lib-coverage": "^2.0.6",
|
||||
"@types/istanbul-reports": "^3.0.4",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^17.0.33",
|
||||
"chalk": "^4.1.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "855864e3f9751366455246790be2bf912d4d0dac"
|
||||
}
|
||||
Reference in New Issue
Block a user