test(es/plugin): Reenable compat test (#5969)

This commit is contained in:
OJ Kwon 2022-09-27 18:54:51 -07:00 committed by GitHub
parent f655488cfa
commit ca38a7027e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3924 additions and 7705 deletions

View File

@ -80,8 +80,7 @@ describe("Published plugins", () => {
experimental: {
plugins: [
["@swc/plugin-jest", {}],
// Disabled because this plugin is broken
// ["swc-plugin-coverage-instrument", {}],
["swc-plugin-coverage-instrument", {}],
],
},
},
@ -94,7 +93,51 @@ describe("Published plugins", () => {
);
expect(code).toMatchInlineSnapshot(`
"console.log(\\"hello world\\");
"function cov_8828012090449151314() {
var path = \\"unknown.js\\";
var hash = \\"7618951444430927811\\";
var global = new ((function(){}).constructor)(\\"return this\\")();
var gcv = \\"__coverage__\\";
var coverageData = {
all: false,
path: \\"unknown.js\\",
statementMap: {
\\"0\\": {
start: {
line: 1,
column: 0
},
end: {
line: 1,
column: 26
}
}
},
fnMap: {},
branchMap: {},
s: {
\\"0\\": 0
},
f: {},
b: {},
_coverageSchema: \\"11020577277169172593\\",
hash: \\"7618951444430927811\\"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
cov_8828012090449151314 = function cov_8828012090449151314() {
return actualCoverage;
};
}
return actualCoverage;
}
cov_8828012090449151314();
cov_8828012090449151314().s[0]++;
console.log(\\"hello world\\");
"
`);
});

View File

@ -134,7 +134,7 @@
"source-map": "^0.7.3",
"source-map-support": "^0.5.19",
"sourcemap-validator": "^2.1.0",
"swc-plugin-coverage-instrument": "^0.0.12",
"swc-plugin-coverage-instrument": "^0.0.13",
"terser": "^5.7.1",
"ts-node": "^10.5.0",
"typescript": "^4.5.2"

11578
yarn.lock

File diff suppressed because it is too large Load Diff