@jsenv/snapshot 2.16.0 → 2.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/snapshot",
3
- "version": "2.16.0",
3
+ "version": "2.16.1",
4
4
  "description": "Snapshot testing",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,6 +50,7 @@ export const renderSideEffects = (
50
50
  // and in that case we might want to move it to an other file
51
51
  dedicatedFile: { line: 50, length: 5000 },
52
52
  }),
53
+ sourceLocation = false,
53
54
  errorTransform,
54
55
  } = {},
55
56
  ) => {
@@ -97,6 +98,7 @@ export const renderSideEffects = (
97
98
  replace,
98
99
  errorTransform,
99
100
  lastSideEffectNumber,
101
+ sourceLocation,
100
102
  });
101
103
  }
102
104
  markdown += sideEffectMd;
@@ -163,6 +165,7 @@ const renderOneSideEffect = (
163
165
  replace,
164
166
  errorTransform,
165
167
  lastSideEffectNumber,
168
+ sourceLocation,
166
169
  },
167
170
  ) => {
168
171
  const { render } = sideEffect;
@@ -197,6 +200,7 @@ const renderOneSideEffect = (
197
200
  replace,
198
201
  rootDirectoryUrl,
199
202
  errorTransform,
203
+ sourceLocation,
200
204
  });
201
205
  }
202
206
  if (sideEffect.code === "source_code") {
@@ -233,6 +237,7 @@ const renderText = (
233
237
  replace,
234
238
  rootDirectoryUrl,
235
239
  errorTransform,
240
+ sourceLocation,
236
241
  },
237
242
  ) => {
238
243
  if (text && typeof text === "object") {
@@ -247,8 +252,15 @@ const renderText = (
247
252
  sideEffectMdFileUrl,
248
253
  { preferRelativeNotation: true },
249
254
  );
250
- const sourceCodeLinkText = `${callSiteRelativeUrl}:${callSite.line}:${callSite.column}`;
251
- const sourceCodeLinkHref = `${callSiteRelativeUrl}#L${callSite.line}`;
255
+ let sourceCodeLinkText;
256
+ let sourceCodeLinkHref;
257
+ if (sourceLocation) {
258
+ sourceCodeLinkText = `${callSiteRelativeUrl}:${callSite.line}:${callSite.column}`;
259
+ sourceCodeLinkHref = `${callSiteRelativeUrl}#L${callSite.line}`;
260
+ } else {
261
+ sourceCodeLinkText = `${callSiteRelativeUrl}`;
262
+ sourceCodeLinkHref = `${callSiteRelativeUrl}`;
263
+ }
252
264
  sourceMd += "\n";
253
265
  sourceMd += renderSmallLink({
254
266
  text: sourceCodeLinkText,