@swc/plugin-jest 7.0.3 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @swc/plugin-jest
2
2
 
3
+ ## 8.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - cf2636b: Update swc_core to v27
8
+
9
+ ## 7.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - e3e743d: Update swc_core to v27
14
+
3
15
  ## 7.0.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  # @swc/plugin-jest
4
4
 
5
+ ## 8.0.0
6
+
7
+ ### Major Changes
8
+
9
+ - cf2636b: Update swc_core to v27
10
+
11
+ ## 7.0.4
12
+
13
+ ### Patch Changes
14
+
15
+ - e3e743d: Update swc_core to v27
16
+
5
17
  ## 7.0.3
6
18
 
7
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/plugin-jest",
3
- "version": "7.0.3",
3
+ "version": "8.0.0",
4
4
  "description": "SWC plugin for jest",
5
5
  "main": "swc_plugin_jest.wasm",
6
6
  "homepage": "https://swc.rs",
Binary file
package/Cargo.toml DELETED
@@ -1,26 +0,0 @@
1
- [package]
2
- authors = { workspace = true }
3
- description = "Jest plugin for https://swc.rs"
4
- edition = { workspace = true }
5
- homepage = { workspace = true }
6
- license = { workspace = true }
7
- name = "swc_plugin_jest"
8
- publish = false
9
- repository = { workspace = true }
10
- rust-version = { workspace = true }
11
- version = "0.31.4"
12
-
13
-
14
- [lib]
15
- crate-type = ["cdylib", "rlib"]
16
-
17
- [dependencies]
18
- phf = { workspace = true, features = ["macros"] }
19
- serde = { workspace = true, features = ["derive"] }
20
- swc_common = { workspace = true, features = ["concurrent"] }
21
- swc_core = { workspace = true, features = ["ecma_plugin_transform"] }
22
- swc_ecma_ast = { workspace = true }
23
- swc_ecma_utils = { workspace = true }
24
- swc_ecma_visit = { workspace = true }
25
- swc_plugin_macro = { workspace = true }
26
- tracing = { workspace = true, features = ["release_max_level_off"] }
@@ -1,95 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { transform, type Options } from "@swc/core";
3
- import path from "node:path";
4
- import url from "node:url";
5
-
6
- const options: Options = {
7
- jsc: {
8
- parser: {
9
- syntax: "ecmascript",
10
- jsx: true,
11
- },
12
- experimental: {
13
- plugins: [
14
- [
15
- path.join(
16
- path.dirname(url.fileURLToPath(import.meta.url)),
17
- "..",
18
- "swc_plugin_jest.wasm",
19
- ),
20
- {},
21
- ],
22
- ],
23
- },
24
- },
25
- };
26
-
27
- describe("jest swc plugin", () => {
28
- it("should hoist jest.mock calls", async () => {
29
- const input = `
30
- console.log('before mock');
31
- jest.mock('./some-module');
32
- console.log('after mock');
33
- `;
34
-
35
- const output = await transform(input, options);
36
-
37
- // Remove whitespace and newlines for comparison
38
- const normalizedOutput = output.code.replace(/\s+/g, "");
39
- const expectedOutput = `
40
- jest.mock('./some-module');
41
- console.log('before mock');
42
- console.log('after mock');
43
- `.replace(/\s+/g, "");
44
-
45
- expect(normalizedOutput).toBe(expectedOutput);
46
- });
47
-
48
- it("should hoist multiple jest method calls", async () => {
49
- const input = `
50
- console.log('start');
51
- jest.unmock('./module-a');
52
- var something = true;
53
- jest.mock('./module-b');
54
- jest.enableAutomock();
55
- console.log('end');
56
- `;
57
-
58
- const output = await transform(input, options);
59
-
60
- // Remove whitespace and newlines for comparison
61
- const normalizedOutput = output.code.replace(/\s+/g, "");
62
- const expectedOutput = `
63
- jest.unmock('./module-a');
64
- jest.mock('./module-b');
65
- jest.enableAutomock();
66
- console.log('start');
67
- var something = true;
68
- console.log('end');
69
- `.replace(/\s+/g, "");
70
-
71
- expect(normalizedOutput).toBe(expectedOutput);
72
- });
73
-
74
- it("should not hoist non-hoistable jest methods", async () => {
75
- const input = `
76
- console.log('start');
77
- jest.spyOn(something, 'method');
78
- jest.mock('./module');
79
- console.log('end');
80
- `;
81
-
82
- const output = await transform(input, options);
83
-
84
- // Remove whitespace and newlines for comparison
85
- const normalizedOutput = output.code.replace(/\s+/g, "");
86
- const expectedOutput = `
87
- jest.mock('./module');
88
- console.log('start');
89
- jest.spyOn(something, 'method');
90
- console.log('end');
91
- `.replace(/\s+/g, "");
92
-
93
- expect(normalizedOutput).toBe(expectedOutput);
94
- });
95
- });