Comments (10)
@SimenB do you object we re-expose these functions/types?
from jest.
Perhaps the utils could simply be published as separate @jest/snapshot-utils
package?
from jest.
I'm ok with either approach. @SimenB, what's your take?
from jest.
Separate util package makes sense to me 👍 Happy to take a PR to that effect 🙂
from jest.
@SimenB, a few follow-up questions regarding splitting the utils into its own package @jest/snapshot-utils
:
Circular Reference
Is it correct to assume that you would prefer the @jest/snapshot-utils
package not to depend on the @jest/snapshot
package due to circular reference? If that is the case, we have the following dependency issues to resolve:
In utils.ts
:
import {getSerializers} from './plugins';
import type {SnapshotData} from './types';
- The
./plugins
module is not used anywhere except inutils.ts
. Should we move it to@jest/snapshot-utils
as well? - The type
SnapshotData
from./types
is simply aRecord<string, string>
. Do we want to create a new package@jest/snapshot-types
for a single line type definition? Or maybe the whole./types
file?
Re-evaluation
Given these issues, do we still favor splitting utils.ts
into new packages (@jest/snapshot-utils
, @jest/snapshot-types
) over exposing it within @jest/snapshot
?
from jest.
In TypeScript repo they have public and internal utilities. Perhaps similar strategy could be adopted? I mean, the new package could exposing only getSnapshotData()
, testNameToKey()
and other actually useful utilities not all what utils.ts
contains.
By the way, I think SnapshotData
can be replaced with Record<string, string>
. That looks fine, because TypeScript does not have nominal types.
UPDATE: Or SnapshotData
could be exported from the new package, because it is part of the return type of getSnapshotData()
.
from jest.
Moving SnapshotData
to the new package should be fine, yeah
from jest.
sorry for the delay, I am back to this issue now. One more question, given the jest-snapshot
doesn't use the "@jest" scope (not sure what the naming rule is), do we want the new package to be @jest/snapshot-utils
or jest-snapshot-utils
?
from jest.
The old ones don't as they predate our ownership of the jest
org on NPM. All new packages should use the namescaped one, but we don't wanna migrate old ones (just to avoid dependents getting left behind).
from jest.
https://github.com/jestjs/jest/releases/tag/v30.0.0-alpha.5
from jest.
Related Issues (20)
- [Docs]: All old Upgrade Guides before v28 to v29 are missing HOT 1
- [Please read the message below] HOT 1
- [Docs]: toThrow fails if error object contains a `cause` property HOT 1
- [Bug]: New SERIALIZABLE_PROPERTIES is only used by matcher-utils HOT 2
- [Bug]: Missing Initializer in const declaration HOT 1
- [Bug]: `ReferenceError: Export 'emit' is not defined in module` from Jest internals during suite setup. HOT 14
- [Bug]: DataCloneError: Symbol(jest.asymmetricMatcher) could not be cloned using `--workerThreads`. HOT 2
- [Bug]: jest.resetModules does not works for jest.unstable_mockModule HOT 2
- [Feature]: Predicate matching on snapshot values
- [Bug]: `it.each` from `@jest/globals` causes typescript errors with readonly arrays HOT 2
- [Bug]: Dependency with outdated Windows executables HOT 4
- [Bug]: npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. HOT 14
- [Docs]: broken link HOT 2
- [Bug]: broken runAllTimers
- [Bug]: Jest ignores near all files on Windows with GNU find HOT 2
- [Bug]: toMatchObject doesn't work if object contains File
- [Bug]: jest.mock('package-name') does nothing HOT 1
- [Bug]: Mocking Partials (in with ES6 modules) doesn't work as per documentation HOT 5
- [Feature]: Expose all matchers as asymmetric matchers
- [Bug]: Add top level `endTime` when using --json reporter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jest.