chore: refactor jest configuration
This commit is contained in:
parent
4c6f90b276
commit
16d68e73d1
|
@ -0,0 +1,54 @@
|
|||
/** @type {import('jest').Config} */
|
||||
const config = {
|
||||
prettierPath: require.resolve("prettier-2"),
|
||||
forceExit: true,
|
||||
setupFilesAfterEnv: ["<rootDir>/test/setupTestFramework.js"],
|
||||
testMatch: [
|
||||
"<rootDir>/test/*.test.js",
|
||||
"<rootDir>/test/*.basictest.js",
|
||||
"<rootDir>/test/*.longtest.js",
|
||||
"<rootDir>/test/*.unittest.js"
|
||||
],
|
||||
watchPathIgnorePatterns: [
|
||||
"<rootDir>/.git",
|
||||
"<rootDir>/node_modules",
|
||||
"<rootDir>/test/js",
|
||||
"<rootDir>/test/browsertest/js",
|
||||
"<rootDir>/test/fixtures/temp-cache-fixture",
|
||||
"<rootDir>/test/fixtures/temp-",
|
||||
"<rootDir>/benchmark",
|
||||
"<rootDir>/assembly",
|
||||
"<rootDir>/tooling",
|
||||
"<rootDir>/examples/*/dist",
|
||||
"<rootDir>/coverage",
|
||||
"<rootDir>/.eslintcache"
|
||||
],
|
||||
modulePathIgnorePatterns: [
|
||||
"<rootDir>/.git",
|
||||
"<rootDir>/node_modules/webpack/node_modules",
|
||||
"<rootDir>/test/js",
|
||||
"<rootDir>/test/browsertest/js",
|
||||
"<rootDir>/test/fixtures/temp-cache-fixture",
|
||||
"<rootDir>/test/fixtures/temp-",
|
||||
"<rootDir>/benchmark",
|
||||
"<rootDir>/examples/*/dist",
|
||||
"<rootDir>/coverage",
|
||||
"<rootDir>/.eslintcache"
|
||||
],
|
||||
transformIgnorePatterns: ["<rootDir>"],
|
||||
coverageDirectory: "<rootDir>/coverage",
|
||||
coveragePathIgnorePatterns: [
|
||||
"\\.runtime\\.js$",
|
||||
"<rootDir>/test",
|
||||
"<rootDir>/schemas",
|
||||
"<rootDir>/node_modules"
|
||||
],
|
||||
testEnvironment: "./test/patch-node-env.js",
|
||||
coverageReporters: ["json"],
|
||||
snapshotFormat: {
|
||||
escapeString: true,
|
||||
printBasicPrototype: true
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = config;
|
57
package.json
57
package.json
|
@ -85,6 +85,7 @@
|
|||
"nyc": "^15.1.0",
|
||||
"open-cli": "^7.2.0",
|
||||
"prettier": "^3.2.1",
|
||||
"prettier-2": "npm:prettier@^2",
|
||||
"pretty-format": "^29.5.0",
|
||||
"pug": "^3.0.0",
|
||||
"pug-loader": "^2.4.0",
|
||||
|
@ -186,61 +187,5 @@
|
|||
"*.md|{.github,benchmark,bin,examples,hot,lib,schemas,setup,tooling}/**/*.{md,yml,yaml,js,json}": [
|
||||
"cspell"
|
||||
]
|
||||
},
|
||||
"jest": {
|
||||
"forceExit": true,
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/test/setupTestFramework.js"
|
||||
],
|
||||
"testMatch": [
|
||||
"<rootDir>/test/*.test.js",
|
||||
"<rootDir>/test/*.basictest.js",
|
||||
"<rootDir>/test/*.longtest.js",
|
||||
"<rootDir>/test/*.unittest.js"
|
||||
],
|
||||
"watchPathIgnorePatterns": [
|
||||
"<rootDir>/.git",
|
||||
"<rootDir>/node_modules",
|
||||
"<rootDir>/test/js",
|
||||
"<rootDir>/test/browsertest/js",
|
||||
"<rootDir>/test/fixtures/temp-cache-fixture",
|
||||
"<rootDir>/test/fixtures/temp-",
|
||||
"<rootDir>/benchmark",
|
||||
"<rootDir>/assembly",
|
||||
"<rootDir>/tooling",
|
||||
"<rootDir>/examples/*/dist",
|
||||
"<rootDir>/coverage",
|
||||
"<rootDir>/.eslintcache"
|
||||
],
|
||||
"modulePathIgnorePatterns": [
|
||||
"<rootDir>/.git",
|
||||
"<rootDir>/node_modules/webpack/node_modules",
|
||||
"<rootDir>/test/js",
|
||||
"<rootDir>/test/browsertest/js",
|
||||
"<rootDir>/test/fixtures/temp-cache-fixture",
|
||||
"<rootDir>/test/fixtures/temp-",
|
||||
"<rootDir>/benchmark",
|
||||
"<rootDir>/examples/*/dist",
|
||||
"<rootDir>/coverage",
|
||||
"<rootDir>/.eslintcache"
|
||||
],
|
||||
"transformIgnorePatterns": [
|
||||
"<rootDir>"
|
||||
],
|
||||
"coverageDirectory": "<rootDir>/coverage",
|
||||
"coveragePathIgnorePatterns": [
|
||||
"\\.runtime\\.js$",
|
||||
"<rootDir>/test",
|
||||
"<rootDir>/schemas",
|
||||
"<rootDir>/node_modules"
|
||||
],
|
||||
"testEnvironment": "./test/patch-node-env.js",
|
||||
"coverageReporters": [
|
||||
"json"
|
||||
],
|
||||
"snapshotFormat": {
|
||||
"escapeString": true,
|
||||
"printBasicPrototype": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -642,6 +642,7 @@ describe("snapshots", () => {
|
|||
"hash": true,
|
||||
"timestamp": true,
|
||||
},
|
||||
"unmanagedPaths": Array [],
|
||||
},
|
||||
"stats": Object {},
|
||||
"target": "web",
|
||||
|
@ -2197,125 +2198,127 @@ describe("snapshots", () => {
|
|||
},
|
||||
e =>
|
||||
e.toMatchInlineSnapshot(`
|
||||
- Expected
|
||||
+ Received
|
||||
- Expected
|
||||
+ Received
|
||||
|
||||
@@ ... @@
|
||||
- "asyncWebAssembly": false,
|
||||
- "backCompat": true,
|
||||
+ "asyncWebAssembly": true,
|
||||
+ "backCompat": false,
|
||||
@@ ... @@
|
||||
- "cacheUnaffected": false,
|
||||
- "css": undefined,
|
||||
- "futureDefaults": false,
|
||||
+ "cacheUnaffected": true,
|
||||
+ "css": true,
|
||||
+ "futureDefaults": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
+ "test": /\\.wasm$/i,
|
||||
+ "type": "webassembly/async",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "mimetype": "application/wasm",
|
||||
+ "rules": Array [
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
+ "type": "webassembly/async",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
@@ ... @@
|
||||
+ "test": /\\.css$/i,
|
||||
+ "type": "css/auto",
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ "mimetype": "text/css+module",
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
+ },
|
||||
+ "type": "css/module",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "mimetype": "text/css",
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
+ },
|
||||
+ "type": "css",
|
||||
+ },
|
||||
+ Object {
|
||||
@@ ... @@
|
||||
- "generator": Object {},
|
||||
+ "generator": Object {
|
||||
+ "css": Object {
|
||||
+ "exportsOnly": false,
|
||||
+ },
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ "css": Object {
|
||||
+ "namedExports": true,
|
||||
@@ ... @@
|
||||
+ "exportsPresence": "error",
|
||||
@@ ... @@
|
||||
- "__dirname": "mock",
|
||||
- "__filename": "mock",
|
||||
- "global": true,
|
||||
+ "__dirname": "warn-mock",
|
||||
+ "__filename": "warn-mock",
|
||||
+ "global": "warn",
|
||||
@@ ... @@
|
||||
+ "css",
|
||||
@@ ... @@
|
||||
- "hashDigestLength": 20,
|
||||
- "hashFunction": "md4",
|
||||
+ "hashDigestLength": 16,
|
||||
+ "hashFunction": "xxhash64",
|
||||
@@ ... @@
|
||||
+ "...",
|
||||
+ ],
|
||||
+ },
|
||||
+ "css-import": Object {
|
||||
+ "conditionNames": Array [
|
||||
+ "webpack",
|
||||
+ "production",
|
||||
+ "style",
|
||||
+ ],
|
||||
+ "extensions": Array [
|
||||
+ ".css",
|
||||
+ ],
|
||||
+ "mainFields": Array [
|
||||
+ "style",
|
||||
@@ ... @@
|
||||
+ "mainFiles": Array [],
|
||||
+ "preferRelative": true,
|
||||
@@ ... @@
|
||||
- "<cwd>/node_modules/",
|
||||
+ /^(.+?[\\\\/]node_modules[\\\\/])/,
|
||||
`)
|
||||
@@ ... @@
|
||||
- "asyncWebAssembly": false,
|
||||
- "backCompat": true,
|
||||
+ "asyncWebAssembly": true,
|
||||
+ "backCompat": false,
|
||||
@@ ... @@
|
||||
- "cacheUnaffected": false,
|
||||
- "css": undefined,
|
||||
- "futureDefaults": false,
|
||||
+ "cacheUnaffected": true,
|
||||
+ "css": true,
|
||||
+ "futureDefaults": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
+ "test": /\\.wasm$/i,
|
||||
+ "type": "webassembly/async",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "mimetype": "application/wasm",
|
||||
+ "rules": Array [
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
+ },
|
||||
+ ],
|
||||
+ "type": "webassembly/async",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
+ },
|
||||
+ "test": /\\.css$/i,
|
||||
+ "type": "css/auto",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "mimetype": "text/css+module",
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
@@ ... @@
|
||||
+ "type": "css/module",
|
||||
+ },
|
||||
+ Object {
|
||||
+ "mimetype": "text/css",
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ "preferRelative": true,
|
||||
+ },
|
||||
+ "type": "css",
|
||||
+ },
|
||||
@@ ... @@
|
||||
- "generator": Object {},
|
||||
+ "generator": Object {
|
||||
+ "css": Object {
|
||||
+ "exportsOnly": false,
|
||||
+ },
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ "css": Object {
|
||||
+ "namedExports": true,
|
||||
@@ ... @@
|
||||
+ "exportsPresence": "error",
|
||||
@@ ... @@
|
||||
- "__dirname": "mock",
|
||||
- "__filename": "mock",
|
||||
- "global": true,
|
||||
+ "__dirname": "warn-mock",
|
||||
+ "__filename": "warn-mock",
|
||||
+ "global": "warn",
|
||||
@@ ... @@
|
||||
+ "css",
|
||||
@@ ... @@
|
||||
- "hashDigestLength": 20,
|
||||
- "hashFunction": "md4",
|
||||
+ "hashDigestLength": 16,
|
||||
+ "hashFunction": "xxhash64",
|
||||
@@ ... @@
|
||||
+ "...",
|
||||
+ ],
|
||||
+ },
|
||||
+ "css-import": Object {
|
||||
+ "conditionNames": Array [
|
||||
+ "webpack",
|
||||
+ "production",
|
||||
+ "style",
|
||||
+ ],
|
||||
+ "extensions": Array [
|
||||
+ ".css",
|
||||
+ ],
|
||||
+ "mainFields": Array [
|
||||
+ "style",
|
||||
@@ ... @@
|
||||
+ "mainFiles": Array [],
|
||||
+ "preferRelative": true,
|
||||
@@ ... @@
|
||||
- "<cwd>/node_modules/",
|
||||
+ /^(.+?[\\\\/]node_modules[\\\\/])/,
|
||||
@@ ... @@
|
||||
- "unmanagedPaths": Array [],
|
||||
`)
|
||||
);
|
||||
|
||||
test(
|
||||
|
@ -2344,9 +2347,10 @@ describe("snapshots", () => {
|
|||
+ "css": false,
|
||||
+ "futureDefaults": true,
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ Object {
|
||||
+ "rules": Array [
|
||||
@@ ... @@
|
||||
+ Object {
|
||||
+ "descriptionData": Object {
|
||||
+ "type": "module",
|
||||
+ },
|
||||
|
@ -2367,12 +2371,11 @@ describe("snapshots", () => {
|
|||
+ },
|
||||
+ "resolve": Object {
|
||||
+ "fullySpecified": true,
|
||||
+ },
|
||||
@@ ... @@
|
||||
+ },
|
||||
+ ],
|
||||
+ "type": "webassembly/async",
|
||||
+ },
|
||||
+ Object {
|
||||
@@ ... @@
|
||||
+ "exportsPresence": "error",
|
||||
@@ ... @@
|
||||
|
@ -2390,6 +2393,8 @@ describe("snapshots", () => {
|
|||
@@ ... @@
|
||||
- "<cwd>/node_modules/",
|
||||
+ /^(.+?[\\\\/]node_modules[\\\\/])/,
|
||||
@@ ... @@
|
||||
- "unmanagedPaths": Array [],
|
||||
`)
|
||||
);
|
||||
});
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -5131,6 +5131,11 @@ prelude-ls@~1.1.2:
|
|||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
|
||||
integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==
|
||||
|
||||
"prettier-2@npm:prettier@^2", prettier@^2.0.5:
|
||||
version "2.8.8"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
|
||||
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
|
||||
|
||||
prettier-linter-helpers@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
|
||||
|
@ -5138,11 +5143,6 @@ prettier-linter-helpers@^1.0.0:
|
|||
dependencies:
|
||||
fast-diff "^1.1.2"
|
||||
|
||||
prettier@^2.0.5:
|
||||
version "2.8.8"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
|
||||
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
|
||||
|
||||
prettier@^3.2.1:
|
||||
version "3.2.3"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.3.tgz#98501d99141a9a10d5ceaf74cf39c8b7cbddd380"
|
||||
|
|
Loading…
Reference in New Issue